Author: tfmorris Date: 2008-05-13 06:46:00-0700 New Revision: 14718 Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java
Log: Don't need to check for null return on getStereotypes Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=14718&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=14717&r2=14718 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java (original) +++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java 2008-05-13 06:46:00-0700 @@ -1630,47 +1630,42 @@ .setHidingStereotypesWithIcon(hiding); } - if (practicalView == DiagramAppearance.STEREOTYPE_VIEW_BIG_ICON) { - - // TODO: do we need to test for null? The getStereotypes call above - // should guarantee an empty collection rather than a null - // collection - if (stereos != null) { - Image replaceIcon = null; - - if (stereos.size() == 1) { - Object stereo = stereos.iterator().next(); - // TODO: Should we not use getProject here? - replaceIcon = ProjectManager.getManager() - .getCurrentProject().getProfileConfiguration() - .getFigNodeStrategy().getIconForStereotype(stereo); - } - - if (replaceIcon != null) { - stereotypeFigProfileIcon = new FigProfileIcon(replaceIcon, - getName()); - stereotypeFigProfileIcon.setOwner(getOwner()); - - stereotypeFigProfileIcon.setLocation(getBigPort() - .getLocation()); - addFig(stereotypeFigProfileIcon); - - originalNameFig = this.getNameFig(); - final FigText labelFig = - stereotypeFigProfileIcon.getLabelFig(); - setNameFig(labelFig); - - labelFig.addPropertyChangeListener(this); - - getBigPort(). - setBounds(stereotypeFigProfileIcon.getBounds()); - - for (Object fig : getFigs()) { - ((Fig) fig).setVisible(fig == stereotypeFigProfileIcon); - } - - } - } + if (practicalView == DiagramAppearance.STEREOTYPE_VIEW_BIG_ICON) { + + Image replaceIcon = null; + + if (stereos.size() == 1) { + Object stereo = stereos.iterator().next(); + // TODO: Should we not use getProject here? + replaceIcon = ProjectManager.getManager().getCurrentProject() + .getProfileConfiguration().getFigNodeStrategy() + .getIconForStereotype(stereo); + } + + if (replaceIcon != null) { + stereotypeFigProfileIcon = new FigProfileIcon(replaceIcon, + getName()); + stereotypeFigProfileIcon.setOwner(getOwner()); + + stereotypeFigProfileIcon.setLocation(getBigPort() + .getLocation()); + addFig(stereotypeFigProfileIcon); + + originalNameFig = this.getNameFig(); + final FigText labelFig = + stereotypeFigProfileIcon.getLabelFig(); + setNameFig(labelFig); + + labelFig.addPropertyChangeListener(this); + + getBigPort(). + setBounds(stereotypeFigProfileIcon.getBounds()); + + for (Object fig : getFigs()) { + ((Fig) fig).setVisible(fig == stereotypeFigProfileIcon); + } + + } } else if (practicalView == DiagramAppearance.STEREOTYPE_VIEW_SMALL_ICON) { int i = this.getX() + this.getWidth() - ICON_WIDTH - 2; Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java?view=diff&rev=14718&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java&r1=14717&r2=14718 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java (original) +++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java 2008-05-13 06:46:00-0700 @@ -256,47 +256,42 @@ acounter++; } - Collection stereos = Model.getFacade().getStereotypes(modelElement); - if (stereos != null) { - Iterator iter = stereos.iterator(); - while (iter.hasNext()) { - Object stereotype = iter.next(); - if (figs.size() <= acounter) { - ++stereotypeCount; - stereotypeTextFig = - new FigStereotype( - xpos + 1, - ypos + 1 - + (acounter - 1) - * FigNodeModelElement.ROWHEIGHT, - 0, - FigNodeModelElement.ROWHEIGHT - 2, - bigPort, - stereotype); - // bounds not relevant here - stereotypeTextFig.setJustification(FigText.JUSTIFY_CENTER); - stereotypeTextFig.setEditable(false); - addFig(stereotypeTextFig); - } else { - stereotypeTextFig = - (CompartmentFigText) figs.get(acounter); - } - stereotypeTextFig.setOwner(stereotype); - - acounter++; - } - if (figs.size() > acounter) { - //cleanup of unused FigText's - for (int i = figs.size() - 1; i >= acounter; i--) { - removeFig((Fig) figs.get(i)); - } + for (Object stereo : Model.getFacade().getStereotypes(modelElement)) { + if (figs.size() <= acounter) { + ++stereotypeCount; + stereotypeTextFig = + new FigStereotype( + xpos + 1, + ypos + 1 + + (acounter - 1) + * FigNodeModelElement.ROWHEIGHT, + 0, + FigNodeModelElement.ROWHEIGHT - 2, + bigPort, + stereo); + // bounds not relevant here + stereotypeTextFig.setJustification(FigText.JUSTIFY_CENTER); + stereotypeTextFig.setEditable(false); + addFig(stereotypeTextFig); + } else { + stereotypeTextFig = (CompartmentFigText) figs.get(acounter); } + stereotypeTextFig.setOwner(stereo); - reorderStereotypeFigs(); - - // remove all stereotypes that have a graphical icon - updateHiddenStereotypes(); + acounter++; + } + if (figs.size() > acounter) { + //cleanup of unused FigText's + for (int i = figs.size() - 1; i >= acounter; i--) { + removeFig((Fig) figs.get(i)); + } } + + reorderStereotypeFigs(); + + // remove all stereotypes that have a graphical icon + updateHiddenStereotypes(); + } private void updateHiddenStereotypes() { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
