BrightSide Workbench Full Report + Source Code
org.turro.elephant.user.menu.DefaultUserMenu Class Referenceabstract
Inheritance diagram for org.turro.elephant.user.menu.DefaultUserMenu:
Collaboration diagram for org.turro.elephant.user.menu.DefaultUserMenu:

Public Member Functions

 DefaultUserMenu (String label, String image)
 
 DefaultUserMenu (String label, String image, String link)
 
 DefaultUserMenu (String label, String image, Function< IUserMenu, Boolean > command)
 
 DefaultUserMenu (String label, String image, int order)
 
 DefaultUserMenu (String label, String image, String link, int order)
 
 DefaultUserMenu (String id, String label, String image, Function< IUserMenu, Boolean > command, int order)
 
String getId ()
 
String getLabel ()
 
String getImage ()
 
int getOrder ()
 
String getLink ()
 
boolean isValid ()
 
boolean isCaption ()
 
boolean isOnlyLabel ()
 
boolean isOnlyImage ()
 
boolean isActive ()
 
IUserMenu getParent ()
 
Set< IUserMenugetChildren ()
 
IUserMenu addChild (IUserMenu menu)
 
boolean execute ()
 
void initMenu ()
 
int compareTo (IUserMenu o)
 
abstract boolean isInRole ()
 
abstract Object getDetail ()
 
boolean isHidden ()
 

Protected Member Functions

 DefaultUserMenu (String id, String label, String image, String link, Function< IUserMenu, Boolean > command, int order)
 
void setOrder (int order)
 

Protected Attributes

IUserMenu parent
 
Set< IUserMenuchildren
 
String id
 
int order
 
Function< IUserMenu, Boolean > command
 

Detailed Description

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

Definition at line 33 of file DefaultUserMenu.java.

Constructor & Destructor Documentation

◆ DefaultUserMenu() [1/7]

org.turro.elephant.user.menu.DefaultUserMenu.DefaultUserMenu ( String  label,
String  image 
)

Definition at line 41 of file DefaultUserMenu.java.

41  {
42  this(null, label, image, null, null, 0);
43  }
Here is the caller graph for this function:

◆ DefaultUserMenu() [2/7]

org.turro.elephant.user.menu.DefaultUserMenu.DefaultUserMenu ( String  label,
String  image,
String  link 
)

Definition at line 45 of file DefaultUserMenu.java.

45  {
46  this(null, label, image, link, null, 0);
47  }

◆ DefaultUserMenu() [3/7]

org.turro.elephant.user.menu.DefaultUserMenu.DefaultUserMenu ( String  label,
String  image,
Function< IUserMenu, Boolean >  command 
)

Definition at line 49 of file DefaultUserMenu.java.

49  {
50  this(null, label, image, null, command, 0);
51  }
Function< IUserMenu, Boolean > command

◆ DefaultUserMenu() [4/7]

org.turro.elephant.user.menu.DefaultUserMenu.DefaultUserMenu ( String  label,
String  image,
int  order 
)

Definition at line 53 of file DefaultUserMenu.java.

53  {
54  this(null, label, image, null, null, order);
55  }

◆ DefaultUserMenu() [5/7]

org.turro.elephant.user.menu.DefaultUserMenu.DefaultUserMenu ( String  label,
String  image,
String  link,
int  order 
)

Definition at line 57 of file DefaultUserMenu.java.

57  {
58  this(null, label, image, link, null, order);
59  }

◆ DefaultUserMenu() [6/7]

org.turro.elephant.user.menu.DefaultUserMenu.DefaultUserMenu ( String  id,
String  label,
String  image,
Function< IUserMenu, Boolean >  command,
int  order 
)

Definition at line 61 of file DefaultUserMenu.java.

61  {
62  this(id, label, image, null, command, order);
63  }

◆ DefaultUserMenu() [7/7]

org.turro.elephant.user.menu.DefaultUserMenu.DefaultUserMenu ( String  id,
String  label,
String  image,
String  link,
Function< IUserMenu, Boolean >  command,
int  order 
)
protected

Definition at line 65 of file DefaultUserMenu.java.

65  {
66  this.id = Strings.isBlank(id) ? (Strings.isBlank(label) ? Strings.asVar(image) : Strings.asVar(label)) : id;
67  this.label = label;
68  this.image = image;
69  this.link = link;
70  this.command = command;
71  this.order = order;
72  }

Member Function Documentation

◆ addChild()

IUserMenu org.turro.elephant.user.menu.DefaultUserMenu.addChild ( IUserMenu  menu)

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 139 of file DefaultUserMenu.java.

139  {
140  if(children == null) {
141  children = new TreeSet<>();
142  }
143  if(menu.isValid()) {
144  if((menu instanceof DefaultUserMenu) && menu.getOrder() == 0) {
145  ((DefaultUserMenu) menu).setOrder(children.size() + 1);
146  }
147  children.add(menu);
148  }
149  return menu;
150  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compareTo()

int org.turro.elephant.user.menu.DefaultUserMenu.compareTo ( IUserMenu  o)

Definition at line 167 of file DefaultUserMenu.java.

167  {
168  int result = CompareUtil.compare(order, o.getOrder());
169  if(result == 0) {
170  result = CompareUtil.compare(label, o.getLabel());
171  }
172  if(result == 0) {
173  result = CompareUtil.compare(id, o.getId());
174  }
175  return result;
176  }
Here is the call graph for this function:

◆ execute()

boolean org.turro.elephant.user.menu.DefaultUserMenu.execute ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 157 of file DefaultUserMenu.java.

157  {
158  return command.apply(this);
159  }

◆ getChildren()

Set<IUserMenu> org.turro.elephant.user.menu.DefaultUserMenu.getChildren ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 134 of file DefaultUserMenu.java.

134  {
135  return children;
136  }

◆ getDetail()

◆ getId()

String org.turro.elephant.user.menu.DefaultUserMenu.getId ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 75 of file DefaultUserMenu.java.

75  {
76  return id;
77  }

◆ getImage()

String org.turro.elephant.user.menu.DefaultUserMenu.getImage ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 85 of file DefaultUserMenu.java.

85  {
86  return image;
87  }

◆ getLabel()

String org.turro.elephant.user.menu.DefaultUserMenu.getLabel ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 80 of file DefaultUserMenu.java.

80  {
81  return label;
82  }

◆ getLink()

String org.turro.elephant.user.menu.DefaultUserMenu.getLink ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 95 of file DefaultUserMenu.java.

95  {
96  return link == null ? (command == null ? null : MenuCommand.createURL(this)) : link;
97  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOrder()

int org.turro.elephant.user.menu.DefaultUserMenu.getOrder ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 90 of file DefaultUserMenu.java.

90  {
91  return order;
92  }

◆ getParent()

IUserMenu org.turro.elephant.user.menu.DefaultUserMenu.getParent ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 129 of file DefaultUserMenu.java.

129  {
130  return parent;
131  }

◆ initMenu()

◆ isActive()

boolean org.turro.elephant.user.menu.DefaultUserMenu.isActive ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 121 of file DefaultUserMenu.java.

121  {
122  String currentPath = UserMenus.getActive();
123  return !Strings.isBlank(currentPath) &&
124  !Strings.isBlank(getLink()) &&
125  getLink().equals(currentPath);
126  }
Here is the call graph for this function:

◆ isCaption()

boolean org.turro.elephant.user.menu.DefaultUserMenu.isCaption ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 106 of file DefaultUserMenu.java.

106  {
107  return Strings.isBlank(link) && (command == null);
108  }

◆ isHidden()

boolean org.turro.elephant.user.menu.DefaultUserMenu.isHidden ( )

Definition at line 184 of file DefaultUserMenu.java.

184  {
185  return Document.from(ElephantContext.getRealPath("/WEB-INF/elephant/conf/hidden/" + this.getClass().getSimpleName())).exists();
186  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInRole()

◆ isOnlyImage()

boolean org.turro.elephant.user.menu.DefaultUserMenu.isOnlyImage ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 116 of file DefaultUserMenu.java.

116  {
117  return Strings.isBlank(label);
118  }

◆ isOnlyLabel()

boolean org.turro.elephant.user.menu.DefaultUserMenu.isOnlyLabel ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 111 of file DefaultUserMenu.java.

111  {
112  return Strings.isBlank(image);
113  }

◆ isValid()

boolean org.turro.elephant.user.menu.DefaultUserMenu.isValid ( )

Implements org.turro.elephant.user.menu.IUserMenu.

Definition at line 100 of file DefaultUserMenu.java.

100  {
101  return !Strings.isBlank(id) &&
102  !(Strings.isBlank(label) && Strings.isBlank(image));
103  }

◆ setOrder()

void org.turro.elephant.user.menu.DefaultUserMenu.setOrder ( int  order)
protected

Definition at line 152 of file DefaultUserMenu.java.

152  {
153  this.order = order;
154  }

Member Data Documentation

◆ children

Set<IUserMenu> org.turro.elephant.user.menu.DefaultUserMenu.children
protected

Definition at line 36 of file DefaultUserMenu.java.

◆ command

Function<IUserMenu, Boolean> org.turro.elephant.user.menu.DefaultUserMenu.command
protected

Definition at line 39 of file DefaultUserMenu.java.

◆ id

String org.turro.elephant.user.menu.DefaultUserMenu.id
protected

Definition at line 37 of file DefaultUserMenu.java.

◆ order

int org.turro.elephant.user.menu.DefaultUserMenu.order
protected

Definition at line 38 of file DefaultUserMenu.java.

◆ parent

IUserMenu org.turro.elephant.user.menu.DefaultUserMenu.parent
protected

Definition at line 35 of file DefaultUserMenu.java.


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