JIDE 3.5.15

com.jidesoft.gantt
Class DefaultGanttEntry<T>

java.lang.Object
  extended by com.jidesoft.grid.AbstractNode
      extended by com.jidesoft.grid.AbstractExpandable
          extended by com.jidesoft.grid.AbstractExpandableRow
              extended by com.jidesoft.gantt.DefaultGanttEntry<T>
Type Parameters:
T - The type of the bases unit of the range, for example Date or Integer.
All Implemented Interfaces:
GanttEntry<T>, MutableGanttEntry<T>, SubEntryGanttEntry<T>, Expandable, ExpandableRow, Node, Row

public class DefaultGanttEntry<T>
extends AbstractExpandableRow
implements SubEntryGanttEntry<T>

DefaultGanttEntry is the default implementation of GanttEntry.


Field Summary
static int COLUMN_COMPLETION
           
static int COLUMN_NAME
           
static int COLUMN_RANGE_END
           
static int COLUMN_RANGE_START
           
 
Fields inherited from class com.jidesoft.grid.AbstractExpandable
_expandable, _expanded
 
Fields inherited from class com.jidesoft.grid.AbstractNode
_parent, PROPERTY_PARENT
 
Fields inherited from interface com.jidesoft.gantt.GanttEntry
PROPERTY_ADJUSTING
 
Fields inherited from interface com.jidesoft.grid.Expandable
PROPERTY_EXPANDABLE, PROPERTY_EXPANDED
 
Constructor Summary
DefaultGanttEntry(String name)
           
DefaultGanttEntry(String name, Class<T> rangeType, Range<T> range, double completion)
           
DefaultGanttEntry(String name, Range<T> range)
           
 
Method Summary
 void addSubEntry(GanttEntry<T> entry)
          Adds one sub entry.
 void childCompletionUpdated(DefaultGanttEntry<T> child)
           
 void childNameUpdated(DefaultGanttEntry<T> child)
           
 void childRangeUpdated(DefaultGanttEntry<T> child)
           
 void completionUpdated()
           
protected  int getActualColumnIndex(int column)
          This method will do the conversion of the column index if the subclass wants to display the default columns in a different order.
 Class<?> getCellClassAt(int columnIndex)
          Gets the type for the cell at columnIndex.
 List<GanttEntry<T>> getChildEntries()
           
 List<?> getChildren()
          Gets the list of children.
 double getCompletion()
          Gets the percentage of completion as a double value between 0.0 and 1.0.
 ConverterContext getConverterContextAt(int columnIndex)
          Gets the converter context for the cell at columnIndex.
 String getName()
          Gets the name of the entry.
 Range<T> getRange()
          Gets the range for this entry.
 List<GanttEntry<T>> getSubEntries()
          Gets all sub entries of this GanttEntry.
 Object getValueAt(int columnIndex)
          Gets the value for cell at columnIndex
 boolean isAdjusting()
          Checks if the entry is adjusting.
 boolean isCellEditable(int columnIndex)
          Returns true if the cell at columnIndex is editable.
 boolean isCompletionEditable()
           
 boolean isRangeEditable()
           
 void nameUpdated()
           
 void notifyCellUpdated(Object child, int columnIndex)
          Notifies the child is updated.
 void notifyChildDeleted(Object child)
          Notifies a child is deleted.
 void notifyChildInserted(Object child, int childIndex)
          Notifies the child is inserted as the specified index of this expandable.
 void notifyChildrenDeleted(List<? extends Row> children)
          Notifies the children are deleted.
 void rangeUpdated()
           
 void removeSubEntry(GanttEntry<T> entry)
          Removes one sub entry.
 void setAdjusting(boolean adjusting)
          Sets the adjusting flag.
 void setChildren(List<?> children)
          Sets the children for this Expandable.
 void setCompletion(double completion)
          A double value between [0.0, 1.0] representing the completion of the entry.
 void setName(String name)
           
 void setRange(Range<T> range)
           
 Range<T> setRange(T startInstant, T endInstant)
          NOTE: This method will do nothing if the current Range is null!
 void setSubEntries(List<GanttEntry<T>> subEntries)
          Sets all sub entries of this GanttEntry.
 void setValueAt(Object value, int columnIndex)
          Sets the value in the cell at columnIndex.
 String toString()
           
 
Methods inherited from class com.jidesoft.grid.AbstractExpandableRow
cellUpdated, getEditorContextAt, rowUpdated
 
Methods inherited from class com.jidesoft.grid.AbstractExpandable
addChild, addChild, addChildren, getAllChildrenCount, getAllVisibleChildrenCount, getChildAt, getChildIndex, getChildrenCount, getNumberOfVisibleChildren, getNumberOfVisibleExpandable, getTreeTableModel, hasChildren, hasVisibleChildren, isExpandable, isExpanded, moveDownChild, moveUpChild, notifyChildrenInserted, notifyChildrenUpdated, notifyChildUpdated, removeAllChildren, removeChild, removeChildren, setExpandable, setExpanded
 
Methods inherited from class com.jidesoft.grid.AbstractNode
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getLevel, getNextSibling, getParent, getPreviousSibling, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jidesoft.grid.Expandable
addChild, addChild, addChildren, getAllVisibleChildrenCount, getChildAt, getChildIndex, getChildrenCount, getNumberOfVisibleExpandable, hasChildren, isExpandable, isExpanded, moveDownChild, moveUpChild, notifyChildrenInserted, notifyChildrenUpdated, notifyChildUpdated, removeAllChildren, removeChild, removeChildren, setExpandable, setExpanded
 
Methods inherited from interface com.jidesoft.grid.Row
cellUpdated, getEditorContextAt, rowUpdated
 
Methods inherited from interface com.jidesoft.grid.Node
getLevel, getNextSibling, getParent, getPreviousSibling, setParent
 

Field Detail

COLUMN_NAME

public static final int COLUMN_NAME
See Also:
Constant Field Values

COLUMN_RANGE_START

public static final int COLUMN_RANGE_START
See Also:
Constant Field Values

COLUMN_RANGE_END

public static final int COLUMN_RANGE_END
See Also:
Constant Field Values

COLUMN_COMPLETION

public static final int COLUMN_COMPLETION
See Also:
Constant Field Values
Constructor Detail

DefaultGanttEntry

public DefaultGanttEntry(String name)

DefaultGanttEntry

public DefaultGanttEntry(String name,
                         Range<T> range)

DefaultGanttEntry

public DefaultGanttEntry(String name,
                         Class<T> rangeType,
                         Range<T> range,
                         double completion)
Parameters:
name - the name of the GanttEntry
rangeType - The class to be returned in getCellClassAt(int) for the default Range columns.
range - the Range of the GanttEntry
completion - the completion percentage of the GanttEntry
Method Detail

getActualColumnIndex

protected int getActualColumnIndex(int column)
This method will do the conversion of the column index if the subclass wants to display the default columns in a different order.

For example, if the subclass wants to add two columns at index 3 and 4, it should override this method like this. Basically it just needs to cover conversion for the five default columns.


  protected int getActualColumnIndex(int column) {
      switch (column) {
          case COLUMN_ID:
              return 0;
          case COLUMN_NAME:
              return 1;
          case COLUMN_COMPLETION:
              return 2;
          case COLUMN_RANGE_START:
              return 5;
          case COLUMN_RANGE_END:
              return 6;
      }
      return super.getActualColumnIndex(column);
  }
 

Parameters:
column - the default column index.
Returns:
the actual column index.

getName

public String getName()
Description copied from interface: GanttEntry
Gets the name of the entry. The name will be displayed on the gantt table.

Specified by:
getName in interface GanttEntry<T>
Returns:
the name of the entry

setName

public void setName(String name)

getRange

public Range<T> getRange()
Description copied from interface: GanttEntry
Gets the range for this entry.

NOTE: the range can be null and the range's upper and/or lower boundary can be null!

Specified by:
getRange in interface GanttEntry<T>
Returns:
the range.

setRange

public void setRange(Range<T> range)

setRange

public Range<T> setRange(T startInstant,
                         T endInstant)
NOTE: This method will do nothing if the current Range is null!

Specified by:
setRange in interface MutableGanttEntry<T>
Parameters:
startInstant - The new start instant for this GanttEntry.
endInstant - The new end instant for this GanttEntry.
Returns:
Returns the new Range of this GanttEntry.

notifyChildDeleted

public void notifyChildDeleted(Object child)
Description copied from interface: Expandable
Notifies a child is deleted.

Specified by:
notifyChildDeleted in interface Expandable
Overrides:
notifyChildDeleted in class AbstractExpandable
Parameters:
child - the child that is deleted

notifyChildrenDeleted

public void notifyChildrenDeleted(List<? extends Row> children)
Description copied from interface: Expandable
Notifies the children are deleted.

Specified by:
notifyChildrenDeleted in interface Expandable
Overrides:
notifyChildrenDeleted in class AbstractExpandable
Parameters:
children - the children that are deleted

notifyCellUpdated

public void notifyCellUpdated(Object child,
                              int columnIndex)
Description copied from interface: ExpandableRow
Notifies the child is updated.

Specified by:
notifyCellUpdated in interface ExpandableRow
Overrides:
notifyCellUpdated in class AbstractExpandableRow
Parameters:
child - the child which is updated
columnIndex - the column index.

notifyChildInserted

public void notifyChildInserted(Object child,
                                int childIndex)
Description copied from interface: Expandable
Notifies the child is inserted as the specified index of this expandable.

Specified by:
notifyChildInserted in interface Expandable
Overrides:
notifyChildInserted in class AbstractExpandable
Parameters:
child - the child which is inserted.
childIndex - the index where it is inserted. -1 if the child is inserted as the last one.

rangeUpdated

public void rangeUpdated()

childRangeUpdated

public void childRangeUpdated(DefaultGanttEntry<T> child)
Parameters:
child - The child which was added, had its range updated or null if the child was deleted.

getChildEntries

public List<GanttEntry<T>> getChildEntries()

nameUpdated

public void nameUpdated()

childNameUpdated

public void childNameUpdated(DefaultGanttEntry<T> child)
Parameters:
child - The child which was added, had its name updated or null if the child was deleted.

completionUpdated

public void completionUpdated()

childCompletionUpdated

public void childCompletionUpdated(DefaultGanttEntry<T> child)
Parameters:
child - The child which was added, had its completion updated or null if the child was deleted.

getCompletion

public double getCompletion()
Description copied from interface: GanttEntry
Gets the percentage of completion as a double value between 0.0 and 1.0.

Specified by:
getCompletion in interface GanttEntry<T>
Returns:
the percentage of completion.

setCompletion

public void setCompletion(double completion)
Description copied from interface: MutableGanttEntry
A double value between [0.0, 1.0] representing the completion of the entry.

Specified by:
setCompletion in interface MutableGanttEntry<T>
Parameters:
completion - The new completion for the GanttEntry.

getConverterContextAt

public ConverterContext getConverterContextAt(int columnIndex)
Description copied from interface: Row
Gets the converter context for the cell at columnIndex.

Specified by:
getConverterContextAt in interface Row
Overrides:
getConverterContextAt in class AbstractExpandableRow
Parameters:
columnIndex - the column index
Returns:
the converter context for the specified cell.

getValueAt

public Object getValueAt(int columnIndex)
Description copied from interface: Row
Gets the value for cell at columnIndex

Specified by:
getValueAt in interface Row
Parameters:
columnIndex - the column whose value to be queried
Returns:
the value at the specified cell.

getCellClassAt

public Class<?> getCellClassAt(int columnIndex)
Description copied from interface: Row
Gets the type for the cell at columnIndex.

Specified by:
getCellClassAt in interface Row
Overrides:
getCellClassAt in class AbstractExpandableRow
Parameters:
columnIndex - the column index
Returns:
the type for the specified cell.

setValueAt

public void setValueAt(Object value,
                       int columnIndex)
Description copied from interface: Row
Sets the value in the cell at columnIndex.

Specified by:
setValueAt in interface Row
Overrides:
setValueAt in class AbstractExpandableRow
Parameters:
value - the new value
columnIndex - the column whose value is to be changed
See Also:
Row.getValueAt(int), Row.isCellEditable(int)

isCellEditable

public boolean isCellEditable(int columnIndex)
Description copied from interface: Row
Returns true if the cell at columnIndex is editable. Otherwise, setValueAt on the cell will not change the value of that cell.

Specified by:
isCellEditable in interface Row
Overrides:
isCellEditable in class AbstractExpandableRow
Parameters:
columnIndex - the column whose value to be queried
Returns:
true if the cell is editable
See Also:
Row.setValueAt(java.lang.Object, int)

isRangeEditable

public boolean isRangeEditable()
Specified by:
isRangeEditable in interface MutableGanttEntry<T>
Returns:
Return true to allow this entry's range to be modified by the user.

isCompletionEditable

public boolean isCompletionEditable()
Specified by:
isCompletionEditable in interface MutableGanttEntry<T>
Returns:
Return true to allow this entry's completion to be modified by the user.

getChildren

public List<?> getChildren()
Description copied from interface: Expandable
Gets the list of children.

Specified by:
getChildren in interface Expandable
Returns:
the list of children

setChildren

public void setChildren(List<?> children)
Sets the children for this Expandable. Unless the Expandable is not added to a TreeTableModel yet, otherwise do not use this method but use AbstractExpandable.addChild(Object) instead. Nor should you use getChildren().add(...) because both setChildren and getChildren().add will not notify the TreeTableModel about the change.

Specified by:
setChildren in interface Expandable
Parameters:
children - the new children
See Also:
getChildEntries()

getSubEntries

public List<GanttEntry<T>> getSubEntries()
Description copied from interface: SubEntryGanttEntry
Gets all sub entries of this GanttEntry.

Specified by:
getSubEntries in interface SubEntryGanttEntry<T>
Returns:
the sub entry array.
See Also:
SubEntryGanttEntry.setSubEntries(java.util.List)

setSubEntries

public void setSubEntries(List<GanttEntry<T>> subEntries)
Description copied from interface: SubEntryGanttEntry
Sets all sub entries of this GanttEntry.

Specified by:
setSubEntries in interface SubEntryGanttEntry<T>
Parameters:
subEntries - the sub entry array

addSubEntry

public void addSubEntry(GanttEntry<T> entry)
Description copied from interface: SubEntryGanttEntry
Adds one sub entry.

Specified by:
addSubEntry in interface SubEntryGanttEntry<T>
Parameters:
entry - the sub entry
See Also:
SubEntryGanttEntry.removeSubEntry(GanttEntry)

removeSubEntry

public void removeSubEntry(GanttEntry<T> entry)
Description copied from interface: SubEntryGanttEntry
Removes one sub entry.

Specified by:
removeSubEntry in interface SubEntryGanttEntry<T>
Parameters:
entry - the sub entry

isAdjusting

public boolean isAdjusting()
Description copied from interface: GanttEntry
Checks if the entry is adjusting.

Specified by:
isAdjusting in interface GanttEntry<T>
Overrides:
isAdjusting in class AbstractExpandable
Returns:
true or false.

setAdjusting

public void setAdjusting(boolean adjusting)
Description copied from interface: MutableGanttEntry
Sets the adjusting flag. If the flag is true, the values in the GanttEntry are adjusting.

Specified by:
setAdjusting in interface MutableGanttEntry<T>
Overrides:
setAdjusting in class AbstractExpandable
Parameters:
adjusting - true or false.

toString

public String toString()
Overrides:
toString in class Object

JIDE 3.5.15