BrightSide Workbench Full Report + Source Code
org.turro.elephant.impl.navigation.WebMap Class Reference
Collaboration diagram for org.turro.elephant.impl.navigation.WebMap:

Public Member Functions

 WebMap (IConstructor constructor)
 
void draw () throws IOException
 
void draw (int maxLevels) throws IOException
 

Protected Attributes

IConstructor constructor
 
int maxLevels
 

Detailed Description

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

Definition at line 32 of file WebMap.java.

Constructor & Destructor Documentation

◆ WebMap()

org.turro.elephant.impl.navigation.WebMap.WebMap ( IConstructor  constructor)

Definition at line 37 of file WebMap.java.

37  {
38  this.constructor = constructor;
39  }

Member Function Documentation

◆ draw() [1/2]

void org.turro.elephant.impl.navigation.WebMap.draw ( ) throws IOException

Definition at line 41 of file WebMap.java.

41  {
42  draw(3);
43  }
Here is the caller graph for this function:

◆ draw() [2/2]

void org.turro.elephant.impl.navigation.WebMap.draw ( int  maxLevels) throws IOException

Definition at line 46 of file WebMap.java.

46  {
47  this.maxLevels = maxLevels;
48  HTMLHelper hp = new HTMLHelper(constructor);
49  ElContext root = ElContextMap.getRoot();
50  hp.startTable("cellspacing='5px' width='100%' class='wmap'");
51  hp.startTableRow("class='wmap'");
52  SortedSet<ElContext> ctxs = new ContextAdapter(root.getChildren()).getVisible();
53  int level = 0;
54  boolean hasSingles = false;
55  int ctxCount = 0;
56  for(ElContext ctx : ctxs) {
57  if(new ContextAdapter(ctx.getChildren()).getVisible().size() == 0) {
58  hasSingles = true;
59  } else {
60  ctxCount++;
61  }
62  }
63  if(hasSingles) {
64  ctxCount++;
65  }
66  for(ElContext ctx : ctxs) {
67  if(new ContextAdapter(ctx.getChildren()).getVisible().size() > 0) {
68  hp.startTableCol("style='width:" + ((int)Math.ceil(100 / ctxCount)) + "%'")
69  .startTag("ul", "class='wmap" + level + "'")
70  .startTag("li", "class='wmap" + level + "'")
71  .startAnchor(ctx.getWebPath(), ctx.getName(), "wmap" + level)
72  .write(ctx.getName())
73  .endTag();
74  doChildren(hp, ctx, level + 1);
75  hp.endTag("ul");
76  }
77  }
78  if(hasSingles) {
79  hp.startTableCol("style='width:" + ((int)Math.ceil(100 / ctxCount)) + "%'");
80  for(ElContext ctx : ctxs) {
81  if(new ContextAdapter(ctx.getChildren()).getVisible().size() == 0) {
82  hp.startTag("ul", "class='wmap" + level + "'")
83  .startTag("li", "class='wmap" + level + "'")
84  .startAnchor(ctx.getWebPath(), ctx.getName(), "wmap" + level)
85  .write(ctx.getName())
86  .endTag();
87  doChildren(hp, ctx, level + 1);
88  hp.endTag("ul");
89  }
90  }
91  }
92  hp.endAllTags();
93  }
Here is the call graph for this function:

Member Data Documentation

◆ constructor

IConstructor org.turro.elephant.impl.navigation.WebMap.constructor
protected

Definition at line 34 of file WebMap.java.

◆ maxLevels

int org.turro.elephant.impl.navigation.WebMap.maxLevels
protected

Definition at line 35 of file WebMap.java.


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