BrightSide Workbench Full Report + Source Code
org.turro.zkoss.svg.GanttResource Class Reference
Inheritance diagram for org.turro.zkoss.svg.GanttResource:
Collaboration diagram for org.turro.zkoss.svg.GanttResource:

Public Member Functions

GanttResourceData getData ()
 
void setData (GanttResourceData data)
 
void rule (int units)
 
void startComposing (String onUserEvent, String width, String height, double scale)
 
- Public Member Functions inherited from org.turro.zkoss.svg.Svg
void example ()
 
void generateContent (Map args)
 
void clear ()
 
void circle (int x, int y, int r)
 
void circle (int x, int y, int r, double opacity)
 
void circle (int x, int y, int r, String stroke, String strokeWidth, String fill, double opacity)
 
void line (int x1, int y1, int x2, int y2, String stroke, String strokeWidth)
 
void line (int x1, int y1, int x2, int y2, String stroke, String strokeWidth, double opacity)
 
void rectangle (int x, int y, int width, int height, String fill)
 
void rectangle (int x, int y, int width, int height, String fill, double opacity)
 
void rectangle (int x, int y, int width, int height, String fill, double opacity, String tooltip)
 
void roundRectangle (int x, int y, int width, int height, String fill)
 
void roundRectangle (int x, int y, int width, int height, String fill, double opacity)
 
void roundRectangle (int x, int y, int width, int height, String fill, double opacity, String tooltip)
 
void roundRectangle (int x, int y, int rx, int ry, int width, int height, String fill, double opacity)
 
void roundRectangle (int x, int y, int rx, int ry, int width, int height, String fill, double opacity, String tooltip)
 
void text (String text, int x, int y)
 
void text (String text, int x, int y, String tooltip)
 
void span (int x, int y, int width, int height, String fill, double opacity)
 
void roundSpan (int x, int y, int width, int height, String fill, double opacity)
 
void shadowedSpan (int x, int y, int width, int height, String fill, double opacity)
 
void shadowedRoundSpan (int x, int y, int width, int height, String fill, double opacity)
 
void shadowedLine (int x1, int y1, int x2, int y2, String stroke, String strokeWidth, double opacity)
 
void shadowedRectangle (int x, int y, int width, int height, String fill, double opacity)
 
void shadowedRoundRectangle (int x, int y, int width, int height, String fill, double opacity, String tooltip)
 
void setForceStyle (String forceStyle)
 
void setForceTransform (String forceTransform)
 
void setClickElementData (String clickElementData)
 
HTMLGenerator writeSeparator ()
 
HTMLGenerator writeNewLine ()
 
HTMLGenerator writeHorizontalStrut (int pixels)
 
HTMLGenerator write (String value)
 
HTMLGenerator startTag (String tag, String[] attributes)
 
HTMLGenerator startTag (String tag, String attributes)
 
HTMLGenerator startTag (String tag)
 
HTMLGenerator startTableRow (String[] attributes)
 
HTMLGenerator startTableRow (String attributes)
 
HTMLGenerator startTableCol (String[] attributes)
 
HTMLGenerator startTableCol (String attributes)
 
HTMLGenerator startTable (String[] attributes)
 
HTMLGenerator startTable (String attributes)
 
HTMLGenerator startJavaScript ()
 
HTMLGenerator startExtAnchor (String url, String hint)
 
HTMLGenerator startCSS ()
 
HTMLGenerator startAnchor (String url, String hint, String cssClass, String onClick)
 
HTMLGenerator startAnchor (String url, String hint, String cssClass)
 
HTMLGenerator startAnchor (String url, String hint)
 
void setOut (Writer out)
 
HTMLGenerator endTag (String tag)
 
HTMLGenerator endTag ()
 
HTMLGenerator endTableRow ()
 
HTMLGenerator endTableCol ()
 
HTMLGenerator endTable ()
 
HTMLGenerator endJavaScript ()
 
HTMLGenerator endCSS ()
 
HTMLGenerator endBeforeTag (String tag)
 
HTMLGenerator endAllTags ()
 
HTMLGenerator doTag (String tag, String[] attributes)
 
HTMLGenerator doTag (String tag, String attributes)
 
HTMLGenerator doTag (String tag)
 
boolean checkTag (String tag)
 
HTMLGenerator addJavaScriptLink (String jsFile)
 
HTMLGenerator addCSSLink (String cssFile)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 28 of file GanttResource.java.

Member Function Documentation

◆ getData()

GanttResourceData org.turro.zkoss.svg.GanttResource.getData ( )

Definition at line 41 of file GanttResource.java.

41  {
42  return data;
43  }

◆ rule()

void org.turro.zkoss.svg.GanttResource.rule ( int  units)

Definition at line 49 of file GanttResource.java.

49  {
50  String nunit = I_.byKey(measure.toString());
51  setForceStyle("font-size:10px");
52  text(nunit, taskPanelWidth - (nunit.length() * GanttResourceData.CHAR_PIXELS) - 5, RULE_HEIGHT + 6);
53  line(taskPanelWidth, 15, taskPanelWidth + (units * RULE_SPAN), 15, "#000", "1px");
54  for(int i = 0; i <= units; i++) {
55  line(taskPanelWidth + (i * RULE_SPAN), 15, taskPanelWidth + (i * RULE_SPAN), 20, "#000", "1px");
56  setForceStyle("font-size:10px");
57  text("" + i, taskPanelWidth + (i * RULE_SPAN) - 5, RULE_HEIGHT);
58  }
59  }
void setForceStyle(String forceStyle)
Definition: Svg.java:282
void line(int x1, int y1, int x2, int y2, String stroke, String strokeWidth)
Definition: Svg.java:108
void text(String text, int x, int y)
Definition: Svg.java:198
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setData()

void org.turro.zkoss.svg.GanttResource.setData ( GanttResourceData  data)

Definition at line 45 of file GanttResource.java.

45  {
46  this.data = data;
47  }

◆ startComposing()

void org.turro.zkoss.svg.GanttResource.startComposing ( String  onUserEvent,
String  width,
String  height,
double  scale 
)

Reimplemented from org.turro.zkoss.svg.Svg.

Definition at line 62 of file GanttResource.java.

62  {
63  measure = GanttMeasure.chooseMeasure(data.getMaxHoursLenght());
64  taskPanelWidth = data.getMaxNameLenght() * GanttResourceData.CHAR_PIXELS;
65  int maxUnits = (int) Math.ceil(measure.convert(data.getMaxHoursLenght()));
66  hoursPanelWidth = maxUnits * RULE_SPAN;
67 
68  if(width == null) {
69  width = "" + ((taskPanelWidth + (maxUnits * RULE_SPAN) + 20) * scale);
70  }
71  if(height == null) {
72  height = "" + (((data.size() * ITEM_SPAN) + RULE_HEIGHT + 20 + 28) * scale);
73  }
74  super.startComposing(onUserEvent, width, height, scale);
75 
76  startTag("n:g", new String[] {
77  "style='stroke:none'",
78  "font-size='13px'",
79  "font-style='normal'",
80  "font-family='Ubuntu'"
81  });
82 
83  rule(maxUnits);
84 
85  int lastType = -1;
86  int typeChange = 0;
87  int count = 0;
88  for(GanttResourceItem gi : data) {
89  count++;
90  gi.setPosition(count);
91  int x1 = (int) taskPanelWidth;
92  int dx2a = (int) (RULE_SPAN * measure.convert(gi.getExpected()));
93  int dx2b = (int) (RULE_SPAN * measure.convert(gi.getVariable()));
94  int y1 = (ITEM_SPAN * (gi.getPosition() - 1)) + ITEM_INIT + (typeChange * 14);
95  int dy2 = ITEM_HEIGHT;
96  if(!Strings.isBlank(gi.getUniqueId())) {
97  if(lastType != -1 && lastType != gi.getType()) {
98  typeChange++;
99  line(5, y1, 5 + taskPanelWidth + hoursPanelWidth, y1, "#dde", "3px");
100  y1 += (typeChange * 14);
101  }
102  lastType = gi.getType();
103  setForceStyle("cursor:pointer;");
104  setClickElementData("1:" + gi.getType() + ":" + gi.getUniqueId());
105  text(Strings.truncateAndWarn(gi.getName(), GanttResourceData.MAX_NAME_LENGTH), 15, y1 + 15);
106  setForceStyle("cursor:pointer;");
107  setClickElementData("1:" + gi.getType() + ":" + gi.getUniqueId());
108  shadowedRoundRectangle(x1, y1, dx2a, dy2, "#ff5555", 1, null);
109  setForceStyle("cursor:pointer;");
110  setClickElementData("2:" + gi.getType() + ":" + gi.getUniqueId());
111  shadowedRoundRectangle(x1 + dx2a, y1, dx2b, dy2, "#55ff55", 1, null);
112  }
113  }
114  }
void shadowedRoundRectangle(int x, int y, int width, int height, String fill, double opacity, String tooltip)
Definition: Svg.java:275
HTMLGenerator startTag(String tag, String[] attributes)
Definition: Svg.java:310
void setClickElementData(String clickElementData)
Definition: Svg.java:290
static GanttMeasure chooseMeasure(double hours)
double convert(double hours)
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: