com.sas.graphics.components.ganttchart
Class GanttChartModel

com.sas.graphics.components.ganttchart.GanttChartModel

public class GanttChartModel

A GanttChartModel encapsulates most of a GanttChart's visual display properties. This contrasts with the GanttChart's data model, which determines the number and organization of data elements (bars) and the use of axes and a legend.

A GanttChartModel contains GanttChart-specific properties, common graph properties, and a collection of models that control the appearance of the graph's peripheral elements, such as its axes and legends.

A GanttChartModel does not allow null values for properties in its contained models. Passing a null parameter to the set method for a contained model property results in an IllegalArgumentException. Guaranteeing non-null properties for a contained model simplifies access to the display properties and ensures that the GanttChart's display state is unambiguous.

Topics:
Axes
TimeNowModel
Marker Style for Target Dates
Line Styles
Annotation Label Text
Behavior

Samples

Since:
SAS 9.1
See Also:
Graph, GraphStyle, GanttChart

Constructor Summary
GanttChartModel()
           
 
Method Summary
 void apply(GanttChartModel theOtherModel)
          Properties contained in "theOtherModel" to this object.
 boolean equals(java.lang.Object obj)
          Determines whether another object is equal to this GanttChartModel.
 TextStyle getAnnotationLabelTextStyle()
          Returns the text appearance model that is applied to the anno text defined with the GanttChartTableDataModel.setAnnotationLabelVariable().
 com.sas.measures.BaseLength getAnnotationSymbolSize()
          Returns the size that is applied to the annotation symbols defined with the GanttChartTableDataModel.setAnnotationSymbolVariable() and GanttChartAnnotationTableDataModel.setAnnotationSymbolVariable().
 AxisWallModel getAxisWallModel()
          Returns the attributes associated with the axis walls.
 java.lang.String getCustomSchedule1Label()
          
 java.lang.String getCustomSchedule2Label()
          Returns the label that needs to be applied to the Custom Schedule 2.
 com.sas.graphics.components.CompoundTimeAxisModel getDateAxisModel()
          Returns the GanttChart's date axis model.
 double getInformatValue(java.lang.String informatValue, java.lang.String informatName)
          Deprecated. use
   SASFormat fmt = SASFormat.getInstance("DATE7.");       
   double d = ((SASDateTimeFormat)fmt).informat("25dec05"));
   
 LegendModel getLegendModel()
          Returns the GanttChart's legend model, a repository for bar color legend appearance preferences.
 TableAxisModel getTableAxisModel()
          Returns the GanttChart's TableAxisModel model, which is used to set the list of tasks or activities in a project.
 ReferenceLineModel getTimeNowReferenceLineModel()
           
 double getViewStart()
          Returns the start position of the data axis from where the chart can be viewed.
 int hashCode()
          Computes the hash code for this GanttChartModel.
 boolean isActualBarEnabled()
          Returns whether the acutal bar is to be drawn.
 boolean isActualBarOverlaid()
          Returns whether the acutal bar is to be overlaid with the gantt bar.
 boolean isBaselineBarEnabled()
          Returns whether baseline dates are represented in the chart.
 boolean isCustomBar1Enabled()
          Returns whether the acutal bar is to be drawn.
 boolean isCustomBar2Enabled()
          Returns whether the acutal bar is to be drawn.
 boolean isGanttBarEnabled()
          Returns whether the Gantt bar is to be drawn.
 boolean isResourceBarEnabled()
          Returns whether the resource bar is to be drawn.
 boolean isSlackTimeEnabled()
          Returns whether the slack time entry need to be shown in the bar.
 boolean isTimeNowEnabled()
          This method is for internal use only
 void setActualBarEnabled(boolean newBoolean)
          Sets whether the actual bar is to be drawn.
 void setActualBarOverlaid(boolean newOverlaid)
          Sets whether the actual bar is to be overlaid with the gantt bar.
 void setAnnotationLabelTextStyle(TextStyle newTextStyle)
          Sets the text appearance model that is applied to the annotation labels specified in the GanttChartTableDataModel.setAnnotationLabelVariable() and GanttChartAnnotationTableDataModel.setAnnotationSymbolVariable().
 void setAnnotationSymbolSize(com.sas.measures.BaseLength newSize)
          Sets the size of annotation symbols (markers) specified in the GanttChartTableDataModel.setAnnotationSymbolVariable() and GanttChartAnnotationTableDataModel.setAnnotationSymbolVariable().
 void setAxisWallModel(AxisWallModel newAxisWallModel)
          Sets the attributes associated with the axis walls.
 void setBaselineBarEnabled(boolean newBoolean)
          Sets whether baseline dates are represented in the chart.
 void setCustom1BarEnabled(boolean newBoolean)
          Sets whether the actual bar is to be drawn.
 void setCustom2BarEnabled(boolean newBoolean)
          Sets whether the actual bar is to be drawn.
 void setCustomSchedule1Label(java.lang.String newCustom1Label)
          Sets the label to the custom schedule 1.
 void setCustomSchedule2Label(java.lang.String newCustom2Label)
          Sets the label to the custom schedule 2.
 void setDateAxisModel(com.sas.graphics.components.CompoundTimeAxisModel newAxisModel)
          Sets the GanttChart's date axis model containing axis appearance preferences.
 void setGanttBarEnabled(boolean newBoolean)
          Sets whether the Gantt bar is to be drawn.
 void setLegendModel(LegendModel newLegendModel)
          Sets the GanttChart's legend model, a repository for bar color legend appearance preferences.
 void setResourceBarEnabled(boolean newBoolean)
          Sets whether the resource bar is to be drawn.
 void setSlackTimeEnabled(boolean newBoolean)
          Sets whether to show the Slack Time or not.
 void setTableAxisModel(TableAxisModel newTableAxisModel)
          Sets the GanttChart's table Axis model containing table appearance preferences.
 void setTimeNowEnabled(boolean newTimeNow)
          This method is for internal use only
 void setTimeNowReferenceLineModel(ReferenceLineModel newModel)
          The timenow line specification.
 void setViewStart(double newViewStart)
          Usage :- SASFormat fmt = SASFormat.getInstance("DATE7."); this.setViewStart(((SASDateTimeFormat)fmt).informat("25dec05")); Sets the starting position of the date axis from which the chart can be viewed.
 
Methods inherited from class com.sas.graphics.components.GraphModel
apply, getBackgroundFillStyle, getBrushModel, getDataElementStyles, getDataTipModel, getFrameLineStyle, getLogo, getLogoJustification, isAntialiasedGraphics, isAntialiasedText, setAntialiasedGraphics, setAntialiasedText, setBackgroundFillStyle, setBrushModel, setDataElementStyles, setDataTipModel, setFrameLineStyle, setLogo, setLogoJustification
 
Methods inherited from class com.sas.graphics.components.ModelBase
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel
 

Constructor Detail

GanttChartModel

public GanttChartModel()
Method Detail

apply

public void apply(GanttChartModel theOtherModel)
Properties contained in "theOtherModel" to this object.
Note: Contained "models" (i.e. properties that are subclasses of ModelBase) will in turn be called on to convey their properties to the like contained models in the other object. In that respect this can be considered a "tree" type copy.
Also Note: This is a deep copy. Thus after the copy, mutable properties will not be shared by the two instances. Only non-null properties from "theOtherModel" will be applied to this object.

Parameters:
theOtherModel - properties applied to this instance

equals

public boolean equals(java.lang.Object obj)
Determines whether another object is equal to this GanttChartModel.

The result is true if and only if the argument is not null and is a GanttChartModel object that has the same properties as this object.

Overrides:
equals in class GraphModel
Parameters:
obj - the object to test for equality with this GanttChartModel
Returns:
true if the objects are the same; false otherwise.

hashCode

public int hashCode()
Computes the hash code for this GanttChartModel.

Overrides:
hashCode in class GraphModel
Returns:
a hash code value for this object.

setDateAxisModel

public void setDateAxisModel(com.sas.graphics.components.CompoundTimeAxisModel newAxisModel)
                      throws java.lang.IllegalArgumentException
Sets the GanttChart's date axis model containing axis appearance preferences.

Parameters:
newAxisModel - the new axis display attributes for date time axis.
Throws:
java.lang.IllegalArgumentException - if newAxisModel is null.
See Also:
getDateAxisModel(), AxisModel.apply(com.sas.graphics.components.AxisModel)

getDateAxisModel

public com.sas.graphics.components.CompoundTimeAxisModel getDateAxisModel()
Returns the GanttChart's date axis model. Set the desired attributes on the CompoundTimeAxisModel that is returned. For example, the following code fragment sets a DAY interval for the highest-level date axis and hides the second and third levels on the date axis.

 GanttChartModel ganttChartModel = ganttChart.getGraphModel();
 CompoundTimeAxisModel dateAxis = ganttChartModel.getDateAxisModel();
 TimePeriodModel period1 = dateAxis.getTimePeriodModel1();
 period1.setTimeLength(new TimeLength(1, GraphConstants.TIME_INTERVAL_DAY));
 dateAxis.getTimePeriodModel2().setVisible(false);
 dateAxis.getTimePeriodModel3().setVisible(false);
 

Returns:
CompoundTimeAxisModel with up to 3 levels of date axes.
See Also:
setDateAxisModel(com.sas.graphics.components.CompoundTimeAxisModel)

setTableAxisModel

public void setTableAxisModel(TableAxisModel newTableAxisModel)
                       throws java.lang.IllegalArgumentException
Sets the GanttChart's table Axis model containing table appearance preferences.

Parameters:
newTableAxisModel - the new table display attributes
Throws:
java.lang.IllegalArgumentException - if newTableAxisModel is null.
See Also:
getTableAxisModel(), TableAxisModel.apply(com.sas.graphics.components.TableAxisModel)

getTableAxisModel

public TableAxisModel getTableAxisModel()
Returns the GanttChart's TableAxisModel model, which is used to set the list of tasks or activities in a project. The list of tasks is displayed in table format on the left axis. The following code fragment sets three variables on the task axis:

 // Get the task axis and change its characteristics
    GanttChartModel ganttChartModel = ganttChart.getGraphModel();
    TableAxisModel tableAxisModel = ganttChartModel.getTableAxisModel();
     TableAxisColumn tac[] = new TableAxisColumn[3];
       tac[0] = new TableAxisColumn(new Variable("Task"));
       tac[0].setWidth(new BaseLength(1.5, "in"));
       tac[1] = new TableAxisColumn(new Variable("EarlyStart"));
       tac[2] = new TableAxisColumn(new Variable("LateStart"));
     tableAxisModel.setColumns(tac);
 

Returns:
TableAxisModel
See Also:
setTableAxisModel(com.sas.graphics.components.TableAxisModel)

setAxisWallModel

public void setAxisWallModel(AxisWallModel newAxisWallModel)
                      throws java.lang.IllegalArgumentException
Sets the attributes associated with the axis walls.

Parameters:
newAxisWallModel - the new repository for the axis wall display attributes
Throws:
java.lang.IllegalArgumentException - if newAxisWallModel is null.
See Also:
getAxisWallModel(), AxisWallModel.apply(com.sas.graphics.components.AxisWallModel)

getAxisWallModel

public AxisWallModel getAxisWallModel()
Returns the attributes associated with the axis walls.

Returns:
AxisWallModel
See Also:
setAxisWallModel(com.sas.graphics.components.AxisWallModel)

setCustomSchedule1Label

public void setCustomSchedule1Label(java.lang.String newCustom1Label)
Sets the label to the custom schedule 1. If not set it will set the Default label(Custom Schedule 1).

Parameters:
newCustom1Label - used to apply the label to the Custom Schedule 1.
See Also:
getCustomSchedule1Label()

getCustomSchedule1Label

public java.lang.String getCustomSchedule1Label()
Returns the label that needs to be applied to the Custom Schedule 1..

Returns:
String
See Also:
setCustomSchedule1Label(java.lang.String)

setCustomSchedule2Label

public void setCustomSchedule2Label(java.lang.String newCustom2Label)
Sets the label to the custom schedule 2. If not set it will set the Default label(Custom Schedule 2).

Parameters:
newCustom2Label - used to apply the label to the Custom Schedule 2.
See Also:
getCustomSchedule2Label()

getCustomSchedule2Label

public java.lang.String getCustomSchedule2Label()
Returns the label that needs to be applied to the Custom Schedule 2.

Returns:
String
See Also:
setCustomSchedule2Label(java.lang.String)

setAnnotationLabelTextStyle

public void setAnnotationLabelTextStyle(TextStyle newTextStyle)
                                 throws java.lang.IllegalArgumentException
Sets the text appearance model that is applied to the annotation labels specified in the GanttChartTableDataModel.setAnnotationLabelVariable() and GanttChartAnnotationTableDataModel.setAnnotationSymbolVariable(). The color defined within will be used is the GanttChartTableDataModel.setAnnotationLabelColorVariable() is not set or has no value. Currently only font and color are used.

By default it gets graphStyle.getDataLabelTextStyle() and changes when the graphstyle changes.

Parameters:
newTextStyle - the new repository for the text anno marker display attributes
Throws:
java.lang.IllegalArgumentException - if newTextStyle is null.
See Also:
getAnnotationLabelTextStyle(), TextStyle.apply(com.sas.graphics.components.TextStyle)

getAnnotationLabelTextStyle

public TextStyle getAnnotationLabelTextStyle()
Returns the text appearance model that is applied to the anno text defined with the GanttChartTableDataModel.setAnnotationLabelVariable().

Returns:
text attributes for the anno text labels
See Also:
setAnnotationLabelTextStyle(com.sas.graphics.components.TextStyle)

setAnnotationSymbolSize

public void setAnnotationSymbolSize(com.sas.measures.BaseLength newSize)
                             throws java.lang.IllegalArgumentException
Sets the size of annotation symbols (markers) specified in the GanttChartTableDataModel.setAnnotationSymbolVariable() and GanttChartAnnotationTableDataModel.setAnnotationSymbolVariable(). Setting a size to zero: setAnnotationSymbolSize(new BaseLength(0.0, "px")) in any magnitude will cause the symbols to be drawn in the default size, which is calculated based on the bar size.

Parameters:
newSize - marker size
Throws:
java.lang.IllegalArgumentException - if newSize is null.
See Also:
getAnnotationSymbolSize()

getAnnotationSymbolSize

public com.sas.measures.BaseLength getAnnotationSymbolSize()
Returns the size that is applied to the annotation symbols defined with the GanttChartTableDataModel.setAnnotationSymbolVariable() and GanttChartAnnotationTableDataModel.setAnnotationSymbolVariable().

Returns:
marker size
See Also:
setAnnotationSymbolSize(com.sas.measures.BaseLength)

setLegendModel

public void setLegendModel(LegendModel newLegendModel)
                    throws java.lang.IllegalArgumentException
Sets the GanttChart's legend model, a repository for bar color legend appearance preferences.

Parameters:
newLegendModel - the new repository for the legend display attributes
Throws:
java.lang.IllegalArgumentException - if newLegendModel is null.
See Also:
getLegendModel(), LegendModel.apply(com.sas.graphics.components.LegendModel)

getLegendModel

public LegendModel getLegendModel()
Returns the GanttChart's legend model, a repository for bar color legend appearance preferences.

Returns:
AxisModel
See Also:
setLegendModel(com.sas.graphics.components.LegendModel)

setActualBarOverlaid

public void setActualBarOverlaid(boolean newOverlaid)
Sets whether the actual bar is to be overlaid with the gantt bar. If false, the actual bar will be drawn beside the gantt bar, not overlaid.

Parameters:
newOverlaid - used to determine if overlay is desired.
See Also:
isActualBarOverlaid()

isActualBarOverlaid

public boolean isActualBarOverlaid()
Returns whether the acutal bar is to be overlaid with the gantt bar.

Returns:
boolean used to determine if overlay is desired.
See Also:
setActualBarOverlaid(boolean)

setActualBarEnabled

public void setActualBarEnabled(boolean newBoolean)
Sets whether the actual bar is to be drawn. If false, the actual bar will not be drawn even if actual data exists.

Parameters:
newBoolean - used to determine if actual bar is shown.
See Also:
isActualBarEnabled()

isActualBarEnabled

public boolean isActualBarEnabled()
Returns whether the acutal bar is to be drawn.

Returns:
boolean used to determine if actual bar is drawn.
See Also:
setActualBarEnabled(boolean)

setCustom1BarEnabled

public void setCustom1BarEnabled(boolean newBoolean)
Sets whether the actual bar is to be drawn. If false, the actual bar will not be drawn even if actual data exists.

Parameters:
newBoolean - used to determine if actual bar is shown.
See Also:
isActualBarEnabled()

isCustomBar1Enabled

public boolean isCustomBar1Enabled()
Returns whether the acutal bar is to be drawn.

Returns:
boolean used to determine if actual bar is drawn.
See Also:
setActualBarEnabled(boolean)

setCustom2BarEnabled

public void setCustom2BarEnabled(boolean newBoolean)
Sets whether the actual bar is to be drawn. If false, the actual bar will not be drawn even if actual data exists.

Parameters:
newBoolean - used to determine if actual bar is shown.
See Also:
isActualBarEnabled()

isCustomBar2Enabled

public boolean isCustomBar2Enabled()
Returns whether the acutal bar is to be drawn.

Returns:
boolean used to determine if actual bar is drawn.
See Also:
setActualBarEnabled(boolean)

setGanttBarEnabled

public void setGanttBarEnabled(boolean newBoolean)
Sets whether the Gantt bar is to be drawn. If false, the Gantt bar will not be drawn even if Gantt early/late data exists.

Parameters:
newBoolean - used to determine if gantt bar is shown.
See Also:
isGanttBarEnabled()

isGanttBarEnabled

public boolean isGanttBarEnabled()
Returns whether the Gantt bar is to be drawn.

Returns:
boolean used to determine if Gantt bar is drawn.
See Also:
setGanttBarEnabled(boolean)

setSlackTimeEnabled

public void setSlackTimeEnabled(boolean newBoolean)
Sets whether to show the Slack Time or not. If false, Then part of the Slack Bar is not visible. if in case if the Style by variable is also set then the preference will be given to the style by variable. i.e slack time will be visible.

Parameters:
newBoolean - used to determine if slack time needs to show in the bar.
See Also:
isSlackTimeEnabled()

isSlackTimeEnabled

public boolean isSlackTimeEnabled()
Returns whether the slack time entry need to be shown in the bar.

Returns:
boolean used to determine if slack time entry is to be shown in the bar.
See Also:
setSlackTimeEnabled(boolean)

setBaselineBarEnabled

public void setBaselineBarEnabled(boolean newBoolean)
Sets whether baseline dates are represented in the chart. If false, bars representing baseline dates are not drawn, even if baseline data exist.

Parameters:
newBoolean - used to determine if baseline bar is shown.
See Also:
isBaselineBarEnabled()

isBaselineBarEnabled

public boolean isBaselineBarEnabled()
Returns whether baseline dates are represented in the chart.

Returns:
boolean used to determine if baseline bar is drawn.
See Also:
setBaselineBarEnabled(boolean)

setResourceBarEnabled

public void setResourceBarEnabled(boolean newBoolean)
Sets whether the resource bar is to be drawn. If false, the resource bar will not be drawn even if resource data exists.

Parameters:
newBoolean - used to determine if resource bar is shown.
See Also:
isResourceBarEnabled()

isResourceBarEnabled

public boolean isResourceBarEnabled()
Returns whether the resource bar is to be drawn.

Returns:
boolean used to determine if resource bar is drawn.
See Also:
setResourceBarEnabled(boolean)

setTimeNowReferenceLineModel

public void setTimeNowReferenceLineModel(ReferenceLineModel newModel)
The timenow line specification. The rule is the value set must be in the same terms the GanttChartTableDataModel.setEarlyStartVariable is in. That means if the EarlyStart values have an informat on them such as "DATE7.", then the value set must also be in that same form.
 SASFormat fmt = SASFormat.getInstance("DATE7.");       
 double timenow = ((SASDateTimeFormat)fmt).informat("25dec05"));
  Or
  java.util.Date currentTime = new java.util.Date(); 
  double javaDateValue = currentTime.getTime();
  SASFormat fmtInst = SASFormat.getInstance("DATE7.");
  double timenow = fmtInst.convertFromJavaDate( (long)javaDateValue );
 
       // Create the reference line at a specific time
       ReferenceLineModel myTimeNowRefLine = new ReferenceLineModel();
       myTimeNowRefLine.setPosition(timeNow);
       StrokeLineStyle redLine = new StrokeLineStyle();
       redLine.setColor(java.awt.Color.red);
       myTimeNowRefLine.setLineStyle(redLine);
       myTimeNowRefLine.setInFront(true);
       gcm.setTimeNowReferenceLineModel(myTimeNowRefLine);

  Or
       
  java.util.Date currentTime = new java.util.Date(); 
       myTimeNowRefLine.setPositionAsObject(currentTime);
  
 

Parameters:
newModel - reference line model to use

getTimeNowReferenceLineModel

public ReferenceLineModel getTimeNowReferenceLineModel()

setViewStart

public void setViewStart(double newViewStart)
Usage :- SASFormat fmt = SASFormat.getInstance("DATE7."); this.setViewStart(((SASDateTimeFormat)fmt).informat("25dec05")); Sets the starting position of the date axis from which the chart can be viewed. If the value lies outside the range then the starting position is set to the minimum value of the date axis.

See Also:
getViewStart()

getViewStart

public double getViewStart()
Returns the start position of the data axis from where the chart can be viewed.

See Also:
setViewStart(double)

setTimeNowEnabled

public void setTimeNowEnabled(boolean newTimeNow)
This method is for internal use only


isTimeNowEnabled

public boolean isTimeNowEnabled()
This method is for internal use only


getInformatValue

public double getInformatValue(java.lang.String informatValue,
                               java.lang.String informatName)
                        throws java.lang.IllegalStateException
Deprecated. use
   SASFormat fmt = SASFormat.getInstance("DATE7.");       
   double d = ((SASDateTimeFormat)fmt).informat("25dec05"));
   

Throws:
java.lang.IllegalStateException



Copyright © 2009 SAS Institute Inc. All Rights Reserved.