BrightSide Workbench Full Report + Source Code
org.turro.www.starit.StarItCtrl Class Reference

Public Member Functions

 StarItCtrl (IConstructor constructor)
 
void setEntityPath (String entityPath)
 
void setReadOnly (boolean readOnly)
 
void renderTemplateStars (boolean container)
 
void renderStars (boolean container)
 
String getStarsUrl (String id, Integer i)
 
int getMaxRating ()
 

Detailed Description

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

Definition at line 34 of file StarItCtrl.java.

Constructor & Destructor Documentation

◆ StarItCtrl()

org.turro.www.starit.StarItCtrl.StarItCtrl ( IConstructor  constructor)

Definition at line 42 of file StarItCtrl.java.

42  {
43  this.constructor = constructor;
44  }

Member Function Documentation

◆ getMaxRating()

int org.turro.www.starit.StarItCtrl.getMaxRating ( )

Definition at line 98 of file StarItCtrl.java.

98  {
99  return maxRating;
100  }

◆ getStarsUrl()

String org.turro.www.starit.StarItCtrl.getStarsUrl ( String  id,
Integer  i 
)

Definition at line 91 of file StarItCtrl.java.

91  {
92  return "$.post(\"" + ElephantContext.getRootWebPath() + "/xpaction/contact\"," +
93  "{ action: \"star-it\", path: \"" + entityPath + "\"" +
94  ", stars: " + i + ", domid: \"" + id + "\" })" +
95  ".done(function(data) { $(\"#" + id + "\").html(data); });";
96  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderStars()

void org.turro.www.starit.StarItCtrl.renderStars ( boolean  container)

Definition at line 66 of file StarItCtrl.java.

66  {
67  if(ElephantMarker.existsTemplate(constructor, false, "widgets/webcomp", "starIt")) {
68  renderTemplateStars(container);
69  return;
70  }
71  StarsInfo si = StarItUtil.stars(entityPath);
72  html = new HTMLHelper(constructor);
73  String id = container ? "sic_" + IdGenerator.generate() : constructor.getParameter("domid");
74  if(container) {
75  html.startTag("div", "id='" + id + "'");
76  }
77  html.startTable("class='starit-container'");
78  for(int star = 1; star <= 5; star++) {
79  html.startTableCol("")
80  .startTag("a", readOnly ? "" : "onClick='" + getStarsUrl(id, star) + "'")
81  .doTag("img", "src='" + ElephantContext.getRootWebPath() +
82  "/_internal/system/images/star_" + (star <= si.getStars() ? "color" : "bn") + ".png'")
83  .endTag();
84  }
85  html.endTableRow()
86  .startTableCol("colspan='5' class='starit-string'")
87  .write(si.count + " " + I_.get("review(s)"));
88  html.endAllTags();
89  }
HTMLGenerator write(String value)
HTMLGenerator doTag(String tag)
HTMLGenerator startTag(String tag)
HTMLGenerator startTableCol(String attributes)
HTMLGenerator startTable(String attributes)
void renderTemplateStars(boolean container)
Definition: StarItCtrl.java:54
String getStarsUrl(String id, Integer i)
Definition: StarItCtrl.java:91
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderTemplateStars()

void org.turro.www.starit.StarItCtrl.renderTemplateStars ( boolean  container)

Definition at line 54 of file StarItCtrl.java.

54  {
55  String id = container ? "sic_" + IdGenerator.generate() : constructor.getParameter("domid");
56  ElephantMarker em = new ElephantMarker(constructor);
57  em.put("control", this);
58  em.put("controlId", id);
59  em.put("container", container);
60  em.put("info", StarItUtil.stars(entityPath));
61  em.put("entityPath", entityPath);
62  em.put("readOnly", readOnly);
63  em.process("widgets/webcomp", "starIt");
64  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEntityPath()

void org.turro.www.starit.StarItCtrl.setEntityPath ( String  entityPath)

Definition at line 46 of file StarItCtrl.java.

46  {
47  this.entityPath = entityPath;
48  }
Here is the caller graph for this function:

◆ setReadOnly()

void org.turro.www.starit.StarItCtrl.setReadOnly ( boolean  readOnly)

Definition at line 50 of file StarItCtrl.java.

50  {
51  this.readOnly = readOnly;
52  }

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