56 boolean verbosePath =
false;
57 boolean hidden =
false;
58 boolean external =
false;
60 List<ElContext> result =
null;
61 String clickAction =
"", cssClass =
"";
62 while(currToken <
tokens.length && root !=
null) {
63 if(
"popup".equals(
tokens[currToken])) {
64 clickAction =
"popupElement('" + ElephantContext.getRootWebPath() +
"', $(this)); return false;";
67 else if(
"verbose".equals(
tokens[currToken])) {
70 else if(
"hidden".equals(
tokens[currToken])) {
73 else if(
"external".equals(
tokens[currToken])) {
76 else if(
"parent".equals(
tokens[currToken])) {
77 root = root.getParent();
79 else if(
"root".equals(
tokens[currToken])) {
80 root = ElContextMap.getContext(
"/");
82 else if(
"locate".equals(
tokens[currToken])) {
83 if(
tokens.length > currToken + 1) {
88 else if(
"match".equals(
tokens[currToken])) {
89 if(
tokens.length > currToken + 1) {
90 root = getSingleContextFrom(root,
tokens[currToken + 1]);
94 else if(
"level".equals(
tokens[currToken])) {
95 if(
tokens.length > currToken + 1) {
96 root = getLevelContextFrom(root,
tokens[currToken + 1]);
100 else if(
"children".equals(
tokens[currToken])) {
101 result =
new ArrayList(root.getChildren());
104 else if(
"all".equals(
tokens[currToken])) {
105 result = getAllFrom(root,
false);
108 else if(
"leaf".equals(
tokens[currToken])) {
109 result = getAllFrom(root,
true);
112 else if(
"ancestors".equals(
tokens[currToken])) {
113 result =
new ArrayList(root.getAncestors());
116 else if(
"siblings".equals(
tokens[currToken])) {
117 result =
new ArrayList(root.getSiblings());
120 else if(
"search".equals(
tokens[currToken])) {
121 if(
tokens.length > currToken + 1) {
122 result = getContextsFrom(root,
tokens[currToken + 1]);
126 else if(
"self".equals(
tokens[currToken])) {
127 result =
new ArrayList<>();
133 HTMLHelper hh =
new HTMLHelper(
out);
134 boolean list =
"list".equals(
tokens[0]);
135 if(result !=
null && !result.isEmpty()) {
137 hh.startTag(
"ul",
"class='m_list'");
138 }
else if(result.size() > 1) {
141 for(ElContext ctx : result) {
142 if(hidden || ctx.canDisplay()) {
147 hh.startExtAnchor(ctx.getWebPath(),
null);
149 if(Strings.isBlank(ctx.getTarget()) || !Strings.isBlank(clickAction)) {
150 hh.startAnchor(ctx.getWebPath(),
null, cssClass, clickAction);
152 hh.startTargetAnchor(ctx.getWebPath(), ctx.getTarget(),
null);
156 hh.write(ctx.getVerbosePath(root));
158 hh.write(ctx.getName());
163 }
else if(result.lastIndexOf(ctx) < result.size() - 1) {
168 if(!list && result.size() > 1) {
173 hh.startTag((list ?
"div" :
"span"),
"class='m_error'");
180 Navigator navigator =
new Navigator(root);
181 navigator.setDynamicLoad(
"dynamic".equals(ElephantContext.getContextLoad()));
182 if(
"location".equals(
getToken(1))) {
184 navigator.setType(NavigatorType.LOCATION);
185 navigator.initialize();
187 }
catch (IOException ex) {
188 Logger.getLogger(NavigationParser.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
190 }
else if(
"traversal".equals(
getToken(1))) {
192 navigator.setType(NavigatorType.TRAVERSAL);
193 navigator.setShowTitle((Boolean) ObjectString.parseNativeString(
getToken(2), Boolean.class,
true));
194 navigator.initialize();
196 }
catch (IOException ex) {
197 Logger.getLogger(NavigationParser.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
199 }
else if(
"options".equals(
getToken(1))) {
200 navigator.setType(NavigatorType.OPTIONS);
201 navigator.setDrawDecorators((Boolean) ObjectString.parseNativeString(
getToken(2), Boolean.class,
true));
202 navigator.setLevel((Integer) ObjectString.parseNativeString(
getToken(3), Integer.class,
true));
203 navigator.setPreloaded((Integer) ObjectString.parseNativeString(
getToken(4), Integer.class,
true));
204 navigator.setShowCurrent((Boolean) ObjectString.parseNativeString(
getToken(5), Boolean.class,
true));
205 navigator.initialize();
208 }
catch (IOException ex) {
209 Logger.getLogger(NavigationParser.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
211 }
else if(
"tabulator".equals(
getToken(1))) {
213 navigator.setType(NavigatorType.TABULATOR);
214 navigator.setLevel((Integer) ObjectString.parseNativeString(
getToken(2), Integer.class,
true));
215 navigator.initialize();
217 }
catch (IOException ex) {
218 Logger.getLogger(NavigationParser.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
225 wm.draw((Integer) ObjectString.parseNativeString(
getToken(1), Integer.class,
true));
226 }
catch (IOException ex) {
227 Logger.getLogger(CoreParser.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
String getToken(String name)
ElContext getRenderingContext()