Project

General

Profile

Actions

Bug #2363

closed

Move Actions out of BasicGraphController

Added by Matthew Brooke almost 19 years ago. Updated over 15 years ago.

Status:
Resolved
Priority:
Immediate
Category:
interface
Target version:
Start date:
02/20/2006
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
2363

Description

src/exp/ptolemy/vergil/basic/BasicGraphController contains several Action inner
classes that were/are used for menu items. These need to be moved into their own
public classes, ao they can be added to menus as necessary via the new kepler
menu system


Related issues

Blocked by Kepler - Bug #2321: merge exp files into ptolemy CVSResolvedChristopher Brooks12/16/2005

Actions
Actions #1

Updated by Matthew Brooke over 18 years ago

Here's how to write Action classes for Kepler (This allows your code to be reusable and easily incorporated into the new menu framework when the time comes):

1) Write a public Action class that extends ptolemy.vergil.toolbox.FigureAction, and add your actual action code to the method:

public void actionPerformed(ActionEvent e)

(this is an abstract method, so it must be implemented in your class)

- See example code below for MyNewAction

2) Edit the file:

configs/ptolemy/configs/kepler/uiMenuMappings_en_US.properties

and add a mapping (note that the order in the file is the same order as on the menu).

Specifically, look in the documentation at the beginning of that file, under "# 2) INSTANTIATING NEW KEPLER ACTIONS"

A sample entry looks like:

Tools->~My\ New\ Menu\ Item=org.kepler.gui.MyNewAction, where MyNewAction is your class that extends FigureAction, as described above

================================================
// Example code for MyNewAction

public class MyNewAction extends FigureAction {

// Display Text pulled from resourcebundle:
private static String DISPLAY_NAME = StaticResources.getDisplayString("actions.mynewaction.displayName", "");
private static String TOOLTIP = StaticResources.getDisplayString("actions.mynewaction.tooltip", "");

/**
 * Constructor
 *
 * @param parent the "frame" (derived from ptolemy.gui.Top)
 * where the menu is being added.
*/
public MyNewAction (TableauFrame parent) {
super("");
this.parent = parent;
this.putValue(Action.NAME, DISPLAY_NAME);
this.putValue("tooltip", TOOLTIP);
}
/**
 * Invoked when an action occurs.
 *
*@param e ActionEvent
*/
public void actionPerformed(ActionEvent e) {
//YOUR CODE GOES HERE - like:
//dialog = new MyDialog(parent);
//dialog .setVisible(true);
//...etc
}
Actions #2

Updated by Christopher Brooks almost 17 years ago

If we solve this bug and move more code out of
exp/ptolemy/vergil/basic/BasicGraphController.java, then it will be easier
to update that file with Ptolemy changes.

Actions #3

Updated by Christopher Brooks over 15 years ago

I'll take this bug as part of bug # 2321.

Actions #4

Updated by Christopher Brooks over 15 years ago

I'm closing this, I created
util/src/org/kepler/gui/SemanticSearchDialogAction.java
util/src/org/kepler/gui/WorkflowTypeCheckerDialogAction.java
and removed the duplicate copy of ptolemy/vergil/basic/BasicGraphController.java

Actions #5

Updated by Redmine Admin over 11 years ago

Original Bugzilla ID was 2363

Actions

Also available in: Atom PDF