com.sas.swing.visuals.tableview
Class EditController

com.sas.swing.visuals.tableview.EditController
All Implemented Interfaces:
com.sas.table.EditControllerInterface
Direct Known Subclasses:
HttpEditController

public class EditController
implements com.sas.table.EditControllerInterface

Interface for implementing controllers to edit models for tables.

When specifying a column when using the method on the EditController, use the actual column name from the model and not the column label to avoid conflicts between the two.


Field Summary
protected  java.lang.String[] editableColumns
           
protected  boolean editEnabled
           
protected  int insertMode
           
 
Fields inherited from interface com.sas.table.EditControllerInterface
DEFAULT_INDEX, EXTEND, INSERT
 
Constructor Summary
EditController()
          Default constructor
 
Method Summary
 java.lang.String[] getEditableColumns()
          Returns the columns in which editing is allowed.
 int getInsertMode()
          Returns the insert mode for the controller.
 boolean isEditableColumn(java.lang.String columnName)
          Returns a boolean indicating whether the column is allowed to be edited.
 boolean isEditEnabled()
          Returns whether editing has been enabled for the TableView.
 void setEditableColumns(java.lang.String[] columnNames)
          Sets the columns in which editing is allowed.
 void setEditEnabled(boolean edit)
          Enables or disables editing on the TableView.
 void setInsertMode(int mode)
          Sets the insert mode for the controller.
 

Field Detail

editEnabled

protected boolean editEnabled

insertMode

protected int insertMode

editableColumns

protected java.lang.String[] editableColumns
Constructor Detail

EditController

public EditController()
Default constructor

Method Detail

setEditEnabled

public void setEditEnabled(boolean edit)
Enables or disables editing on the TableView.

Specified by:
setEditEnabled in interface com.sas.table.EditControllerInterface
Parameters:
edit - whether to enable editing on the TableView

isEditEnabled

public boolean isEditEnabled()
Returns whether editing has been enabled for the TableView.

Specified by:
isEditEnabled in interface com.sas.table.EditControllerInterface
Returns:
whether editing has been enabled for the TableView

getEditableColumns

public java.lang.String[] getEditableColumns()
Returns the columns in which editing is allowed. The editableColumns contains all the column names in which editing is allowed on the model, all other columns are to be non-editable. Returns null if all columns are allowed to be edited. An empty array is returned if no columns are to be edited.

Specified by:
getEditableColumns in interface com.sas.table.EditControllerInterface
Returns:
An array of column names in which editing is allowed.

setEditableColumns

public void setEditableColumns(java.lang.String[] columnNames)
Sets the columns in which editing is allowed. The editableColumns contains all the column names in which editing is allowed on the model, all other columns are to be non-editable. If a null is passed, then all columns will be editable. If an empty array is passed, then no columns will be editable. The default is that all columns are allowed to be edited.

When specifying a column when using the method on the EditController, use the actual column name from the model and not the column label to avoid conflicts between the two.

Specified by:
setEditableColumns in interface com.sas.table.EditControllerInterface
Parameters:
columnNames - An array of column names in which editing is allowed.

isEditableColumn

public boolean isEditableColumn(java.lang.String columnName)
Returns a boolean indicating whether the column is allowed to be edited. The default is that all columns are allowed to be edited.

When specifying a column when using the method on the EditController, use the actual column name from the model and not the column label to avoid conflicts between the two.

Specified by:
isEditableColumn in interface com.sas.table.EditControllerInterface
Parameters:
columnName - The name of the column to query about whether it is allowed to be edited.
Returns:
A boolean indicating whether the column is allowed to be edited.

getInsertMode

public int getInsertMode()

Returns the insert mode for the controller. Valid values are EditControllerInterface.INSERT and EditControllerInterface.EXTEND. If mode is EditControllerInterface.INSERT, then the controller will allow rows to be inserted before each row in the table. If mode is EditControllerInterface.EXTEND, then the controller will allow rows to be inserted at the default location (usually the end, this is model specific) of the table.

If the model is a javax.swing.table.DefaultTableModel then either mode is available. Otherwise, if the model implements com.sas.table.InsertRowInterface, then the table will follow the following rules. If InsertRowInterface.isRowInsertionAllowed() is false, then inserting will be disabled. If true, then the InsertRowInterface.isExtendOnly() method is checked. If isExtendOnly() returns true, then then EXTEND mode is available and the INSERT mode is not available. If isExtendOnly() returns false then both modes, INSERT and EXTEND, are both available. If a mode is selected but not available on the model, then the actions for that mode will be disabled.

The default value for insertMode is (INSERT | EXTEND). So both mode are available by default.

Specified by:
getInsertMode in interface com.sas.table.EditControllerInterface
Returns:
the insert mode for the controller

setInsertMode

public void setInsertMode(int mode)

Sets the insert mode for the controller. Valid values are EditControllerInterface.INSERT and EditControllerInterface.EXTEND. If mode is EditControllerInterface.INSERT, then the controller allows a new row to be inserted before each row in the table. If mode is EditControllerInterface.EXTEND, then the controller allow a new row to be inserted at the default location (usually the end, this is model specific) of the table.

If the model is a javax.swing.table.DefaultTableModel then either mode is available. Otherwise, if the model implements com.sas.table.InsertRowInterface, then the table will follow the following rules. If InsertRowInterface.isRowInsertionAllowed() is false, then inserting will be disabled. If true, then the InsertRowInterface.isExtendOnly() method is checked. If isExtendOnly() returns true, then then EXTEND mode is available and the INSERT mode is not available. If isExtendOnly() returns false then both modes, INSERT and EXTEND, are both available. If a mode is selected but not available on the model, then the actions for that mode will be disabled.

The default value for insertMode is (INSERT | EXTEND). So both mode are available by default.

Specified by:
setInsertMode in interface com.sas.table.EditControllerInterface
Parameters:
mode - the type of inserting to allow on the controller



Copyright © 2009 SAS Institute Inc. All Rights Reserved.