com.sas.swing.visuals
Class SwingCustomizerView

com.sas.swing.visuals.SwingCustomizerView
All Implemented Interfaces:
com.sas.beans.CustomizerClosingInterface, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.Customizer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.SwingConstants

public class SwingCustomizerView
implements java.beans.Customizer, com.sas.beans.CustomizerClosingInterface, java.beans.PropertyChangeListener

CustomizerView is the base class for the com.sas component customizers. It uses a TabbedView object to separate functionally different parts of the customizer into Tabs.

Users of the CustomizerView should extend it and add tabs allowing the user to edit the state of the JavaBean. If the JavaBean being customized supports the com.sas.ComponentInterface, com.sas.awt.VisualInterface, com.sas.awt.CompositeInterface, or com.sas.awt.ContainerInterface, default tabs will be added to allow the user to edit the state of the JavaBean provided through these interfaces. These default tabs may be turned off by the subclass if desired.

See Also:
Serialized Form

Field Summary
protected  java.lang.Object bean
          The JavaBean being customized
protected  java.lang.Class beanClass
           
protected  com.sas.collection.AssociationList customizerPanelsAddedDuringMerge
           
protected  DisplayTransformCustomizerPanel displayTransformCustomizerPanel
          The panel used to edit the state of the JComponent's Model.
protected  boolean displayTransformTabVisible
           
protected  JComponentCustomizerPanel jComponentCustomizerPanel
          The panel used to edit the state of the JComponent.
protected  JComponentModelCustomizerPanel jComponentModelCustomizerPanel
          The panel used to edit the state of the JComponent's Model.
protected  boolean jComponentModelTabVisible
           
protected  boolean jComponentTabVisible
          Whether the JComponent tabs are visible.
protected  boolean jModelInstanceTabVisible
           
protected  com.sas.collection.AssociationList modelInstanceCustomizerPanels
          The panel used to edit the state of the model attached to the JavaBean.
static java.lang.String RB_KEY
           
protected  java.beans.BeanInfo sourceBeanInfo
           
protected  int startTabStart
          Set to the number of the panel you add to the component's customizer that you want to view first
 
Constructor Summary
SwingCustomizerView()
          Default constructor
 
Method Summary
 void addModelInstanceTabs()
          Adds customizer tabs for the model if any exists.
 void addNotify()
          Set the selected tab to the first non-generic tab in the customizer.
 void addTab(java.lang.String tabTitle, SwingCustomizerPanel panel)
           
 void addTab(SwingCustomizerPanel panel)
           
protected  DisplayTransformCustomizerPanel createDisplayTransformPanel()
          Factory method to create the "Display Transform" tab.
 void customizerClosing()
          customizerClosing() is called when the customizer for a component is closed.
 int getStartTabStart()
          Gets which panel you view first that you added to the component's customizer manually.
 boolean isDisplayTransformTabVisible()
          Returns whether the display transform customizer tab is displayed.
 boolean isJComponentModelTabVisible()
          Returns whether the JComponentModel customizer tab is displayed.
 boolean isJComponentTabVisible()
          Returns whether the ComponentInterface customizer tab is displayed.
 boolean isJModelInstanceTabVisible()
          Returns whether the tab(s) for the attached model is displayed.
protected  boolean mergeCustomizers(java.beans.Customizer customizer)
          Merges a customizer (Swing or AWT) with the current customizer.
protected  boolean mergeCustomizers(java.beans.Customizer customizer, boolean mergeModelTab, boolean mergeAppearanceTab)
          Merges a customizer (Swing or AWT) with the current customizer.
protected  void onModelChanged()
          Gets called when the model changes on teh component being customized
 void propertyChange(java.beans.PropertyChangeEvent ev)
           
 void setDisplayTransformTabVisible(boolean visible)
          Sets whether the display transform customizer tab is displayed.
 void setJComponentModelTabVisible(boolean visible)
          Sets whether the JComponentModel customizer tab is displayed.
 void setJComponentTabVisible(boolean visible)
          Sets whether the JComponent customizer tab is displayed.
 void setJModelInstanceTabVisible(boolean visible)
          Sets whether the JModelInstance customizer tab is displayed.
 void setObject(java.lang.Object bean)
           
 void setStartTabStart(int start)
          Sets which panel you view first that you added to the component's customizer manually.
 void setViewer(java.lang.Object viewer)
          To be overridden by model customizers in the case that they need info from a viewer that is being customized.
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

bean

protected java.lang.Object bean
The JavaBean being customized

See Also:
setObject(java.lang.Object)

sourceBeanInfo

protected java.beans.BeanInfo sourceBeanInfo

beanClass

protected java.lang.Class beanClass

startTabStart

protected int startTabStart
Set to the number of the panel you add to the component's customizer that you want to view first


jComponentTabVisible

protected boolean jComponentTabVisible
Whether the JComponent tabs are visible.


jComponentModelTabVisible

protected boolean jComponentModelTabVisible

jModelInstanceTabVisible

protected boolean jModelInstanceTabVisible

displayTransformTabVisible

protected boolean displayTransformTabVisible

jComponentCustomizerPanel

protected JComponentCustomizerPanel jComponentCustomizerPanel
The panel used to edit the state of the JComponent.


jComponentModelCustomizerPanel

protected JComponentModelCustomizerPanel jComponentModelCustomizerPanel
The panel used to edit the state of the JComponent's Model.


displayTransformCustomizerPanel

protected DisplayTransformCustomizerPanel displayTransformCustomizerPanel
The panel used to edit the state of the JComponent's Model.


modelInstanceCustomizerPanels

protected com.sas.collection.AssociationList modelInstanceCustomizerPanels
The panel used to edit the state of the model attached to the JavaBean.


customizerPanelsAddedDuringMerge

protected com.sas.collection.AssociationList customizerPanelsAddedDuringMerge
Constructor Detail

SwingCustomizerView

public SwingCustomizerView()
Default constructor

Method Detail

addTab

public void addTab(SwingCustomizerPanel panel)

addTab

public void addTab(java.lang.String tabTitle,
                   SwingCustomizerPanel panel)

setJComponentModelTabVisible

public void setJComponentModelTabVisible(boolean visible)
Sets whether the JComponentModel customizer tab is displayed.

Parameters:
whether - the JComponentModel customizer tab is displayed.

setDisplayTransformTabVisible

public void setDisplayTransformTabVisible(boolean visible)
Sets whether the display transform customizer tab is displayed.

Parameters:
whether - the display transform customizer tab is displayed.

setJModelInstanceTabVisible

public void setJModelInstanceTabVisible(boolean visible)
Sets whether the JModelInstance customizer tab is displayed. This tab is the customizer for the actual model set on the object.

Parameters:
whether - the JComponentModel customizer tab is displayed.

setJComponentTabVisible

public void setJComponentTabVisible(boolean visible)
Sets whether the JComponent customizer tab is displayed.

Parameters:
whether - the JComponent customizer tab is displayed.

isJModelInstanceTabVisible

public boolean isJModelInstanceTabVisible()
Returns whether the tab(s) for the attached model is displayed.

Returns:
whether the tab(s) for the attached model is displayed.

isJComponentModelTabVisible

public boolean isJComponentModelTabVisible()
Returns whether the JComponentModel customizer tab is displayed.

Returns:
whether the JComponentModel customizer tab is displayed.

isDisplayTransformTabVisible

public boolean isDisplayTransformTabVisible()
Returns whether the display transform customizer tab is displayed.

Returns:
whether the display transform customizer tab is displayed.

isJComponentTabVisible

public boolean isJComponentTabVisible()
Returns whether the ComponentInterface customizer tab is displayed.

Returns:
whether the ComponentInterface customizer tab is displayed.

createDisplayTransformPanel

protected DisplayTransformCustomizerPanel createDisplayTransformPanel()
Factory method to create the "Display Transform" tab. Can be overridden if a usert has created a subclass of the panel like the TableModelAdapterCustomizer has.


setObject

public void setObject(java.lang.Object bean)
Specified by:
setObject in interface java.beans.Customizer
See Also:
Customizer.setObject(java.lang.Object)

setViewer

public void setViewer(java.lang.Object viewer)
To be overridden by model customizers in the case that they need info from a viewer that is being customized. The com.sas.models.TreeCustomizer overrides this method to keep the TreeView on its tab looking similar to that of the viewer the model is set on.

Parameters:
viewer - the viewer that the model is set on

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent ev)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

onModelChanged

protected void onModelChanged()
Gets called when the model changes on teh component being customized


setStartTabStart

public void setStartTabStart(int start)
Sets which panel you view first that you added to the component's customizer manually. Normally, just leave set to zero. Only set if you add more than one panel to the customizer and the one you want to view is not the first one you added. This is set in each component's customizerView.


getStartTabStart

public int getStartTabStart()
Gets which panel you view first that you added to the component's customizer manually. Normally, it will be set to zero.


addNotify

public void addNotify()
Set the selected tab to the first non-generic tab in the customizer. We overrride addNotify() since we assume all the options have been set by the time it is called.

Overrides:
addNotify in class javax.swing.JComponent

addModelInstanceTabs

public void addModelInstanceTabs()
Adds customizer tabs for the model if any exists.


mergeCustomizers

protected boolean mergeCustomizers(java.beans.Customizer customizer)
Merges a customizer (Swing or AWT) with the current customizer.


mergeCustomizers

protected boolean mergeCustomizers(java.beans.Customizer customizer,
                                   boolean mergeModelTab,
                                   boolean mergeAppearanceTab)
Merges a customizer (Swing or AWT) with the current customizer.


customizerClosing

public void customizerClosing()
customizerClosing() is called when the customizer for a component is closed. customizerClosing() calls customizerClosing() on each of the panels in the SwingCustomizerView which extend SwingCustomizerPanel.

Subclasses of SwingCustomizerView which add panels which do not extend SwingCustomizerPanel should call an appropriate method on their panels to "unhook" the bean from the customizer. It is the responsibility of the UI control containing the SwingCustomizerView to call customizerClosing() on the SwingCustomizerView at the appropriate time.

Specified by:
customizerClosing in interface com.sas.beans.CustomizerClosingInterface



Copyright © 2009 SAS Institute Inc. All Rights Reserved.