|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.gui.tables.AbstractTableMediator
The basics of a ComponentMediator for a Table. Used for: Associating a LimeJTable (TABLE) with a DataLineModel (DATA_MODEL). Associating a JPopupMenu & ButtonRow (BUTTON_ROW) with the DATA_MODEL. Holding common Action/Mouse/ListSelection listeners. (REMOVE_LISTENER, DEFAULT_LISTENER, HEADER_LISTENER, SELECTION_LISTENER) Holding common TableCellRenderers. [static] (PROGRESS_BAR_RENDERER, CHAT_RENDERER) Building a JPanel (MAIN_PANEL) of the LimeJTable, ButtonRow & JPopupMenu. Handling mouse interactions and displaying the appropriate menus. A popup menu if right-click over table. ColumnSelectionMenu if right-click over the header. Sorting the DATA_MODEL if left-click over the header. Refreshing the DATA_MODEL from the RefreshListener's call.
Nested Class Summary | |
protected class |
AbstractTableMediator.Resorter
|
Field Summary | |
protected ButtonRow |
BUTTON_ROW
Variable to the ButtonRow for this table. |
protected static javax.swing.table.TableCellRenderer |
CHAT_RENDERER
Variable for the ChatRenderer for all components. |
protected static javax.swing.table.TableCellRenderer |
COLOR_RENDERER
Variable for the ColorRenderer for all components. |
protected DataLineModel |
DATA_MODEL
Variable to the DataLineList containg the underlying data for this table. |
java.awt.event.MouseListener |
DEFAULT_LISTENER
Variable for the DefaultMouseListener for this component. |
javax.swing.event.MouseInputListener |
HEADER_LISTENER
Variable for the HeaderMouseListener for this component. |
protected java.lang.String |
ID
The ID that uniquely defines this table. |
protected PaddedPanel |
MAIN_PANEL
Variable to the main component displaying this Table. |
protected static javax.swing.table.TableCellRenderer |
PROGRESS_BAR_RENDERER
Variable for the ProgressBarRenderer for all components. |
java.awt.event.ActionListener |
REMOVE_LISTENER
Variable for the RemoveListener for this component. |
protected AbstractTableMediator.Resorter |
RESORTER
Resorter -- for doing real-time resorts. |
protected javax.swing.JScrollPane |
SCROLL_PANE
The JScrollPane instance for scrolling through the table. |
javax.swing.event.ListSelectionListener |
SELECTION_LISTENER
Variable for the ListSelectionListener for this component. |
TableSettings |
SETTINGS
Variable for the TableSettings for this component. |
protected LimeJTable |
TABLE
Variable to the LimeJTable for this table. |
protected java.awt.Component |
TABLE_PANE
The Component containing the JScrollPane for the table. |
protected static java.awt.Dimension |
ZERO_DIMENSION
A zero dimension to be used in all tables. |
Constructor Summary | |
protected |
AbstractTableMediator(java.lang.String id)
Basic constructor that uses a Template Pattern to delegate the setup functions to individual methods. |
Method Summary | |
void |
add(java.lang.Object o)
Add a new DataLine initialized by Object o to the list, tell the dataModel there was a row inserted, and unselect the first row (to address the java bug) |
protected void |
addListeners()
Adds the listeners to the table. |
void |
addUnsorted(java.lang.Object o)
Forces the object to be added unsorted. |
protected void |
buildListeners()
Assigns the listeners to their slots. |
protected void |
buildSettings()
Retrieves or builds the correct settings. |
protected void |
clearSelection()
Helper-function to clear selected items. |
void |
clearTable()
Clear the table of all items |
protected javax.swing.JPopupMenu |
createColumnSelectionMenu()
Creates a new ColumnSelectionMenu JPopupMenu. |
protected ColumnPreferenceHandler |
createDefaultColumnPreferencesHandler()
|
protected abstract javax.swing.JPopupMenu |
createPopupMenu()
Abstract method for creating a right-click popup menu for the table. |
protected void |
doRefresh()
Exists for extending classes to overwrite. |
void |
forceResort()
Resorts the underlying data, regardless of if the column is dynamic. |
javax.swing.JComponent |
getComponent()
Returns the underlying component that this Mediator handles |
protected java.awt.Component |
getScrolledTablePane()
Sets up & gets the table inside a JScrollPanel inside a JPanel. |
int |
getSize()
Gets the size of the underlying model. |
void |
handleHeaderColumnLeftClick(java.awt.Point p)
Sorts the column whose header maps to the given point |
void |
handleHeaderColumnPressed(java.awt.Point p)
Tell the table something is pressed. |
void |
handleHeaderColumnReleased(java.awt.Point p)
Tell the table something is not pressed. |
void |
handleHeaderPopupMenu(java.awt.Point p)
Show the column selection menu. |
void |
handlePopupMenu(java.awt.Point p)
Shows the popup menu at Point p |
void |
handleRightMouseClick(java.awt.Point p)
Changes the selection in the table in response to a right-mouse click. |
void |
refresh()
Implements RefreshListener Wraps the doRefresh call so that extending classes can maintain the resort & isShowing checks. |
void |
remove(java.lang.Object o)
Removes the row associated with the Object o Delegates to removeRow(int) If no matching row is found, nothing is done. |
void |
removeRow(int row)
Removes the row. |
void |
removeSelection()
Removes all selected rows from the list and fires deletions through the dataModel |
void |
resort()
Resorts the underlying data. |
void |
setButtonEnabled(int buttonIdx,
boolean enabled)
Delegates the setButtonEnabled call to the ButtonRow |
protected void |
setDefaultEditors()
Intended for setting up default editors. |
protected void |
setDefaultRenderers()
Intended for adding default renderers to the table. |
protected abstract void |
setupConstants()
Intended for setting the DATA_MODEL and TABLE constants. |
protected void |
setupMainPanel()
Sets up the MAIN_PANEL to have a uniform look among all tables. |
protected void |
setupTable()
Sets row heights a little larger than normal, turns off the display of the grid and disallows column selections. |
protected void |
setupTableHeaders()
Organizes the table headers so that they're sized correctly, in the correct order, and are either visible or not visible, depending on the user's preferences. |
protected void |
sortAndMaintainSelection(int columnToSort)
Sorts the DATA_MODEL and maintains selections in the TABLE. |
void |
update(java.lang.Object o)
Tells the model to update a specific DataLine |
protected abstract void |
updateSplashScreen()
Intended for updating the splash screen while this component loads. |
void |
updateTheme()
Update any required theme settings, such as colors or images. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.limegroup.gnutella.gui.tables.ComponentMediator |
handleMouseDoubleClick, handleNoSelection, handleSelection |
Field Detail |
protected final java.lang.String ID
protected PaddedPanel MAIN_PANEL
protected DataLineModel DATA_MODEL
protected LimeJTable TABLE
protected ButtonRow BUTTON_ROW
public java.awt.event.ActionListener REMOVE_LISTENER
public java.awt.event.MouseListener DEFAULT_LISTENER
public javax.swing.event.MouseInputListener HEADER_LISTENER
public javax.swing.event.ListSelectionListener SELECTION_LISTENER
public TableSettings SETTINGS
protected static final javax.swing.table.TableCellRenderer PROGRESS_BAR_RENDERER
protected static final javax.swing.table.TableCellRenderer CHAT_RENDERER
protected static final javax.swing.table.TableCellRenderer COLOR_RENDERER
protected static final java.awt.Dimension ZERO_DIMENSION
protected AbstractTableMediator.Resorter RESORTER
protected java.awt.Component TABLE_PANE
protected javax.swing.JScrollPane SCROLL_PANE
Constructor Detail |
protected AbstractTableMediator(java.lang.String id)
Method Detail |
protected abstract void updateSplashScreen()
protected void buildSettings()
protected abstract void setupConstants()
protected void buildListeners()
protected void addListeners()
protected void setupTable()
protected void setDefaultRenderers()
protected void setDefaultEditors()
protected void setupMainPanel()
protected void setupTableHeaders()
protected ColumnPreferenceHandler createDefaultColumnPreferencesHandler()
protected java.awt.Component getScrolledTablePane()
public void updateTheme()
ThemeObserver
updateTheme
in interface ThemeObserver
public void add(java.lang.Object o)
add
in interface ComponentMediator
public void addUnsorted(java.lang.Object o)
public void remove(java.lang.Object o)
remove
in interface ComponentMediator
public void removeRow(int row)
public void refresh()
refresh
in interface RefreshListener
protected void doRefresh()
public void update(java.lang.Object o)
update
in interface ComponentMediator
public void resort()
public void forceResort()
public javax.swing.JComponent getComponent()
ComponentMediator
getComponent
in interface ComponentMediator
public void removeSelection()
removeSelection
in interface ComponentMediator
protected javax.swing.JPopupMenu createColumnSelectionMenu()
public void handleRightMouseClick(java.awt.Point p)
handleRightMouseClick
in interface ComponentMediator
public void handlePopupMenu(java.awt.Point p)
handlePopupMenu
in interface ComponentMediator
public void handleHeaderColumnLeftClick(java.awt.Point p)
handleHeaderColumnLeftClick
in interface HeaderMouseObserver
public void handleHeaderPopupMenu(java.awt.Point p)
handleHeaderPopupMenu
in interface HeaderMouseObserver
public void handleHeaderColumnPressed(java.awt.Point p)
handleHeaderColumnPressed
in interface HeaderMouseObserver
public void handleHeaderColumnReleased(java.awt.Point p)
handleHeaderColumnReleased
in interface HeaderMouseObserver
public void setButtonEnabled(int buttonIdx, boolean enabled)
setButtonEnabled
in interface ComponentMediator
public int getSize()
public void clearTable()
protected void clearSelection()
protected void sortAndMaintainSelection(int columnToSort)
protected abstract javax.swing.JPopupMenu createPopupMenu()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |