===================================================================== Found a 109 line (256 tokens) duplication in the following files: Starting at line 93 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/graph/TextAreaRenderer.java Starting at line 90 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/graph/MultiLineLabelRenderer.java key.equals(UMLGraphConstants.LINECOLOR) || key.equals(UMLGraphConstants.BACKGROUND) || key.equals(UMLGraphConstants.FOREGROUND) || key.equals(UMLGraphConstants.FONTNAME) || key.equals(UMLGraphConstants.FONTSIZE) || key.equals(UMLGraphConstants.FONTSTYLE) || key.equals(UMLGraphConstants.OPAQUE); } /** * Configure and return the renderer based on the passed in * components. The value is typically set from messaging the * graph with convertValueToString. * We recommend you check the value's class and throw an * illegal argument exception if it's not correct. * * @see com.jgraph.graph.CellViewRenderer#getRendererComponent(JGraph, CellView, boolean, boolean, boolean) * @param graph the graph that that defines the rendering context. * @param value the object that should be rendered. * @param selected whether the object is selected. * @param hasFocus whether the object has the focus. * @param isPreview whether we are drawing a preview. * @return the component used to render the value. */ public Component getRendererComponent(JGraph graph, CellView view, boolean sel, boolean focus, boolean preview) { this.view = view; setComponentOrientation(graph.getComponentOrientation()); if (graph.getEditingCell() != view.getCell()) { Object label = graph.convertValueToString(view.getCell()); if (label != null) setText(label.toString()); else setText(null); } else setText(null); this.graph = graph; this.hasFocus = focus; this.selected = sel; this.preview = preview; if (this.view.isLeaf()) installAttributes(view); else { setText(null); setBorder(null); setOpaque(false); } return this; } /** * Paints this component. * * @param g The graphics context to use for painting. * @see java.awt.Component#paint(Graphics) */ public void paint(Graphics g) { super.paint(g); /* if (selected || hasFocus) { ((Graphics2D) g).setStroke(UMLGraphConstants.SELECTION_STROKE); if (hasFocus) g.setColor(graph.getGridColor()); else if (selected) g.setColor(graph.getHighlightColor()); } */ } /** * Returns the fillColor. * @return Color */ public Color getFillColor() { return fillColor; } /** * Returns the lineColor. * @return Color */ public Color getLineColor() { return lineColor; } /** * Sets the fillColor. * @param fillColor The fillColor to set */ public void setFillColor(Color fillColor) { this.fillColor = fillColor; } /** * Sets the lineColor. * @param lineColor The lineColor to set */ public void setLineColor(Color lineColor) { this.lineColor = lineColor; } } ===================================================================== Found a 26 line (135 tokens) duplication in the following files: Starting at line 26 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/factory/UMLStateBuilder.java Starting at line 26 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/factory/UMLActivityBuilder.java return new UMLActivityCell(view.getName()); } /** * @see rv.viewer.factory.GraphBuilder#getCellAttributes(RoseItemView) */ public Map getCellAttributes(RoseItemView view) { Map attr = super.getCellAttributes(view); UMLGraphConstants.setFontName(attr, view.getFont().getFace()); UMLGraphConstants.setFontSize(attr, translateFontSize( view.getFont().getSize())); UMLGraphConstants.setForeground(attr, view.getFont().getColour()); Color lc = view.getLineColour(); if (lc == null) UMLGraphConstants.setLineColor(attr, Color.black); else UMLGraphConstants.setLineColor(attr, lc); Color fc = view.getFillColour(); if (fc instanceof Color) UMLGraphConstants.setFillColor(attr, fc); return attr; } } ===================================================================== Found a 38 line (130 tokens) duplication in the following files: Starting at line 57 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/graph/TextAreaRenderer.java Starting at line 54 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/graph/MultiLineLabelRenderer.java defaultBackground = UIManager.getColor("Tree.textBackground"); } /** * Install the attributesArea of specified cell in this * renderer instance. This means, retrieve every published * key from the cells hashtable and set global variables * or superclass properties accordingly. * * @param cell to retrieve the attribute values from. */ protected void installAttributes(CellView view) { Map map = view.getAttributes(); setOpaque(UMLGraphConstants.isOpaque(map)); setFont(UMLGraphConstants.getFont(map)); Color foreground = UMLGraphConstants.getForeground(map); setForeground((foreground != null) ? foreground : defaultForeground); Color background = UMLGraphConstants.getBackground(map); setBackground((background != null) ? background : defaultBackground); setLineColor(UMLGraphConstants.getLineColor(map)); setFillColor(UMLGraphConstants.getFillColor(map)); } /** * Returns true if key is a supported * attribute in the renderer. Supported attributesArea affect the * visual appearance of the renderer. * * @param key the key that defines the attribute to be checked. * @return true if key is supported by this renderer. */ public boolean supportsAttribute(Object key) { return key.equals(UMLGraphConstants.BOUNDS) || key.equals(UMLGraphConstants.LINECOLOR) || key.equals(UMLGraphConstants.BACKGROUND) || ===================================================================== Found a 35 line (113 tokens) duplication in the following files: Starting at line 44 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/graph/UMLActivityRenderer.java Starting at line 44 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/graph/UMLStateRenderer.java if (getFillColor() != null) { g.setColor(getFillColor()); g.drawRoundRect(0, 0, w, h, aw, ah); } g.setColor(getLineColor()); g.drawRoundRect(0, 0, w, h, aw, ah); g.setColor(getForeground()); super.paint(g); } /** * Returns true if key is a supported attribute in the renderer. * * @param key the key that defines the attribute to be checked. * @return true if key is supported by this renderer. * @see com.jgraph.graph.CellViewRenderer#supportsAttribute(Object) */ public boolean supportsAttribute(Object key) { if (key.equals(UMLGraphConstants.FILLCOLOR)) return true; else return super.supportsAttribute(key); } /** * @see java.awt.Container#getInsets() */ public Insets getInsets() { return insets; } } ===================================================================== Found a 16 line (102 tokens) duplication in the following files: Starting at line 27 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/factory/UMLStateBuilder.java Starting at line 35 of /home/tom/pmd/pmd-web/src/jroseviewer/src/rv/viewer/factory/UMLComponentBuilder.java } /** * @see rv.viewer.factory.GraphBuilder#getCellAttributes(RoseItemView) */ public Map getCellAttributes(RoseItemView view) { Map attr = super.getCellAttributes(view); UMLGraphConstants.setFontName(attr, view.getFont().getFace()); UMLGraphConstants.setFontSize(attr, translateFontSize( view.getFont().getSize())); UMLGraphConstants.setForeground(attr, view.getFont().getColour()); Color lc = view.getLineColour(); if (lc == null) UMLGraphConstants.setLineColor(attr, Color.black); else UMLGraphConstants.setLineColor(attr, lc);