Author: tfmorris Date: 2008-11-10 14:21:14-0800 New Revision: 16014 Modified: trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java
Log: Remove deprecated methods. Get active diagram directly. Modified: trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java?view=diff&rev=16014&p1=trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java&p2=trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java&r1=16013&r2=16014 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java (original) +++ trunk/src/argouml-app/src/org/argouml/ui/ProjectBrowser.java 2008-11-10 14:21:14-0800 @@ -95,7 +95,7 @@ import org.argouml.ui.targetmanager.TargetListener; import org.argouml.ui.targetmanager.TargetManager; import org.argouml.uml.diagram.ArgoDiagram; -import org.argouml.uml.diagram.DiagramFactory; +import org.argouml.uml.diagram.DiagramUtils; import org.argouml.uml.diagram.UMLMutableGraphSupport; import org.argouml.uml.diagram.ui.ActionRemoveFromDiagram; import org.argouml.uml.ui.ActionSaveProject; @@ -103,7 +103,6 @@ import org.argouml.util.ArgoFrame; import org.argouml.util.JavaRuntimeUtility; import org.argouml.util.ThreadUtils; -import org.tigris.gef.base.Diagram; import org.tigris.gef.base.Editor; import org.tigris.gef.base.Globals; import org.tigris.gef.base.Layer; @@ -124,7 +123,7 @@ */ public final class ProjectBrowser extends JFrame - implements IStatusBar, PropertyChangeListener, TargetListener { + implements PropertyChangeListener, TargetListener { /** * Default width. @@ -705,9 +704,9 @@ .getCurrentProject().getName(); } } + // TODO: Why would this be null? if (activeDiagram == null) { - activeDiagram = ProjectManager.getManager() - .getCurrentProject().getActiveDiagram(); + activeDiagram = DiagramUtils.getActiveDiagram(); } String changeIndicator = ""; if (saveAction != null && saveAction.isEnabled()) { @@ -797,27 +796,6 @@ } } - /** - * Get the tab page containing the properties. - * - * @return the TabProps tabpage - * @deprecated for 0.25.5 by tfmorris. No one should need to manipulate the - * properties tab directly. The only place this is currently - * used is in a test. - */ - @Deprecated - public TabProps getTabProps() { - // In theory there can be multiple details pane (work in - // progress). It must first be determined which details - // page contains the properties tab. Bob Tarling 7 Dec 2002 - for (DetailsPane detailsPane : detailsPanesByCompassPoint.values()) { - TabProps tabProps = detailsPane.getTabProps(); - if (tabProps != null) { - return tabProps; - } - } - throw new IllegalStateException("No properties tab found"); - } /** * Get the tab page instance of the given class. @@ -881,95 +859,6 @@ return southPane; } - /** - * Find the tabpage with the given label and make it the front tab. - * - * @param tabName The tabpage label - * @deprecated for 0.25.5 by tfmorris. This is unused by ArgoUML. If there - * are clients that require this functionality, it should be - * delegated to some place more appropriate like a details - * pane manager. - */ - @Deprecated - public void selectTabNamed(String tabName) { - for (DetailsPane detailsPane : detailsPanesByCompassPoint.values()) { - if (detailsPane.selectTabNamed(Translator.localize(tabName))) { - return; - } - } - throw new IllegalArgumentException("No such tab named " + tabName); - } - - - /** - * Given a list of targets, displays the corresponding diagram. This method - * jumps to the diagram showing the targets, and scrolls to make it visible. - * - * @param targets Collection of targets to show - * @deprecated for 0.25.5 by tfmorris. This is unused by ArgoUML. If there - * are clients that require this functionality, it should be - * moved some place more appropriate like the Diagram subsystem. - */ - @Deprecated - public void jumpToDiagramShowing(Collection targets) { - - if (targets == null || targets.size() == 0) { - return; - } - List dms = new ArrayList(targets); - Object first = dms.get(0); - if (first instanceof Diagram && dms.size() > 1) { - setTarget(first); - setTarget(dms.get(1)); - return; - } - if (first instanceof Diagram && dms.size() == 1) { - setTarget(first); - return; - } - List<ArgoDiagram> diagrams = - ProjectManager.getManager().getCurrentProject().getDiagramList(); - Object target = TargetManager.getInstance().getTarget(); - if ((target instanceof Diagram) - && ((Diagram) target).countContained(dms) == dms.size()) { - setTarget(first); - return; - } - - ArgoDiagram bestDiagram = null; - int bestNumContained = 0; - for (ArgoDiagram d : diagrams) { - int nc = d.countContained(dms); - if (nc > bestNumContained) { - bestNumContained = nc; - bestDiagram = d; - } - if (nc == dms.size()) { - break; - } - } - if (bestDiagram != null) { - if (!ProjectManager.getManager().getCurrentProject() - .getActiveDiagram().equals(bestDiagram)) { - setTarget(bestDiagram); - } - setTarget(first); - } - // making it possible to jump to the modelroot - if (first.equals(ProjectManager.getManager().getCurrentProject() - .getRoot())) { - setTarget(first); - } - - // and finally, adjust the scrollbars to show the Fig - Project p = ProjectManager.getManager().getCurrentProject(); - if (p != null) { - Object f = TargetManager.getInstance().getFigTarget(); - if (f instanceof Fig) { - Globals.curEditor().scrollToShow((Fig) f); - } - } - } /* * @see java.awt.Component#setVisible(boolean) @@ -982,21 +871,6 @@ } } - /** - * Show a string in the status bar. - * - * @param s the new status string - * - * @deprecated for 0.26 by tfmorris. Use [EMAIL PROTECTED] ArgoEventPump#fireEvent} to - * send a status event instead. When this method is removed - * also remove the implements clause for GEF's IStatusBar from - * this (ProjectBrowser) class. - */ - @Deprecated - public void showStatus(String s) { - updateStatus(s); - } - private void updateStatus(String status) { ArgoEventPump.fireEvent(new ArgoStatusEvent(ArgoEventTypes.STATUS_TEXT, this, status)); @@ -1626,7 +1500,6 @@ persister.addProgressListener(pmw); } - DiagramFactory.getInstance().getDiagram().clear(); project = persister.doLoad(file); @@ -1635,18 +1508,21 @@ } ThreadUtils.checkIfInterrupted(); - if (Model.getDiagramInterchangeModel() != null) { - Collection diagrams = - DiagramFactory.getInstance().getDiagram(); - Iterator diag = diagrams.iterator(); - while (diag.hasNext()) { - project.addMember(diag.next()); - } - if (!diagrams.isEmpty()) { - project.setActiveDiagram( - (ArgoDiagram) diagrams.iterator().next()); - } - } +// if (Model.getDiagramInterchangeModel() != null) { + // TODO: This assumes no more than one project at a time + // will be loaded. If it is ever reinstituted, this needs to + // be fixed +// Collection diagrams = +// DiagramFactory.getInstance().getDiagram(); +// Iterator diag = diagrams.iterator(); +// while (diag.hasNext()) { +// project.addMember(diag.next()); +// } +// if (!diagrams.isEmpty()) { +// project.setActiveDiagram( +// (ArgoDiagram) diagrams.iterator().next()); +// } +// } // Let's save this project in the mru list this.addFileSaved(file); Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java?view=diff&rev=16014&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java&r1=16013&r2=16014 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java (original) +++ trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java 2008-11-10 14:21:14-0800 @@ -24,10 +24,8 @@ package org.argouml.uml.diagram; -import java.util.ArrayList; import java.util.EnumMap; import java.util.HashMap; -import java.util.List; import java.util.Map; import org.argouml.model.ActivityDiagram; @@ -79,14 +77,14 @@ public enum DiagramType { Class, UseCase, State, Deployment, Collaboration, Activity, Sequence } - - private List<ArgoDiagram> diagrams = new ArrayList<ArgoDiagram>(); private Map<DiagramType, DiagramFactoryInterface> factories = new EnumMap<DiagramType, DiagramFactoryInterface>(DiagramType.class); private DiagramFactory() { super(); + // TODO: Use our extension registration mechanism for our internal + // classes as well, so everything is treated the same diagramClasses.put(DiagramType.Class, UMLClassDiagram.class); diagramClasses.put(DiagramType.UseCase, UMLUseCaseDiagram.class); diagramClasses.put(DiagramType.State, UMLStateDiagram.class); @@ -104,17 +102,6 @@ return diagramFactory; } - /** - * @return the list of diagrams - * @deprecated in 0.26 By Bob Tarling - */ - public List<ArgoDiagram> getDiagram() { - // TODO: This list is currently unused in ArgoUML. Since it's session - // wide, it's not clear what value it has since we'll usually want - // diagrams per project. - tfm - return diagrams; - } - /** * Factory method to create a new default instance of an ArgoDiagram. @@ -145,9 +132,6 @@ if (factory != null) { final ArgoDiagram diagram = factory.createDiagram(namespace, machine); - //keep a reference on it in the case where we must add all the - //diagrams as project members (loading) - diagrams.add(diagram); return diagram; } else { return createDiagram(diagramClasses.get(type), namespace, machine); @@ -214,9 +198,6 @@ ((UMLMutableGraphSupport) diagram.getGraphModel()).setDiDiagram(dd); } - //keep a reference on it in the case where we must add all the diagrams - //as project members (loading) - diagrams.add(diagram); return diagram; } @@ -236,26 +217,12 @@ return diagram; } - // Unused - tfm - 20070706 -// public DiDiagram getDiDiagram(Object graphModel) { -// if (graphModel instanceof UMLMutableGraphSupport) { -// return ((UMLMutableGraphSupport) graphModel).getDiDiagram(); -// } -// throw new IllegalArgumentException("graphModel: " + graphModel); -// } - - // Unused - tfm 20070706 -// public void addElement(Object diagram, Object element) { -// if (!(diagram instanceof ArgoDiagram)) { -// throw new IllegalArgumentException("diagram: " + diagram); -// } -// if (!(element instanceof Fig)) { -// throw new IllegalArgumentException("fig: " + element); -// } -// ((ArgoDiagram) diagram).add((Fig) element); -// } + /** + * @deprecated for 0.27.2 by tfmorris. Undocumented and unused internally. + */ + @Deprecated public Object createRenderingElement(Object diagram, Object model) { GraphNodeRenderer rend = ((Diagram) diagram).getLayer().getGraphNodeRenderer(); Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java?view=diff&rev=16014&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java&r1=16013&r2=16014 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java (original) +++ trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java 2008-11-10 14:21:14-0800 @@ -107,6 +107,8 @@ * @see org.tigris.gef.graph.GraphNodeRenderer#getFigNodeFor( * java.lang.Object, int, int, java.util.Map) */ + // TODO: Is this supposed to be deprecated? It's only used by + // DiagramFactory.createRenderingElement, which is itself unused public FigNode getFigNodeFor( Object node, int x, int y, Map styleAttributes) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
