edu.stanford.smi.protegex.owl.ui.resourceselection
Class ResourceSelectionAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byedu.stanford.smi.protegex.owl.ui.resourceselection.ResourceSelectionAction
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, ResourceSelectionListener, Serializable
Direct Known Subclasses:
AddClassToDomainAction, AddIndividualAction, AddNamedClassAction, AddNamedClassAction, AddPropertyAction, AddPropertyFormComponentAction, AddPropertyWidgetToFormAction, AddResourceAction, AddResourceAction, AddRowAction, CreateValueAction, ExistentialAction, RemovePropertyWidgetFromFormAction, SetResourceAction, SWRLSymbolPanel.InsertBuiltinAction, SymbolPanel.InsertClassAction, SymbolPanel.InsertIndividualAction, SymbolPanel.InsertPropertyAction

public abstract class ResourceSelectionAction
extends AbstractAction
implements ResourceSelectionListener

An Action that requires the selection of an RDFResource from a List. This Action generalizes this behavior and separates selection from action, so that the selection can be made either through a conventional resource picking dialog or through a ResourceSelectionComboBox.

Author:
Holger Knublauch
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
static boolean activated
          A ugly global flag that can be used to deactivate the right-click popup when working with huge ontologies (such as in database backend) for performance reasons.
private  boolean multipleSelection
           
private  boolean showHiddenResources
           
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
ResourceSelectionAction(String name, Icon icon)
          Constructs a new ResourceSelectionAction.
ResourceSelectionAction(String name, Icon icon, boolean multipleSelection)
          Constructs a new ResourceSelectionAction.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Shows the frame picker dialog from pickFrame and then calls resourceSelected on the selected Frame.
 void activateComboBox(JButton button)
          Activates the right mouse click on a given JButton.
 ListCellRenderer getRenderer()
           
abstract  Collection getSelectableResources()
           
 boolean getShowHiddenResources()
           
 RDFResource pickResource()
          This method is used when single selection is allowed for this Action.
 Collection pickResources()
          This method is only used when multiple selection is allowed for this Action.
static void setActivated(boolean value)
           
 void setShowHiddenResources(boolean value)
           
 
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
 
Methods inherited from interface edu.stanford.smi.protegex.owl.ui.resourceselection.ResourceSelectionListener
resourceSelected
 

Field Detail

activated

public static boolean activated
A ugly global flag that can be used to deactivate the right-click popup when working with huge ontologies (such as in database backend) for performance reasons.


multipleSelection

private boolean multipleSelection

showHiddenResources

private boolean showHiddenResources
Constructor Detail

ResourceSelectionAction

public ResourceSelectionAction(String name,
                               Icon icon)
Constructs a new ResourceSelectionAction.

Parameters:
name - the name of the Action
icon - the Icon

ResourceSelectionAction

public ResourceSelectionAction(String name,
                               Icon icon,
                               boolean multipleSelection)
Constructs a new ResourceSelectionAction.

Parameters:
name - the name of the Action
icon - the Icon
multipleSelection - true to allow multiple selection of Frames
Method Detail

actionPerformed

public void actionPerformed(ActionEvent e)
Shows the frame picker dialog from pickFrame and then calls resourceSelected on the selected Frame.

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - ignored

activateComboBox

public void activateComboBox(JButton button)
Activates the right mouse click on a given JButton. This installs a MouseListener to the JButton so that whenever the button is clicked with the right mouse button, a combobox will appear that provides the selection.

Parameters:
button -

getRenderer

public ListCellRenderer getRenderer()

getSelectableResources

public abstract Collection getSelectableResources()

getShowHiddenResources

public boolean getShowHiddenResources()

pickResource

public RDFResource pickResource()
This method is used when single selection is allowed for this Action.

Returns:
the selected Frame

pickResources

public Collection pickResources()
This method is only used when multiple selection is allowed for this Action. By default, it will call pickFrame.

Returns:
the Frame

setActivated

public static void setActivated(boolean value)

setShowHiddenResources

public void setShowHiddenResources(boolean value)