com.sas.swing.visuals.dataselectors.format
Class FormatSelectorPanel

com.sas.swing.visuals.dataselectors.format.FormatSelectorPanel
All Implemented Interfaces:
PanelInterface, LayoutConstants, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class FormatSelectorPanel
implements PanelInterface, LayoutConstants

This class provides the panel that is used in a FormatSelector. The typical client should have no direct contact with this class if using the FormatSelector. The class creates a panel with a combo-box containing a list of types and a list-box with choices based on the type selected in the combox. Spinners allow the specification of width and the number of decimal places.

Typical use is shown:

    FormatSelectorPanel formatSelectorPanel = new FormatSelectorPanel(formatAdapter, Types.DOUBLE, incomingFormat);
    // ... place Panel in some container and display the container
    // when the Ok button is pressed ...
    formatSelectorPanel.onApply();
    // ... once onApply() is called it's valid to call getFormatString() ...
    String selectedFormat = formatSelectorPanel.getFormatString();
 

See Also:
Serialized Form

Field Summary
protected  javax.swing.JLabel decimalInstructionLabel
           
protected  javax.swing.JSpinner decimalSpinner
           
static java.lang.String DEFAULT_FORMAT
           
protected  javax.swing.JLabel exampleLabel
           
protected  javax.swing.JLabel exampleText
           
protected  javax.swing.JComboBox formatCategoryCombo
           
protected  javax.swing.JList formatChoicesList
           
protected  LabelView formatInstructionText
           
protected  javax.swing.JPanel rightPanel
           
static java.lang.String UNKNOWN_FORMAT
           
protected  javax.swing.JLabel widthInstructionLabel
           
protected  javax.swing.JSpinner widthSpinner
           
 
Fields inherited from interface com.sas.swing.visuals.PanelInterface
CONTENTS_VALID_PROPERTY
 
Fields inherited from interface com.sas.swing.visuals.util.LayoutConstants
DOTS_BUTTON_INSETS, EMPTY_INSETS, HGAP, HMARGIN, INDENTED_BORDER, TAB_BORDER, TEXTFIELD_INSETS, VGAP, VMARGIN
 
Constructor Summary
FormatSelectorPanel(FormatAdapterInterface formatAdapterInterface, int sqlType, java.lang.String incomingFormat)
          FormatSelectorPanel Constructor.
 
Method Summary
 java.lang.String getFormatString()
          This method is to be called to get the SAS format string representation of the format choice selected by the user.
protected  int getFormatWidth()
           
 void onApply()
          This method is to be called when the OK button is clicked.
 

Field Detail

DEFAULT_FORMAT

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

UNKNOWN_FORMAT

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

formatChoicesList

protected javax.swing.JList formatChoicesList

formatCategoryCombo

protected javax.swing.JComboBox formatCategoryCombo

exampleLabel

protected javax.swing.JLabel exampleLabel

exampleText

protected javax.swing.JLabel exampleText

formatInstructionText

protected LabelView formatInstructionText

widthSpinner

protected javax.swing.JSpinner widthSpinner

decimalSpinner

protected javax.swing.JSpinner decimalSpinner

widthInstructionLabel

protected javax.swing.JLabel widthInstructionLabel

decimalInstructionLabel

protected javax.swing.JLabel decimalInstructionLabel

rightPanel

protected javax.swing.JPanel rightPanel
Constructor Detail

FormatSelectorPanel

public FormatSelectorPanel(FormatAdapterInterface formatAdapterInterface,
                           int sqlType,
                           java.lang.String incomingFormat)
FormatSelectorPanel Constructor.

Parameters:
formatAdapterInterface - the FormatAdapterInterface object to be used by this visual to seed the dialog
sqlType - the SQL type for which format choices are to be displayed. The only type supported is DOUBLE.
incomingformat - the format choice which appears selected when the dialog is first displayed. Typically specified if there is a format associated with the object for which this selector is being displayed. If null, no choice is selected.
Method Detail

getFormatString

public java.lang.String getFormatString()
This method is to be called to get the SAS format string representation of the format choice selected by the user. Do note that the onApply() method should have been called before this method is invoked.

Returns:
the string representation of the format selected; null is returned if no choice is made

getFormatWidth

protected int getFormatWidth()

onApply

public void onApply()
This method is to be called when the OK button is clicked. It creates a String representation of the format based on the selections made. A call to getFormatString() after this method is invoked will return the SAS format string.

Specified by:
onApply in interface PanelInterface



Copyright © 2009 SAS Institute Inc. All Rights Reserved.