BrightSide Workbench Full Report + Source Code
DefaultNavigatorItem.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2016 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.elephant.impl.navigation;
20 
21 import java.util.ArrayList;
22 import java.util.Collection;
23 
28 public class DefaultNavigatorItem implements NavigatorItem {
29 
30  private String name, url, description, target;
31  private boolean active;
32  private Collection<NavigatorItem> children;
33 
34  public DefaultNavigatorItem(String name, String url, String target) {
35  this(name, url, target, false);
36  }
37 
38  public DefaultNavigatorItem(String name, String url, String target, boolean active) {
39  this.name = name;
40  this.url = url;
41  this.target = target;
42  this.active = active;
43  }
44 
45  @Override
46  public String getName() {
47  return name;
48  }
49 
50  @Override
51  public String getUrl() {
52  return url;
53  }
54 
55  @Override
56  public String getTarget() {
57  return target;
58  }
59 
60  @Override
61  public boolean isActive() {
62  return active;
63  }
64 
65  @Override
66  public String getDescription() {
67  return description;
68  }
69 
70  public void setDescription(String description) {
71  this.description = description;
72  }
73 
74  @Override
75  public Collection<NavigatorItem> getChildren() {
76  return children;
77  }
78 
79  public void addChild(NavigatorItem item) {
80  if(children == null) {
81  children = new ArrayList<>();
82  }
83  children.add(item);
84  }
85 
86  @Override
87  public boolean getInPath() {
88  return false;
89  }
90 
91  @Override
92  public boolean getInRole() {
93  return true;
94  }
95 
96 }
DefaultNavigatorItem(String name, String url, String target, boolean active)
DefaultNavigatorItem(String name, String url, String target)