| 
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jidesoft.grid.AutoResizePopupMenuCustomizer
public class AutoResizePopupMenuCustomizer
A TableHeaderPopupMenuCustomizer to auto resize a column or all columns. To use it, you can use the code
 like this.
 
 TableHeaderPopupMenuInstaller installer = new TableHeaderPopupMenuInstaller(aggregateTable)
 installer.addTableHeaderPopupMenuCustomizer(new AutoResizePopupMenuCustomizer());
 
| Field Summary | |
|---|---|
static String | 
CONTEXT_MENU_AUTO_RESIZE
CONTEXT_MENU_...  | 
static String | 
CONTEXT_MENU_AUTO_RESIZE_ALL
 | 
| Constructor Summary | |
|---|---|
AutoResizePopupMenuCustomizer()
 | 
|
| Method Summary | |
|---|---|
 void | 
customizePopupMenu(JTableHeader header,
                   JPopupMenu popup,
                   int clickingColumn)
The method generates the context menu items by clickingColumn.  | 
protected  String | 
getColumnName(JTableHeader header,
              int clickingColumn)
Gets the column name of the clicking column.  | 
 int[] | 
getMinimumWidth()
Gets the minimum width of the columns.  | 
protected  String | 
getResourceString(String key)
Gets the localized string from resource bundle.  | 
 boolean | 
isConsiderTableHeader()
Checks if we consider the table header when resizing.  | 
 boolean | 
isConsiderVisibleRowsOnly()
Checks if we only consider the visible rows when resizing.  | 
 void | 
setConsiderTableHeader(boolean considerTableHeader)
Sets the flag whether the table header is considered when resizing.  | 
 void | 
setConsiderVisibleRowsOnly(boolean considerVisibleRowsOnly)
Sets the flag whether it should resize based on the visible rows only.  | 
 void | 
setMinimumWidth(int[] minimumWidth)
Sets the minimum width of each 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 CONTEXT_MENU_AUTO_RESIZE
customizePopupMenu(javax.swing.table.JTableHeader, javax.swing.JPopupMenu, int), 
Constant Field Valuespublic static final String CONTEXT_MENU_AUTO_RESIZE_ALL
| Constructor Detail | 
|---|
public AutoResizePopupMenuCustomizer()
| Method Detail | 
|---|
public boolean isConsiderVisibleRowsOnly()
public void setConsiderVisibleRowsOnly(boolean considerVisibleRowsOnly)
considerVisibleRowsOnly - true if you want to the auto-resize to consider the visible rows only. False to
                                not consider.public boolean isConsiderTableHeader()
public void setConsiderTableHeader(boolean considerTableHeader)
considerTableHeader - true if you want to the auto-resize to consider the table header preferred width.
                            False to not consider.public int[] getMinimumWidth()
public void setMinimumWidth(int[] minimumWidth)
minimumWidth - the new minimum width.protected String getResourceString(String key)
key - the resource string key
public void customizePopupMenu(JTableHeader header,
                               JPopupMenu popup,
                               int clickingColumn)
      for (int i = 0; i < popup.getComponentCount(); i++) {
          if (CONTEXT_MENU_AUTO_RESIZE.equals(popup.getComponent(i).getName())) {
              popup.remove(popup.getComponent(i));
          }
      }
 
customizePopupMenu in interface TableHeaderPopupMenuCustomizerheader - the table headerpopup - the popup menu to be displayedclickingColumn - the column index clicked
protected String getColumnName(JTableHeader header,
                               int clickingColumn)
header - the table header.clickingColumn - the clicking column.
  | 
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||