Author: penyaskito Date: 2008-11-07 01:51:16-0800 New Revision: 15973 Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLList2.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLModelElementListModel2.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLMutableLinkedList.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/AbstractPropPanelState.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventList.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventListModel.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerList.java branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerListModel.java
Log: Issue 5443: Trigger popup menus missing from transition proppanel. Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java 2008-11-07 01:51:16-0800 @@ -24,7 +24,6 @@ package org.argouml.uml.ui; -import java.awt.Component; import java.awt.Point; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; @@ -50,7 +49,7 @@ /** * The Component that this scroll is wrapping. */ - private JList list; + private UMLLinkedList list; /** * Builds a JList from a given list model and wraps @@ -91,16 +90,16 @@ } /** - * Builds a JList from a given list model and wraps + * Builds a ScrollList from a given list model and wraps * in a scrollable view. - * @param listModel The model from which to build the list - * @param showIcon show an icon with elements in the list - * @param showPath show containment path for elements in list + * @param list The JList to wrap in a scroll + * @deprecated in 0.27.2 use any other ScrollList constructor */ - public ScrollList(JList list) { + @Deprecated + public ScrollList(JList alist) { setHorizontalScrollBarPolicy( ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - this.list = list; + this.list = (UMLLinkedList) alist; setViewportView(list); } Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLList2.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLList2.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLList2.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLList2.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLList2.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLList2.java 2008-11-07 01:51:16-0800 @@ -33,6 +33,7 @@ import javax.swing.ListCellRenderer; import javax.swing.ListModel; +import org.apache.log4j.Logger; import org.argouml.model.Model; import org.argouml.ui.LookAndFeelMgr; import org.argouml.ui.targetmanager.TargetListener; @@ -54,6 +55,7 @@ extends JList implements TargettableModelView, MouseListener { + private static final Logger LOG = Logger.getLogger(UMLList2.class); /** * Constructor for UMLList2. Used by subclasses that want to add their own * renderer to the list. @@ -124,9 +126,10 @@ Point point = event.getPoint(); int index = locationToIndex(point); JPopupMenu popup = new JPopupMenu(); - ListModel lm = getModel(); + ListModel lm = getModel(); if (lm instanceof UMLModelElementListModel2) { if (((UMLModelElementListModel2) lm).buildPopup(popup, index)) { + LOG.debug("Showing popup"); popup.show(this, point.x, point.y); } } Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLModelElementListModel2.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLModelElementListModel2.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLModelElementListModel2.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLModelElementListModel2.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLModelElementListModel2.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLModelElementListModel2.java 2008-11-07 01:51:16-0800 @@ -293,7 +293,7 @@ * via the method setTarget(). * @return MModelElement */ - protected Object getTarget() { + public Object getTarget() { return listTarget; } Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLMutableLinkedList.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLMutableLinkedList.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLMutableLinkedList.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLMutableLinkedList.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLMutableLinkedList.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLMutableLinkedList.java 2008-11-07 01:51:16-0800 @@ -32,6 +32,7 @@ import javax.swing.JPopupMenu; +import org.apache.log4j.Logger; import org.argouml.model.Model; /** @@ -58,6 +59,9 @@ */ public class UMLMutableLinkedList extends UMLLinkedList implements MouseListener { + + private static final Logger LOG = + Logger.getLogger(UMLMutableLinkedList.class); private boolean deletePossible = true; @@ -305,6 +309,7 @@ } if (popup.getComponentCount() > 0) { initActions(); + LOG.info("Showing popup at " + e.getX() + "," + e.getY()); popup.show(this, e.getX(), e.getY()); } e.consume(); @@ -321,6 +326,7 @@ JPopupMenu popup = getPopupMenu(); if (popup.getComponentCount() > 0) { initActions(); + LOG.debug("Showing popup at " + e.getX() + "," + e.getY()); getPopupMenu().show(this, e.getX(), e.getY()); } e.consume(); @@ -383,6 +389,7 @@ JPopupMenu popup = getPopupMenu(); if (popup.getComponentCount() > 0) { initActions(); + LOG.info("Showing popup at " + e.getX() + "," + e.getY()); getPopupMenu().show(this, e.getX(), e.getY()); } e.consume(); Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java 2008-11-07 01:51:16-0800 @@ -54,10 +54,7 @@ */ public UMLSingleRowSelector(ListModel model) { super(new BorderLayout()); - - JList associationList = new UMLLinkedList(model); - associationList.setVisibleRowCount(1); - scroll = new ScrollList(associationList); + scroll = new ScrollList(model, 1); add(scroll); preferredSize = scroll.getPreferredSize(); Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/AbstractPropPanelState.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/AbstractPropPanelState.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/AbstractPropPanelState.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/AbstractPropPanelState.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/AbstractPropPanelState.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/AbstractPropPanelState.java 2008-11-07 01:51:16-0800 @@ -32,6 +32,7 @@ import org.argouml.application.helpers.ResourceLoaderWrapper; import org.argouml.i18n.Translator; +import org.argouml.uml.ui.ScrollList; import org.argouml.uml.ui.UMLMutableLinkedList; import org.tigris.swidgets.Orientation; @@ -45,7 +46,7 @@ private JScrollPane exitScroll; private JScrollPane doScroll; private JScrollPane internalTransitionsScroll; - private JScrollPane deferrableEventsScroll; + private ScrollList deferrableEventsScroll; /** @@ -75,10 +76,8 @@ public AbstractPropPanelState(String name, ImageIcon icon) { super(name, icon); - JList deferrableList = new UMLStateDeferrableEventList( - new UMLStateDeferrableEventListModel()); - - deferrableEventsScroll = new JScrollPane(deferrableList); + deferrableEventsScroll = + new ScrollList(new UMLStateDeferrableEventListModel()); JList entryList = new UMLStateEntryList(new UMLStateEntryListModel()); entryList.setVisibleRowCount(2); Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PopupMenuNewEvent.java 2008-11-07 01:51:16-0800 @@ -25,11 +25,11 @@ package org.argouml.uml.ui.behavior.state_machines; import javax.swing.JMenu; +import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import org.argouml.i18n.Translator; import org.argouml.uml.ui.ActionRemoveModelElement; -import org.argouml.uml.ui.UMLMutableLinkedList; import org.argouml.uml.ui.behavior.activity_graphs.ActionAddEventAsTrigger; /** @@ -47,50 +47,57 @@ * defined on ActionNewEvent. * * @param role the role - * @param list the list + * @param target the target */ - public PopupMenuNewEvent(String role, UMLMutableLinkedList list) { + public PopupMenuNewEvent(String role, Object target) { super(); + buildMenu(this, role, target); + } + + static void buildMenu(JPopupMenu pmenu, String role, Object target) { + assert role != null; + assert target != null; if (role.equals(ActionNewEvent.Roles.DEFERRABLE_EVENT) || role.equals(ActionNewEvent.Roles.TRIGGER)) { - JMenu select = new JMenu(); - select.setText(Translator.localize("action.select")); + JMenu select = new JMenu(Translator.localize("action.select")); +// select.setText(Translator.localize("action.select")); if (role.equals(ActionNewEvent.Roles.DEFERRABLE_EVENT)) { - ActionAddEventAsDeferrableEvent.SINGLETON.setTarget( - list.getTarget()); - select.add(ActionAddEventAsDeferrableEvent.SINGLETON); + ActionAddEventAsDeferrableEvent.SINGLETON.setTarget(target); + JMenuItem menuItem = new JMenuItem( + ActionAddEventAsDeferrableEvent.SINGLETON); +// select.add(ActionAddEventAsDeferrableEvent.SINGLETON); + select.add(menuItem); } else if (role.equals(ActionNewEvent.Roles.TRIGGER)) { - ActionAddEventAsTrigger.SINGLETON.setTarget(list.getTarget()); + ActionAddEventAsTrigger.SINGLETON.setTarget(target); select.add(ActionAddEventAsTrigger.SINGLETON); } - add(select); + pmenu.add(select); } - JMenu newMenu = new JMenu(); - newMenu.setText(Translator.localize("action.new")); + JMenu newMenu = new JMenu(Translator.localize("action.new")); +// newMenu.setText(Translator.localize("action.new")); newMenu.add(ActionNewCallEvent.getSingleton()); - ActionNewCallEvent.getSingleton().setTarget(list.getTarget()); + ActionNewCallEvent.getSingleton().setTarget(target); ActionNewCallEvent.getSingleton().putValue(ActionNewEvent.ROLE, role); newMenu.add(ActionNewChangeEvent.getSingleton()); - ActionNewChangeEvent.getSingleton().setTarget(list.getTarget()); + ActionNewChangeEvent.getSingleton().setTarget(target); ActionNewChangeEvent.getSingleton().putValue(ActionNewEvent.ROLE, role); newMenu.add(ActionNewSignalEvent.getSingleton()); - ActionNewSignalEvent.getSingleton().setTarget(list.getTarget()); + ActionNewSignalEvent.getSingleton().setTarget(target); ActionNewSignalEvent.getSingleton().putValue(ActionNewEvent.ROLE, role); newMenu.add(ActionNewTimeEvent.getSingleton()); - ActionNewTimeEvent.getSingleton().setTarget(list.getTarget()); + ActionNewTimeEvent.getSingleton().setTarget(target); ActionNewTimeEvent.getSingleton().putValue(ActionNewEvent.ROLE, role); - add(newMenu); + pmenu.add(newMenu); - addSeparator(); + pmenu.addSeparator(); ActionRemoveModelElement.SINGLETON.setObjectToRemove( - ActionNewEvent.getAction(role, list.getTarget())); - add(ActionRemoveModelElement.SINGLETON); - + ActionNewEvent.getAction(role, target)); + pmenu.add(ActionRemoveModelElement.SINGLETON); } /** Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventList.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventList.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventList.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventList.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventList.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventList.java 2008-11-07 01:51:16-0800 @@ -25,8 +25,6 @@ // $header$ package org.argouml.uml.ui.behavior.state_machines; -import javax.swing.JPopupMenu; - import org.argouml.uml.ui.UMLModelElementListModel2; import org.argouml.uml.ui.UMLMutableLinkedList; @@ -44,15 +42,4 @@ UMLModelElementListModel2 dataModel) { super(dataModel); } - - /* - * @see org.argouml.uml.ui.UMLMutableLinkedList#getPopupMenu() - */ - public JPopupMenu getPopupMenu() { - JPopupMenu menu = new PopupMenuNewEvent( - ActionNewEvent.Roles.DEFERRABLE_EVENT, this); - return menu; - } - - } Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventListModel.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventListModel.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventListModel.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventListModel.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventListModel.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLStateDeferrableEventListModel.java 2008-11-07 01:51:16-0800 @@ -24,6 +24,8 @@ package org.argouml.uml.ui.behavior.state_machines; +import javax.swing.JPopupMenu; + import org.argouml.model.Model; import org.argouml.uml.ui.UMLModelElementListModel2; @@ -56,4 +58,10 @@ .contains(element); } + @Override + public boolean buildPopup(JPopupMenu popup, int index) { + PopupMenuNewEvent.buildMenu(popup, + ActionNewEvent.Roles.DEFERRABLE_EVENT, getTarget()); + return true; + } } Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerList.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerList.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerList.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerList.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerList.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerList.java 2008-11-07 01:51:16-0800 @@ -25,15 +25,16 @@ // $header$ package org.argouml.uml.ui.behavior.state_machines; -import javax.swing.JPopupMenu; - import org.argouml.uml.ui.UMLModelElementListModel2; import org.argouml.uml.ui.UMLMutableLinkedList; /** * @since Dec 15, 2002 * @author [EMAIL PROTECTED] + * @deprecated in 0.27.2 use UMLMutableLinkedList in + * combination with UMLTransitionTriggerListModel */ [EMAIL PROTECTED] public class UMLTransitionTriggerList extends UMLMutableLinkedList { /** @@ -44,13 +45,4 @@ UMLModelElementListModel2 dataModel) { super(dataModel); } - - /* - * @see org.argouml.uml.ui.UMLMutableLinkedList#getPopupMenu() - */ - public JPopupMenu getPopupMenu() { - return new PopupMenuNewEvent(ActionNewEvent.Roles.TRIGGER, this); - } - - } Modified: branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerListModel.java Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerListModel.java?view=diff&rev=15973&p1=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerListModel.java&p2=branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerListModel.java&r1=15972&r2=15973 ============================================================================== --- branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerListModel.java (original) +++ branches/BRANCH_0_26_x/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLTransitionTriggerListModel.java 2008-11-07 01:51:16-0800 @@ -25,6 +25,8 @@ // $header$ package org.argouml.uml.ui.behavior.state_machines; +import javax.swing.JPopupMenu; + import org.argouml.model.Model; import org.argouml.uml.ui.UMLModelElementListModel2; @@ -56,4 +58,10 @@ return element == Model.getFacade().getTrigger(getTarget()); } + @Override + public boolean buildPopup(JPopupMenu popup, int index) { + PopupMenuNewEvent.buildMenu(popup, + ActionNewEvent.Roles.TRIGGER, getTarget()); + return true; + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
