public class SpreadsheetLayer extends AbstractSystemLayer implements IGanttChartModelListener, FocusListener, MouseInputListener, CellEditorListener, IDatelineModelListener, PropertyChangeListener, TreeWillExpandListener, IEditable
IGanttChartModel
.IGanttChartModel.getSpreadsheetValue(com.dlsc.flexgantt.model.gantt.ISpreadsheet,
Object, ITimeSpan)
,
ISpreadsheetCellRenderer
,
ISpreadsheetCellEditor
alpha, changeSupport, ganttChart, layerContainer, PROPERTY_ALPHA, PROPERTY_VISIBLE
Constructor and Description |
---|
SpreadsheetLayer(LayerContainer lc)
Constructs a new spreadsheet layer.
|
Modifier and Type | Method and Description |
---|---|
void |
datelineModelChanged(DatelineModelEvent e)
The listener's callback method that gets invoked when the model's time
span or time zone changes.
|
void |
datelineModelWillChange(DatelineModelEvent evt)
The listener's callback method that gets invoked when the model's time
span or time zone will change.
|
boolean |
editCellAt(int row,
ITimeSpan span)
Programmatically starts editing the cell at
row and
span , if those indices are in the valid range, and the cell
at those indices is editable. |
boolean |
editCellAt(int row,
ITimeSpan span,
InputEvent e)
Programmatically starts editing the cell at
row and
span , if those indices are in the valid range, and the cell
at those indices is editable. |
boolean |
editCellFocused(InputEvent evt)
Starts the editing of the currently focused spreadsheet cell.
|
void |
editingCanceled(ChangeEvent e) |
void |
editingStopped(ChangeEvent e) |
void |
focusGained(FocusEvent e) |
void |
focusLost(FocusEvent e) |
void |
focusOnCellAbove()
Moves the focus to the cell that is above the currently focused cell.
|
void |
focusOnCellBelow()
Moves the focus to the cell that is below the currently focused cell.
|
void |
focusOnCellNext()
Moves the focus to the next cell to the right.
|
void |
focusOnCellPrevious()
Moves the focus to the next cell to the left.
|
void |
focusOnFirstCell()
Moves the focus to the cell that is in the upper left hand corner of the
spreadsheet.
|
void |
focusOnLastCell()
Moves the focus to the cell that is in the lower right corner of the
spreadsheet.
|
void |
focusOnPageDown()
Moves the focus to a cell that is exactly one page below the current
page.
|
void |
focusOnPageUp()
Moves the focus to a cell that is exactly one page above the current
page.
|
void |
ganttChartChanged(GanttChartModelEvent evt)
Callback method that gets invoked whenever change occures in the Gantt
chart model that is being observed by the listener.
|
ISpreadsheetCellEditor |
getCellEditor()
Returns the currently used cell editor.
|
ISpreadsheetCellEditor |
getCellEditor(Class cl)
Returns a cell editor for the given object type.
|
ISpreadsheetCellEditor |
getCellEditor(int row,
ITimeSpan span)
Returns the cell editor for the spreadsheet cell specified by the given
row and time span.
|
Color |
getCellFocusColor()
Returns the color used for displaying the focused state.
|
Rectangle |
getCellRect(int row,
ITimeSpan span)
Returns the cell rectangle for the cell at the given row and time span.
|
ISpreadsheetCellRenderer |
getCellRenderer(Class cl)
Returns a spreadsheet cell renderer for the given object type.
|
int |
getEditingRow()
Returns the row in which editing currently takes place.
|
ITimeSpan |
getEditingTimeSpan()
Returns the time span at which editing currently takes place.
|
Component |
getEditorComponent()
Returns the user interface component that is currently being used to edit
a cell value.
|
boolean |
hasFocus()
Determines if the spreadsheet layer currently has the focus and can be
edited.
|
boolean |
isEditing()
Returns TRUE if a cell is currently being edited.
|
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
protected void |
paintLayer(Graphics g) |
void |
propertyChange(PropertyChangeEvent evt) |
void |
removeEditor()
Discards the editor object and frees the real estate it used for cell
rendering.
|
void |
setCellEditor(Class cl,
ISpreadsheetCellEditor editor)
Specifies a cell editor for the given object type.
|
void |
setCellFocusColor(Color cellFocusColor)
Sets the color used for displaying the focused state.
|
void |
setCellRenderer(Class cl,
ISpreadsheetCellRenderer renderer)
Specifies a spreadsheet cell renderer for the given object type.
|
void |
setEditingRow(int row)
Sets the row in which editing currently takes place.
|
void |
setEditingTimeSpan(ITimeSpan span)
Sets the time span at which editing currently takes place.
|
void |
setHasFocus(boolean hasFocus)
Specifies if the spreadsheet layer currently has the focus and can be
edited.
|
void |
setVisible(boolean visible)
Specifies whether the layer is visible or not.
|
void |
treeWillCollapse(TreeExpansionEvent event)
Removes the focus from the spreadsheet when the tree table gets
collapsed.
|
void |
treeWillExpand(TreeExpansionEvent event)
Removes the focus from the spreadsheet when the tree table gets expanded.
|
addPropertyChangeListener, getAlpha, getDateline, getEventline, getGanttChart, getHeight, getLayerContainer, getLayerPolicyProvider, getModel, getName, getStartRow, getTimeAt, getTimeline, getTimeLocation, getTimeSpanUsed, getToolTipText, getTreeTable, getTreeTablePolicyProvider, getWidth, isVisible, removePropertyChangeListener, repaint, repaint, repaint, setAlpha, tearDown
public SpreadsheetLayer(LayerContainer lc)
lc
- the layer container to which the layer belongspublic boolean hasFocus()
public void setHasFocus(boolean hasFocus)
hasFocus
- TRUE if the layer has to have the focuspublic void setCellFocusColor(Color cellFocusColor)
cellFocusColor
- the color used for the focused state of a cellpublic Color getCellFocusColor()
public void setVisible(boolean visible)
AbstractLayer
setVisible
in class AbstractLayer
visible
- if TRUE the layer will be visibleAbstractLayer.isVisible()
protected void paintLayer(Graphics g)
paintLayer
in class AbstractLayer
public void focusGained(FocusEvent e)
focusGained
in interface FocusListener
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void ganttChartChanged(GanttChartModelEvent evt)
IGanttChartModelListener
ganttChartChanged
in interface IGanttChartModelListener
evt
- the event object describing the change that took place in the
Gantt chart modelpublic void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void removeEditor()
getCellEditor()
public Component getEditorComponent()
getEditorComponent
in interface IEditable
public boolean isEditing()
public ISpreadsheetCellEditor getCellEditor()
IGanttChartModel.getSpreadsheetValueType(ISpreadsheet, Object, ITimeSpan)
.setCellEditor(Class, ISpreadsheetCellEditor)
public boolean editCellFocused(InputEvent evt)
editCellFocused
in interface IEditable
evt
- the input event, which triggered the editing operationeditCellAt(int, ITimeSpan)
public boolean editCellAt(int row, ITimeSpan span)
row
and
span
, if those indices are in the valid range, and the cell
at those indices is editable.row
- the row to be editedspan
- the time span to be editedpublic boolean editCellAt(int row, ITimeSpan span, InputEvent e)
row
and
span
, if those indices are in the valid range, and the cell
at those indices is editable.row
- the row to be editedspan
- the time span to be editede
- the event that triggered the edit operationpublic int getEditingRow()
getEditingTimeSpan()
,
getEditorComponent()
,
setEditingRow(int)
public void setEditingRow(int row)
row
- the editing rowsetEditingTimeSpan(ITimeSpan)
,
getEditingRow()
public ITimeSpan getEditingTimeSpan()
public void setEditingTimeSpan(ITimeSpan span)
span
- the edited time spanpublic ISpreadsheetCellEditor getCellEditor(int row, ITimeSpan span)
row
- the row where the cell is locatedspan
- the time span where the cell is locatedpublic Rectangle getCellRect(int row, ITimeSpan span)
row
- the row of the cellspan
- the time span of the cellpublic void editingStopped(ChangeEvent e)
editingStopped
in interface CellEditorListener
public void editingCanceled(ChangeEvent e)
editingCanceled
in interface CellEditorListener
public void datelineModelWillChange(DatelineModelEvent evt) throws DatelineModelVetoException
IDatelineModelListener
datelineModelWillChange
in interface IDatelineModelListener
evt
- the event that occured on the datelineDatelineModelVetoException
- if the listener does not want the change to happenpublic void datelineModelChanged(DatelineModelEvent e)
IDatelineModelListener
datelineModelChanged
in interface IDatelineModelListener
e
- the event that occured on the datelinepublic void setCellRenderer(Class cl, ISpreadsheetCellRenderer renderer)
cl
- the object typerenderer
- the renderer used to visualize objects of the given typegetCellRenderer(Class)
public void setCellEditor(Class cl, ISpreadsheetCellEditor editor)
cl
- the object typeeditor
- the editor used to edit objects of the given typegetCellEditor(Class)
public ISpreadsheetCellRenderer getCellRenderer(Class cl)
cl
- the object type for which to return a matching cell renderersetCellRenderer(Class, ISpreadsheetCellRenderer)
public ISpreadsheetCellEditor getCellEditor(Class cl)
cl
- the object type for which to return a matching cell editorsetCellEditor(Class, ISpreadsheetCellEditor)
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException
treeWillExpand
in interface TreeWillExpandListener
event
- the tree expansion eventExpandVetoException
- if the spreadsheet does not allow the tree table to be
expandedpublic void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException
treeWillCollapse
in interface TreeWillExpandListener
event
- the tree expansion eventExpandVetoException
- if the spreadsheet does not allow the tree table to be
collapsedpublic void focusOnCellBelow()
public void focusOnCellAbove()
public void focusOnCellPrevious()
public void focusOnCellNext()
public void focusOnFirstCell()
public void focusOnLastCell()
public void focusOnPageUp()
public void focusOnPageDown()
Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.