|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.grid.TableColumnChooserPopupMenuCustomizer
public class TableColumnChooserPopupMenuCustomizer
A TableHeaderPopupMenuCustomizer
to add menu items related to show or hide the columns to a popup menu.
To use it, you can use the code like this. Please be noted that if you are going to install these menu items for
AggregateTable, please use AggregateTableColumnChooserPopupMenuCustomizer instead.
TableHeaderPopupMenuInstaller installer = new TableHeaderPopupMenuInstaller(aggregateTable)
installer.addTableHeaderPopupMenuCustomizer(new TableColumnChooserPopupMenuCustomizer());
Field Summary | |
---|---|
protected Locale |
_locale
|
static String |
CLIENT_PROPERTY_CLICK_COLUMN_INDEX
client property used to pass clicking column index to ActionListener |
static String |
CONTEXT_MENU_HIDE
CONTEXT_MENU_... |
static String |
CONTEXT_MENU_MORE
|
static String |
CONTEXT_MENU_OTHER_COLUMNS
|
static String |
CONTEXT_MENU_RESET_COLUMNS
|
static String |
CONTEXT_MENU_SHOW_ALL
|
Constructor Summary | |
---|---|
TableColumnChooserPopupMenuCustomizer()
|
Method Summary | |
---|---|
protected TableColumnChooserDialog |
createTableColumnChooserDialog(Window owner,
String title,
JTable table)
Create TableColumnChooserDialog instance while you choose "More..." option. |
void |
customizePopupMenu(JTableHeader header,
JPopupMenu popup,
int clickingColumn)
The method generates the context menu items by clickingColumn. |
protected int |
getColumnCount(JTable table)
|
protected String |
getDisplayColumnName(JTable table,
int columnIndex)
Gets the display column name to be displayed on the popup menu. |
String[] |
getDisplayColumnNames()
Gets the display column names set by setDisplayColumnNames(String[]) . |
int[] |
getFavoriteColumns()
Gets the favorite columns. |
int[] |
getFixedColumns()
Gets the fixed columns. |
int[] |
getHiddenColumns()
Gets the hidden columns. |
protected Object |
getIdentifier(JTable table,
int columnIndex)
Gets the identifier of the column. |
protected String |
getResourceString(String key)
Gets the localized string from resource bundle. |
protected void |
hideColumn(JTable table,
int columnIndex)
Calls to TableColumnChooser.hideColumn to hide the column. |
void |
setDisplayColumnNames(String[] displayColumnNames)
This method can be used to specify what column names to display on the popup menu. |
void |
setFavoriteColumns(int[] favoriteColumns)
Sets the favorite columns. |
void |
setFixedColumns(int[] fixedColumns)
Sets the fixed columns. |
void |
setHiddenColumns(int[] hiddenColumns)
Sets the hidden columns. |
protected void |
showAllColumns(JTable table)
|
protected void |
showColumn(JTable table,
int columnIndex)
Deprecated. replaced by showColumn(javax.swing.JTable, int, Object) |
protected void |
showColumn(JTable table,
int columnIndex,
Object columnIdentifier)
Calls to TableColumnChooser.showColumn to show the column. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CLIENT_PROPERTY_CLICK_COLUMN_INDEX
public static final String CONTEXT_MENU_HIDE
customizePopupMenu(javax.swing.table.JTableHeader, javax.swing.JPopupMenu, int)
,
Constant Field Valuespublic static final String CONTEXT_MENU_SHOW_ALL
public static final String CONTEXT_MENU_OTHER_COLUMNS
public static final String CONTEXT_MENU_RESET_COLUMNS
public static final String CONTEXT_MENU_MORE
protected Locale _locale
Constructor Detail |
---|
public TableColumnChooserPopupMenuCustomizer()
Method Detail |
---|
public String[] getDisplayColumnNames()
setDisplayColumnNames(String[])
.
public void setDisplayColumnNames(String[] displayColumnNames)
displayColumnNames
- the display column names on the table model.public int[] getHiddenColumns()
public void setHiddenColumns(int[] hiddenColumns)
hiddenColumns
- the hidden column indices.public int[] getFixedColumns()
public void setFixedColumns(int[] fixedColumns)
fixedColumns
- the hidden column indices.public int[] getFavoriteColumns()
public void setFavoriteColumns(int[] favoriteColumns)
favoriteColumns
- the hidden column indices.protected String getResourceString(String key)
key
- the resource string key
protected String getDisplayColumnName(JTable table, int columnIndex)
table
- the tablecolumnIndex
- the column index as in table model.
protected Object getIdentifier(JTable table, int columnIndex)
table
- the tablecolumnIndex
- the column index as in table model.
public void customizePopupMenu(JTableHeader header, JPopupMenu popup, int clickingColumn)
for (int i = 0; i < popup.getComponentCount(); i++) {
if (CONTEXT_MENU_HIDE.equals(popup.getComponent(i).getName())) {
popup.remove(popup.getComponent(i));
}
}
customizePopupMenu
in interface TableHeaderPopupMenuCustomizer
header
- the table headerpopup
- the popup menu to be displayedclickingColumn
- the column index clickedprotected TableColumnChooserDialog createTableColumnChooserDialog(Window owner, String title, JTable table)
owner
- the owner of the dialogtitle
- the title of the dialogtable
- the JTable related to the dialog
protected int getColumnCount(JTable table)
protected void showAllColumns(JTable table)
protected void hideColumn(JTable table, int columnIndex)
table
- the tablecolumnIndex
- the model column index.@Deprecated protected void showColumn(JTable table, int columnIndex)
showColumn(javax.swing.JTable, int, Object)
table
- the tablecolumnIndex
- the model column index.protected void showColumn(JTable table, int columnIndex, Object columnIdentifier)
table
- the tablecolumnIndex
- the model column index.columnIdentifier
- the column identifier
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |