[kepler-dev] Changes to menus to avoid PortDialogFactory deprecation warnings
Christopher Brooks
cxh at eecs.berkeley.edu
Mon Feb 26 11:23:54 PST 2007
Hi Edward,
We were having some deprecated warnings, so I updated three files
in vergil:
basic/BasicGraphController.java
actor/ActorEditorGraphController.java
fsm/FSMGraphController.java
I had to change basic/BasicGraphController.java in Kepler as well.
Can you check that the menus look ok to you?
Also, it seems like maybe we can merge the changes in
actor/ActorEditorGraphController.java
fsm/FSMGraphController.java
up to
RunnableGraphController
Do you have any comments?
Below are the gory details from my notes:
The problem was to fix these warnings:
../../../../ptolemy/vergil/actor/ActorEditorGraphController.java:203:
warning: [deprecation] ptolemy.vergil.kernel.PortDialogFactory in
ptolemy.vergil.kernel has been deprecated
../../../../ptolemy/vergil/actor/ActorEditorGraphController.java:364:
warning: [deprecation] ptolemy.vergil.kernel.PortDialogFactory in
ptolemy.vergil.kernel has been deprecated
../../../../ptolemy/vergil/actor/ActorEditorGraphController.java:53:
warning: [deprecation] ptolemy.vergil.kernel.PortDialogFactory in
ptolemy.vergil.kernel has been deprecated
../../../../ptolemy/vergil/fsm/FSMGraphController.java:179: warning:
[deprecation] ptolemy.vergil.kernel.PortDialogFactory in
ptolemy.vergil.kernel has been deprecated
../../../../ptolemy/vergil/fsm/FSMGraphController.java:313: warning:
[deprecation] ptolemy.vergil.kernel.PortDialogFactory in
ptolemy.vergil.kernel has been deprecated
../../../../ptolemy/vergil/fsm/FSMGraphController.java:57: warning:
[deprecation] ptolemy.vergil.kernel.PortDialogFactory in
ptolemy.vergil.kernel has been deprecated
Caused by this change:
2006-08-26 06:11 eal
* ptolemy/vergil/: kernel/AttributeController.java (1.32),
kernel/ConfigureUnitsAction.java (1.1),
kernel/PortDialogAction.java (1.1), kernel/PortDialogFactory.java
(1.39), kernel/RenameDialogAction.java (1.1),
kernel/RenameDialogFactory.java (1.22), kernel/makefile (1.16),
actor/ActorController.java (1.103),
basic/ParameterizedNodeController.java (1.23),
toolbox/MenuActionFactory.java (1.27): Better support for
hierarchical menus and context menu reorganization.
The class hierarchy that was changed:
Object
BasicNodeController
LocatableNodeController
NamedObjController
ParameterizedNodeController (1.22 -> 1.23) <- Defines _menuFactory
IconController
AttributeController (1.32 -> 1.33)
ActorController (1.102 -> 1.103)
The hierarchy that fails:
Object
AbstractGraphController
BasicGraphController <- Defines _menuFactory
RunnableGraphController
ActorViewGraphController
ActorEditorGraphController <- Uses deprecated PortDialogFactory
FSMViewGraphController
FSMGraphController <- Uses deprecated PortDialogFactory
Looking in detail at Edward's changes and adding the cvs diffs
Object
BasicNodeController
LocatableNodeController
NamedObjController
ParameterizedNodeController (1.22 -> 1.23)
Added MenuActionFactory _configureMenuFactory
76,77c76,79
< _menuFactory
< .addMenuItemFactory(new MenuActionFactory(_configureAction));
---
> // In this base class, there is only one configure command, so
> // there won't be a submenu. Subclasses convert this to a submenu.
> _configureMenuFactory = new MenuActionFactory(_configureAction);
> _menuFactory.addMenuItemFactory(_configureMenuFactory);
99a102,104
> /** The submenu for configure actions. */
> protected MenuActionFactory _configureMenuFactory;
>
IconController
AttributeController kernel (1.32 -> 1.33) (no real differences)
78,79c78,80 No Difference!
< _configureMenuFactory.addAction(new RenameDialogAction("Rename"), "Customize");
<
---
> _configureMenuFactory.addAction(new RenameDialogAction("Rename"),
> "Customize");
>
90,92c91,93 No Difference!
< new MoveAction("Bring to Front", MoveAction.TO_LAST)
< };
< _appearanceMenuActionFactory = new MenuActionFactory(appearanceActions, "Appearance");
---
> new MoveAction("Bring to Front", MoveAction.TO_LAST) };
> _appearanceMenuActionFactory = new MenuActionFactory(
> appearanceActions, "Appearance");
120c121
<
---
>
ActorController (1.102 -> 1.103)
< import ptolemy.vergil.kernel.PortDialogFactory;
---
> import ptolemy.vergil.kernel.ConfigureUnitsAction;
> import ptolemy.vergil.kernel.PortDialogAction;
108c109
< @version $Id: ActorController.java,v 1.102 2006/08/21 16:43:13 eal Exp $
---
> @version $Id: ActorController.java,v 1.103 2006/08/26 13:11:26 eal Exp $
136,138c137,141
< // Add to the context menu.
< _portDialogFactory = new PortDialogFactory();
< _menuFactory.addMenuItemFactory(_portDialogFactory);
---
> // Add to the context menu, configure submenu.
> _portDialogAction = new PortDialogAction("Ports");
> _configureMenuFactory.addAction(_portDialogAction, "Customize");
> _configureUnitsAction = new ConfigureUnitsAction("Units Constraints");
> _configureMenuFactory.addAction(_configureUnitsAction, "Customize");
214,215c217,221
< if (_portDialogFactory != null) {
< _portDialogFactory.setConfiguration(configuration);
---
> if (_portDialogAction != null) {
> _portDialogAction.setConfiguration(configuration);
> }
> if (_configureUnitsAction != null) {
> _configureUnitsAction.setConfiguration(configuration);
340,341c346
< _menuFactory.addMenuItemFactory(new MenuActionFactory(actions,
< "Appearance"));
---
> _appearanceMenuActionFactory.addActions(actions, "Appearance");
347a353,354
>
> private ConfigureUnitsAction _configureUnitsAction;
351c358
< private PortDialogFactory _portDialogFactory;
---
> private PortDialogAction _portDialogAction;
The fixes:
1) BasicGraphController:
Defines _menuFactory, which is an inner static class
called SchematicContextMenuFactory, so we create a new
protected variable: _configureMenuFactory to cache that value
diff -r1.65 BasicGraphController.java
428a429,431
> /** The submenu for configure actions. */
> protected static MenuActionFactory _configureMenuFactory;
>
576c579,580
< addMenuItemFactory(new MenuActionFactory(_configureAction));
---
> _configureMenuFactory = new MenuActionFactory(_configureAction);
> addMenuItemFactory(_configureMenuFactory);
2) ActorEditorGraphController
Substitute PortDialogAction for PortDialogFactory.
diff -r1.59 ActorEditorGraphController.java
53c53,54
< import ptolemy.vergil.kernel.PortDialogFactory;
---
> import ptolemy.vergil.kernel.ConfigureUnitsAction;
> import ptolemy.vergil.kernel.PortDialogAction;
157,158c158,163
< if (_portDialogFactory != null) {
< _portDialogFactory.setConfiguration(configuration);
---
> if (_portDialogAction != null) {
> _portDialogAction.setConfiguration(configuration);
> }
>
> if (_configureUnitsAction != null) {
> _configureUnitsAction.setConfiguration(configuration);
203,205c208,214
< _portDialogFactory = new PortDialogFactory();
< _menuFactory.addMenuItemFactory(_portDialogFactory);
< _portDialogFactory.setConfiguration(getConfiguration());
---
> _portDialogAction = new PortDialogAction("Ports");
> _portDialogAction.setConfiguration(getConfiguration());
>
> _configureMenuFactory.addAction(_portDialogAction, "Customize");
> _configureUnitsAction = new ConfigureUnitsAction("Units Constraints");
> _configureMenuFactory.addAction(_configureUnitsAction, "Customize");
> _configureUnitsAction.setConfiguration(getConfiguration());
264a274,275
> private ConfigureUnitsAction _configureUnitsAction;
>
364c375
< private PortDialogFactory _portDialogFactory;
---
> private PortDialogAction _portDialogAction;
3) FSMGraphController
Substitute PortDialogAction for PortDialogFactory.
diff -r1.40 FSMGraphController.java
57c57,58
< import ptolemy.vergil.kernel.PortDialogFactory;
---
> import ptolemy.vergil.kernel.ConfigureUnitsAction;
> import ptolemy.vergil.kernel.PortDialogAction;
140,141c141,142
< if (_portDialogFactory != null) {
< _portDialogFactory.setConfiguration(configuration);
---
> if (_portDialogAction != null) {
> _portDialogAction.setConfiguration(configuration);
142a144,148
>
> if (_configureUnitsAction != null) {
> _configureUnitsAction.setConfiguration(configuration);
> }
>
179,181c185,191
< _portDialogFactory = new PortDialogFactory();
< _menuFactory.addMenuItemFactory(_portDialogFactory);
< _portDialogFactory.setConfiguration(getConfiguration());
---
> _portDialogAction = new PortDialogAction("Ports");
> _portDialogAction.setConfiguration(getConfiguration());
>
> _configureMenuFactory.addAction(_portDialogAction, "Customize");
> _configureUnitsAction = new ConfigureUnitsAction("Units Constraints");
> _configureMenuFactory.addAction(_configureUnitsAction, "Customize");
> _configureUnitsAction.setConfiguration(getConfiguration());
214a225,226
> private ConfigureUnitsAction _configureUnitsAction;
>
313c325
< private PortDialogFactory _portDialogFactory;
---
> private PortDialogAction _portDialogAction;
Perhaps these two changes should be pushed up into RunnableGraphController?
_Christopher
More information about the Kepler-dev
mailing list