Example usage for javax.swing Action NAME

List of usage examples for javax.swing Action NAME

Introduction

In this page you can find the example usage for javax.swing Action NAME.

Prototype

String NAME

To view the source code for javax.swing Action NAME.

Click Source Link

Document

The key used for storing the String name for the action, used for a menu or button.

Usage

From source file:net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.CFJReferenceEditor.java

public CFJReferenceEditor(Action pickReference, Action viewReference) {
    super();/* w  w  w  .  j a  v a 2  s . c  om*/
    final String S_ProcName = "construct";
    if (pickReference == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "pickReference");
    }
    if (viewReference == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "viewReference");
    }
    actionPickReference = pickReference;
    actionPickReference.putValue(Action.NAME, null);
    actionPickReference.putValue(Action.SMALL_ICON, getPickIcon());
    actionViewReference = viewReference;
    actionViewReference.putValue(Action.NAME, null);
    actionViewReference.putValue(Action.SMALL_ICON, getViewIcon());
    referencedObject = null;

    JTextField textField = getTextFieldQualifiedName();
    add(textField);
    textField.setBounds(0, 0, 100, 25);

    JButton button = getButtonPickReference();
    add(button);
    button.setBounds(100, 0, 25, 25);

    button = getButtonViewReference();
    add(button);
    button.setBounds(125, 0, 25, 25);

    Dimension min = new Dimension(150, 25);
    this.setMinimumSize(min);
}

From source file:org.colombbus.tangara.commons.resinject.ActionInjecter.java

private void injectName() {
    String nameKey = actionKey + NAME_SUFFIX;
    if (classResource.containsKey(nameKey)) {
        String nameValue = classResource.getString(nameKey);
        action.putValue(Action.NAME, nameValue);
    }/* w w w.j  ava  2s .  c  o m*/
}

From source file:org.pmedv.blackboard.commands.AddTextCommand.java

public AddTextCommand() {
    putValue(Action.NAME, resources.getResourceByKey("AddTextCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.addtext"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("AddTextCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);//w ww.  j a  va 2  s .c om
}

From source file:org.pmedv.blackboard.commands.CreatePartListCommand.java

public CreatePartListCommand() {
    putValue(Action.NAME, resources.getResourceByKey("CreatePartListCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.partlist"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("CreatePartListCommand.description"));
    putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);//ww  w. ja  va  2 s. c o  m
}

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.base.actions.ExportAction.java

/**
 * Defines an <code>Action</code> object with a default description string and default icon.
 *///from  w ww. j a  v a  2s.c  om
public ExportAction(final ExportActionPlugin actionPlugin, final PreviewPane previewPane) {
    if (actionPlugin == null) {
        throw new NullPointerException();
    }
    if (previewPane == null) {
        throw new NullPointerException();
    }

    this.actionPlugin = actionPlugin;
    this.previewPane = previewPane;
    putValue(Action.NAME, actionPlugin.getDisplayName());
    putValue(Action.SHORT_DESCRIPTION, actionPlugin.getShortDescription());
    putValue(Action.ACCELERATOR_KEY, actionPlugin.getAcceleratorKey());
    putValue(Action.MNEMONIC_KEY, actionPlugin.getMnemonicKey());
    putValue(Action.SMALL_ICON, actionPlugin.getSmallIcon());
    putValue(SwingCommonModule.LARGE_ICON_PROPERTY, actionPlugin.getLargeIcon());
    this.actionPlugin.addPropertyChangeListener("enabled", new EnableChangeListener()); //$NON-NLS-1$

    setEnabled(actionPlugin.isEnabled());
}

From source file:umich.ms.batmass.filesupport.core.actions.importing.ImportFileByCategory.java

public ImportFileByCategory(Lookup context) {
    this.context = context;
    putValue(Action.NAME, getActionName());
}

From source file:com.willwinder.ugs.nbp.lib.services.ActionRegistrationService.java

/**
 * Registers an action with the platform along with optional shortcuts and
 * menu items.//from   w  ww. j a v  a  2 s. c o m
 *
 * @param id The unique id of the action
 * @param name Display name of the action.
 * @param category Category in the Keymap tool.
 * @param shortcut Default shortcut, use an empty string or null for none.
 * @param menuPath Menu location starting with "Menu", like "Menu/Head/Hats"
 * @param localMenu Localized menu location starting with "Menu", like "Menu/Cabeza/Sombreros"
 * @param action an action object to attach to the action entry.
 * @throws IOException 
 */
public void registerAction(String id, String name, String category, String localCategory, String shortcut,
        String menuPath, String localMenu, Action action) throws IOException {
    ///////////////////////
    // Add/Update Action //
    ///////////////////////
    String originalFile = "Actions/" + category + "/" + id + ".instance";
    FileObject root = FileUtil.getConfigRoot();
    FileObject in = FileUtil.createFolder(root, "Actions/" + category);
    //in.setAttribute("displayName", localCategory);
    //in.setAttribute("SystemFileSystem.localizingBundle", localCategory + "lkhaglk");
    //in.setAttribute("SystemFileSystem.localizingBundle", localCategory);
    in.refresh();

    FileObject obj = in.getFileObject(id, "instance");
    if (obj == null) {
        obj = in.createData(id, "instance");
    }
    action.putValue(Action.NAME, name);
    obj.setAttribute("instanceCreate", action);
    obj.setAttribute("instanceClass", action.getClass().getName());

    /////////////////////
    // Add/Update Menu //
    /////////////////////
    if (StringUtils.isNotEmpty(menuPath) && StringUtils.isNotEmpty(id)) {
        in = createAndLocalizeFullMenu(menuPath, localMenu);

        obj = in.getFileObject(id, SHADOW);
        // Create if missing.
        if (obj == null) {
            obj = in.createData(id, SHADOW);
            obj.setAttribute("originalFile", originalFile);
        }
    }

    /////////////////////////
    // Add/Update Shortcut //
    /////////////////////////
    if (shortcut != null && shortcut.length() > 0) {
        in = FileUtil.createFolder(root, "Shortcuts");
        obj = in.getFileObject(shortcut, SHADOW);
        if (obj == null) {
            obj = in.createData(shortcut, SHADOW);
            obj.setAttribute("originalFile", originalFile);
        }
    }
}

From source file:savant.view.swing.DockableFrameFactory.java

public static Frame createTrackFrame(DataFormat df) {

    final Frame frame = new Frame(df);

    frame.setAvailableButtons(//from   w  ww.  j  av  a2s.  c om
            DockableFrame.BUTTON_AUTOHIDE | DockableFrame.BUTTON_MAXIMIZE | DockableFrame.BUTTON_CLOSE);

    frame.setSlidingAutohide(false);
    frame.setInitMode(DockContext.STATE_FRAMEDOCKED);
    frame.setInitSide(DockContext.DOCK_SIDE_NORTH);

    frame.add(new JPanel());

    frame.setCloseAction(new Action() {
        private boolean isEnabled = true;
        private Map<String, Object> map = new HashMap<String, Object>();

        @Override
        public void actionPerformed(ActionEvent e) {
            FrameController.getInstance().closeFrame(frame, true);
        }

        @Override
        public Object getValue(String key) {
            if (key.equals(Action.NAME)) {
                return "Close";
            } else {
                return map.get(key);
            }
        }

        @Override
        public void putValue(String key, Object value) {
            map.put(key, value);
        }

        @Override
        public void setEnabled(boolean b) {
            this.isEnabled = b;
        }

        @Override
        public boolean isEnabled() {
            return isEnabled;
        }

        @Override
        public void addPropertyChangeListener(PropertyChangeListener listener) {
        }

        @Override
        public void removePropertyChangeListener(PropertyChangeListener listener) {
        }
    });

    // TODO: this seems cyclical. What's going on here?
    JPanel panel = (JPanel) frame.getContentPane();
    panel.setLayout(new BorderLayout());
    panel.add(frame.getFrameLandscape());
    return frame;
}

From source file:org.kepler.gui.kar.ExportActorArchiveAction.java

/**
 * Override the initialize method to change the behavior of the constructor.
 *//*from   w w  w.j a va2  s . c o m*/
protected void initialize() {

    this.putValue(Action.NAME, DISPLAY_NAME);
    this.putValue(GUIUtilities.LARGE_ICON, LARGE_ICON);
    this.putValue("tooltip", TOOLTIP);
    this.putValue(GUIUtilities.ACCELERATOR_KEY, ACCELERATOR_KEY);

    this.setSingleItemKAR(true);
    setRefreshFrameAfterSave(false);
    setMapKARToCurrentFrame(false);
}

From source file:org.kepler.gui.kar.RefreshFolderAction.java

/**
 * Constructor/*w  w  w .  ja  va  2 s  .  c  om*/
 * 
 *@param parent
 *            the "frame" (derived from ptolemy.gui.Top) where the menu is
 *            being added.
 */
public RefreshFolderAction(TableauFrame parent) {
    super("Refresh");
    if (parent == null) {
        IllegalArgumentException iae = new IllegalArgumentException(
                "RefreshFolderAction constructor received NULL argument for TableauFrame");
        iae.fillInStackTrace();
        throw iae;
    }
    this.parent = parent;

    this.putValue(Action.NAME, DISPLAY_NAME);
    this.putValue(GUIUtilities.LARGE_ICON, LARGE_ICON);
    this.putValue("tooltip", TOOLTIP);
    this.putValue(GUIUtilities.ACCELERATOR_KEY, ACCELERATOR_KEY);
}