com.jgoodies.skeleton.view.editor
Class AbstractEditor

java.lang.Object
  extended by com.jgoodies.uif_lite.AbstractView
      extended by com.jgoodies.skeleton.view.editor.AbstractEditor
All Implemented Interfaces:
Editor
Direct Known Subclasses:
DescriptionEditor, FlangeEditor, SegmentEditor, ShaftEditor

public abstract class AbstractEditor
extends com.jgoodies.uif_lite.AbstractView
implements Editor

The abstract superclass of all Editor implementations.

Version:
$Revision: 1.11 $
Author:
Karsten Lentzsch

Constructor Summary
AbstractEditor(Icon icon)
          Constructs an AbstractEditor with the specified icon.
AbstractEditor(Icon icon, String titlePrefix)
          Constructs an AbstractEditor with the specified icon and title prefix.
AbstractEditor(String titlePrefix)
          Constructs an AbstractEditor with the specified title prefix.
 
Method Summary
 void activate()
          Activates this editor.
 void deactivate()
          Deactivates the editor.
 Icon getIcon()
          Returns this editor's icon.
 String getTitle()
          Returns this editor's title.
 JToolBar getToolBar()
          Returns this editor's tool bar.
protected  void setTitleSuffix(String newSuffix)
          Sets a new title suffix that is used to compose this editor's title.
 
Methods inherited from class com.jgoodies.uif_lite.AbstractView
buildPanel, getPanel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jgoodies.skeleton.view.editor.Editor
getPanel, updateModel, updateView
 

Constructor Detail

AbstractEditor

public AbstractEditor(Icon icon)
Constructs an AbstractEditor with the specified icon.

Parameters:
icon - the icon to be used for this editor

AbstractEditor

public AbstractEditor(Icon icon,
                      String titlePrefix)
Constructs an AbstractEditor with the specified icon and title prefix.

Parameters:
icon - the icon to be used for this editor
titlePrefix - the prefix used by this editor, e.g. "Flange"

AbstractEditor

public AbstractEditor(String titlePrefix)
Constructs an AbstractEditor with the specified title prefix.

Parameters:
titlePrefix - the prefix used by this editor, e.g. "Flange"
Method Detail

getIcon

public Icon getIcon()
Returns this editor's icon. The icon is shared for all Flanges, all Shafts, etc.

Specified by:
getIcon in interface Editor
Returns:
this editor's icon
See Also:
Editor.getIcon()

getTitle

public String getTitle()
Returns this editor's title. The title changes with every individual edited domain object. It is composed of a prefix that is shared for all Flanges, all Shafts, etc. and a suffix that changed with the edited instance.

Specified by:
getTitle in interface Editor
Returns:
this editor's title.

getToolBar

public JToolBar getToolBar()
Returns this editor's tool bar. This default implementation specifies that no tool bar is used; subclasses may override this behavior.

Specified by:
getToolBar in interface Editor
Returns:
this editor's tool bar

activate

public void activate()
Activates this editor. This method is invoked if the selection type in the navigation panel has changed and this editor is associated with the new selection. For example if the selection changes from type Flange to type Shaft, this method will be invoked. It will not be invoked if the selection changes from Flange1 to Flange2.

This implementation assumes that only editors change domain objects. In other words, we can assume that a domain object is unchanged since its last edit. If the domain objects can be changed by third parties, you may need to update the view if an editor becomes active.

Sublcasses may also need to perform additional actions on activation. For example, scroll a list or table to make the current selection visible.

Specified by:
activate in interface Editor

deactivate

public void deactivate()
Deactivates the editor. This method is invoked if the selection type in the navigation panel has changed and this editor is associated with the old selection.

This default implementation does nothing. Subclasses my change the presentation.

Specified by:
deactivate in interface Editor

setTitleSuffix

protected final void setTitleSuffix(String newSuffix)
Sets a new title suffix that is used to compose this editor's title. Typically this is set in #updateView.

Parameters:
newSuffix - the suffix to be used
See Also:
getTitle()


Copyright © 2002-2008 JGoodies Karsten Lentzsch. All Rights Reserved.