http://www.jpicedt.org

jpicedt.graphic.toolkit
Class PEAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by jpicedt.graphic.toolkit.PEAbstractAction<Element>
          extended by jpicedt.graphic.toolkit.PEAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
EditorKit.CopyAction, EditorKit.CutAction, EditorKit.DeleteAction, EditorKit.EditBoundingBoxAction, EditorKit.EditDispositionAction, EditorKit.EditGeometryAction, EditorKit.EditTextModeAction, EditorKit.GroupAction, EditorKit.JoinCurvesAction, EditorKit.PasteAction, EditorKit.SelectAllAction, EditorKit.SelectMouseToolAction, EditorKit.ToggleEditPointsModeAction, EditorKit.ZoomInAction, EditorKit.ZoomOutAction, JPicEdt.AboutAction, JPicEdt.ContentTypeAction, JPicEdt.ExitAction, JPicEdt.FileCloseAction, JPicEdt.FileNewAction, JPicEdt.FileOpenAction, JPicEdt.FileReloadAction, JPicEdt.FileSaveAction, JPicEdt.FileSaveAllAction, JPicEdt.FileSaveAsAction, JPicEdt.FragmentInsertAction, JPicEdt.FragmentSaveAction, JPicEdt.MemoryMonitorAction, JPicEdt.OpenBSHConsoleAction, JPicEdt.PageFormatAction, JPicEdt.PreferencesAction, JPicEdt.RedoAction, JPicEdt.RedrawAction, JPicEdt.RunExternalCommandAction, JPicEdt.ShowErrorLogAction, JPicEdt.ShowHelpAction, JPicEdt.ShowLicenseAction, JPicEdt.ToggleAttributesPanelAction, JPicEdt.ToggleConvexZonePanelAction, JPicEdt.ToggleToolkitPanelAction, JPicEdt.UndoAction, JPicEdt.ViewLaTeXFileAction, JPicEdt.WindowCascadeAction, JPicEdt.WindowTileHorAction, JPicEdt.WindowTileVertAction, PEScrollPane.CenterViewportAction, PEToggleAction

public abstract class PEAction
extends PEAbstractAction<Element>

An abstract subclass of Swing's AbstractAction that can (but may as well not) be shared across multiple PECanvas.

This implementation uses the same set of properties as AbstractAction.

The constructor gives a convenient way of automatically building localized properties associated with this PEAction from a simple String (the "actionName" parameter), using a user-provided ActionLocalizer.
Note : if an ActionLocalizer is provided to the constructor, and some of its methods return null values, the corresponding properties are set to null. However, all jPicEdt components (e.g. PEMenu, PEToolBar,...), like Swing components, are guaranteed to handle this case properly w/o throwing an exception.
For instance, simply setting the NAME property to null and filling the SMALL_ICON property create a JButton without text under the component's Icon (this is the standard Swing behaviour).

Example of use : [todo]

Since:
jPicEdt 1.3.2
Version:
$Id: PEAction.java,v 1.14 2013/03/27 06:57:01 vincentb1 Exp $
Author:
Sylvain Reynal
See Also:
Serialized Form

Field Summary
 
Fields inherited from class jpicedt.graphic.toolkit.PEAbstractAction
targetElement
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
PEAction(ActionDispatcher actionDispatcher, String actionName, ActionLocalizer localizer)
           
 
Method Summary
protected  Iterator<Element> getIterator()
           
protected
<T> void
setAttribute(PicAttributeName<T> name, T value)
          Applies the given attribute to the drawing content.
 
Methods inherited from class jpicedt.graphic.toolkit.PEAbstractAction
actionPerformed, getCanvas, getDrawing, getEditorKit, getSelectedObject, setSelectedObject, undoableActionPerformed
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PEAction

public PEAction(ActionDispatcher actionDispatcher,
                String actionName,
                ActionLocalizer localizer)
Method Detail

getIterator

protected Iterator<Element> getIterator()
Specified by:
getIterator in class PEAbstractAction<Element>

setAttribute

protected final <T> void setAttribute(PicAttributeName<T> name,
                                      T value)
Applies the given attribute to the drawing content. If there is a selection, the attribute is applied to each element in the selection. If there is no selection, the attribute is applied to the input attribute set of the EditorKit (this specifies the attributes to be used for any new Element that gets added to the underlying Drawing).

If there's a selected element, we add an UndoableEdit (hence PEAction that explicitly call setAttribute() must not override undoableActionPerformed, but simply actionPerformed).


http://www.jpicedt.org

Submit a bug : syd@jpicedt.org