001 // ---------- Attention: Generated code, please do not modify! ----------- 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one or more 005 * contributor license agreements. See the NOTICE file distributed with 006 * this work for additional information regarding copyright ownership. 007 * The ASF licenses this file to You under the Apache License, Version 2.0 008 * (the "License"); you may not use this file except in compliance with 009 * the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019 020 package org.apache.myfaces.tobago.component; 021 022 import javax.faces.context.FacesContext; 023 import org.apache.myfaces.tobago.context.Markup; 024 import org.apache.myfaces.tobago.internal.component.AbstractUIMenuBar; 025 import org.apache.myfaces.tobago.layout.Display; 026 import org.apache.myfaces.tobago.layout.Measure; 027 import org.apache.commons.lang.ArrayUtils; 028 import org.apache.commons.lang.StringUtils; 029 import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression; 030 import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding; 031 import org.apache.myfaces.tobago.internal.util.Deprecation; 032 import org.apache.myfaces.tobago.renderkit.MarginValues; 033 import org.apache.myfaces.tobago.renderkit.SpacingValues; 034 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer; 035 import javax.el.ELException; 036 import javax.faces.FacesException; 037 import java.util.ArrayList; 038 import java.util.List; 039 import javax.el.MethodExpression; 040 import javax.el.ValueExpression; 041 042 /** 043 Renders a menu bar.<br /> 044 Add menu bar as facet name="menuBar" to page tag or use it anywhere 045 on page.<br /> 046 * UIComponent class, generated from template {@code component1.2.stg} with class 047 * {@link org.apache.myfaces.tobago.internal.taglib.component.MenuBarTagDeclaration}. 048 */ 049 public class UIMenuBar 050 extends AbstractUIMenuBar implements SupportsMarkup { 051 052 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.MenuBar"; 053 054 private org.apache.myfaces.tobago.layout.Measure currentWidth; 055 private org.apache.myfaces.tobago.context.Markup markup; 056 private org.apache.myfaces.tobago.layout.Measure marginLeft; 057 private org.apache.myfaces.tobago.layout.Measure marginTop; 058 private org.apache.myfaces.tobago.layout.Measure width; 059 private org.apache.myfaces.tobago.layout.Measure marginRight; 060 private org.apache.myfaces.tobago.layout.Measure preferredHeight; 061 private org.apache.myfaces.tobago.layout.Measure currentHeight; 062 private org.apache.myfaces.tobago.layout.Display display; 063 private org.apache.myfaces.tobago.layout.Measure minimumHeight; 064 private org.apache.myfaces.tobago.layout.Measure maximumWidth; 065 private org.apache.myfaces.tobago.layout.Measure preferredWidth; 066 private org.apache.myfaces.tobago.layout.Measure marginBottom; 067 private org.apache.myfaces.tobago.layout.Measure height; 068 private java.lang.Integer verticalIndex; 069 private org.apache.myfaces.tobago.layout.Measure minimumWidth; 070 private org.apache.myfaces.tobago.context.Markup currentMarkup; 071 private java.lang.Integer rowSpan; 072 private java.lang.Integer horizontalIndex; 073 private org.apache.myfaces.tobago.layout.Measure left; 074 private java.lang.Integer columnSpan; 075 private org.apache.myfaces.tobago.layout.Measure top; 076 private org.apache.myfaces.tobago.layout.Measure maximumHeight; 077 078 079 /** 080 This value will usually be set by the layout manager. It holds the current width computed by the layout manager. 081 082 */ 083 public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() { 084 if (currentWidth != null) { 085 return currentWidth; 086 } 087 ValueExpression ve = getValueExpression("currentWidth"); 088 if (ve != null) { 089 try { 090 Object object = ve.getValue(getFacesContext().getELContext()); 091 return Measure.valueOf(object); 092 } catch (ELException e) { 093 throw new FacesException(e); 094 } 095 } 096 return getWidth(); 097 } 098 099 public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) { 100 this.currentWidth = currentWidth; 101 } 102 103 public org.apache.myfaces.tobago.context.Markup getMarkup() { 104 if (markup != null) { 105 return markup; 106 } 107 ValueExpression ve = getValueExpression("markup"); 108 if (ve != null) { 109 try { 110 Object object = ve.getValue(getFacesContext().getELContext()); 111 return Markup.valueOf(object); 112 } catch (ELException e) { 113 throw new FacesException(e); 114 } 115 } 116 return null; 117 } 118 119 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) { 120 this.markup = markup; 121 } 122 123 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() { 124 if (marginLeft != null) { 125 return marginLeft; 126 } 127 ValueExpression ve = getValueExpression("marginLeft"); 128 if (ve != null) { 129 try { 130 Object object = ve.getValue(getFacesContext().getELContext()); 131 return Measure.valueOf(object); 132 } catch (ELException e) { 133 throw new FacesException(e); 134 } 135 } 136 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this); 137 } 138 139 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) { 140 this.marginLeft = marginLeft; 141 } 142 143 public org.apache.myfaces.tobago.layout.Measure getMarginTop() { 144 if (marginTop != null) { 145 return marginTop; 146 } 147 ValueExpression ve = getValueExpression("marginTop"); 148 if (ve != null) { 149 try { 150 Object object = ve.getValue(getFacesContext().getELContext()); 151 return Measure.valueOf(object); 152 } catch (ELException e) { 153 throw new FacesException(e); 154 } 155 } 156 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this); 157 } 158 159 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) { 160 this.marginTop = marginTop; 161 } 162 163 /** 164 This value will usually be set by the layout manager. 165 166 */ 167 public org.apache.myfaces.tobago.layout.Measure getWidth() { 168 if (width != null) { 169 return width; 170 } 171 ValueExpression ve = getValueExpression("width"); 172 if (ve != null) { 173 try { 174 Object object = ve.getValue(getFacesContext().getELContext()); 175 return Measure.valueOf(object); 176 } catch (ELException e) { 177 throw new FacesException(e); 178 } 179 } 180 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this); 181 } 182 183 public void setWidth(org.apache.myfaces.tobago.layout.Measure width) { 184 this.width = width; 185 } 186 187 public org.apache.myfaces.tobago.layout.Measure getMarginRight() { 188 if (marginRight != null) { 189 return marginRight; 190 } 191 ValueExpression ve = getValueExpression("marginRight"); 192 if (ve != null) { 193 try { 194 Object object = ve.getValue(getFacesContext().getELContext()); 195 return Measure.valueOf(object); 196 } catch (ELException e) { 197 throw new FacesException(e); 198 } 199 } 200 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this); 201 } 202 203 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) { 204 this.marginRight = marginRight; 205 } 206 207 public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() { 208 if (preferredHeight != null) { 209 return preferredHeight; 210 } 211 ValueExpression ve = getValueExpression("preferredHeight"); 212 if (ve != null) { 213 try { 214 Object object = ve.getValue(getFacesContext().getELContext()); 215 return Measure.valueOf(object); 216 } catch (ELException e) { 217 throw new FacesException(e); 218 } 219 } 220 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this); 221 } 222 223 public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) { 224 this.preferredHeight = preferredHeight; 225 } 226 227 /** 228 This value will usually be set by the layout manager. It holds the current height computed by the layout manager. 229 230 */ 231 public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() { 232 if (currentHeight != null) { 233 return currentHeight; 234 } 235 ValueExpression ve = getValueExpression("currentHeight"); 236 if (ve != null) { 237 try { 238 Object object = ve.getValue(getFacesContext().getELContext()); 239 return Measure.valueOf(object); 240 } catch (ELException e) { 241 throw new FacesException(e); 242 } 243 } 244 return getHeight(); 245 } 246 247 public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) { 248 this.currentHeight = currentHeight; 249 } 250 251 /** 252 This attribute is for internal use only. 253 254 */ 255 public org.apache.myfaces.tobago.layout.Display getDisplay() { 256 if (display != null) { 257 return display; 258 } 259 ValueExpression ve = getValueExpression("display"); 260 if (ve != null) { 261 try { 262 return (org.apache.myfaces.tobago.layout.Display) ve.getValue(getFacesContext().getELContext()); 263 } catch (ELException e) { 264 throw new FacesException(e); 265 } 266 } 267 return null; 268 } 269 270 public void setDisplay(org.apache.myfaces.tobago.layout.Display display) { 271 this.display = display; 272 } 273 274 public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() { 275 if (minimumHeight != null) { 276 return minimumHeight; 277 } 278 ValueExpression ve = getValueExpression("minimumHeight"); 279 if (ve != null) { 280 try { 281 Object object = ve.getValue(getFacesContext().getELContext()); 282 return Measure.valueOf(object); 283 } catch (ELException e) { 284 throw new FacesException(e); 285 } 286 } 287 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this); 288 } 289 290 public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) { 291 this.minimumHeight = minimumHeight; 292 } 293 294 public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() { 295 if (maximumWidth != null) { 296 return maximumWidth; 297 } 298 ValueExpression ve = getValueExpression("maximumWidth"); 299 if (ve != null) { 300 try { 301 Object object = ve.getValue(getFacesContext().getELContext()); 302 return Measure.valueOf(object); 303 } catch (ELException e) { 304 throw new FacesException(e); 305 } 306 } 307 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this); 308 } 309 310 public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) { 311 this.maximumWidth = maximumWidth; 312 } 313 314 public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() { 315 if (preferredWidth != null) { 316 return preferredWidth; 317 } 318 ValueExpression ve = getValueExpression("preferredWidth"); 319 if (ve != null) { 320 try { 321 Object object = ve.getValue(getFacesContext().getELContext()); 322 return Measure.valueOf(object); 323 } catch (ELException e) { 324 throw new FacesException(e); 325 } 326 } 327 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this); 328 } 329 330 public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) { 331 this.preferredWidth = preferredWidth; 332 } 333 334 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() { 335 if (marginBottom != null) { 336 return marginBottom; 337 } 338 ValueExpression ve = getValueExpression("marginBottom"); 339 if (ve != null) { 340 try { 341 Object object = ve.getValue(getFacesContext().getELContext()); 342 return Measure.valueOf(object); 343 } catch (ELException e) { 344 throw new FacesException(e); 345 } 346 } 347 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this); 348 } 349 350 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) { 351 this.marginBottom = marginBottom; 352 } 353 354 /** 355 This value will usually be set by the layout manager. 356 357 */ 358 public org.apache.myfaces.tobago.layout.Measure getHeight() { 359 if (height != null) { 360 return height; 361 } 362 ValueExpression ve = getValueExpression("height"); 363 if (ve != null) { 364 try { 365 Object object = ve.getValue(getFacesContext().getELContext()); 366 return Measure.valueOf(object); 367 } catch (ELException e) { 368 throw new FacesException(e); 369 } 370 } 371 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this); 372 } 373 374 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) { 375 this.height = height; 376 } 377 378 /** 379 This attribute is for internal use only. 380 381 */ 382 public java.lang.Integer getVerticalIndex() { 383 if (verticalIndex != null) { 384 return verticalIndex; 385 } 386 ValueExpression ve = getValueExpression("verticalIndex"); 387 if (ve != null) { 388 try { 389 Number number = (Number) ve.getValue(getFacesContext().getELContext()); 390 if (number != null) { 391 return number.intValue(); 392 } 393 } catch (ELException e) { 394 throw new FacesException(e); 395 } 396 } 397 return null; 398 } 399 400 public void setVerticalIndex(java.lang.Integer verticalIndex) { 401 this.verticalIndex = verticalIndex; 402 } 403 404 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() { 405 if (minimumWidth != null) { 406 return minimumWidth; 407 } 408 ValueExpression ve = getValueExpression("minimumWidth"); 409 if (ve != null) { 410 try { 411 Object object = ve.getValue(getFacesContext().getELContext()); 412 return Measure.valueOf(object); 413 } catch (ELException e) { 414 throw new FacesException(e); 415 } 416 } 417 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this); 418 } 419 420 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) { 421 this.minimumWidth = minimumWidth; 422 } 423 424 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() { 425 if (currentMarkup != null) { 426 return currentMarkup; 427 } 428 return null; 429 } 430 431 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) { 432 this.currentMarkup = currentMarkup; 433 } 434 435 public java.lang.Integer getRowSpan() { 436 if (rowSpan != null) { 437 return rowSpan; 438 } 439 ValueExpression ve = getValueExpression("rowSpan"); 440 if (ve != null) { 441 try { 442 Number number = (Number) ve.getValue(getFacesContext().getELContext()); 443 if (number != null) { 444 return number.intValue(); 445 } 446 } catch (ELException e) { 447 throw new FacesException(e); 448 } 449 } 450 return 1; 451 } 452 453 public void setRowSpan(java.lang.Integer rowSpan) { 454 this.rowSpan = rowSpan; 455 } 456 457 /** 458 This attribute is for internal use only. 459 460 */ 461 public java.lang.Integer getHorizontalIndex() { 462 if (horizontalIndex != null) { 463 return horizontalIndex; 464 } 465 ValueExpression ve = getValueExpression("horizontalIndex"); 466 if (ve != null) { 467 try { 468 Number number = (Number) ve.getValue(getFacesContext().getELContext()); 469 if (number != null) { 470 return number.intValue(); 471 } 472 } catch (ELException e) { 473 throw new FacesException(e); 474 } 475 } 476 return null; 477 } 478 479 public void setHorizontalIndex(java.lang.Integer horizontalIndex) { 480 this.horizontalIndex = horizontalIndex; 481 } 482 483 /** 484 This value will usually be set by the layout manager. 485 486 */ 487 public org.apache.myfaces.tobago.layout.Measure getLeft() { 488 if (left != null) { 489 return left; 490 } 491 ValueExpression ve = getValueExpression("left"); 492 if (ve != null) { 493 try { 494 Object object = ve.getValue(getFacesContext().getELContext()); 495 return Measure.valueOf(object); 496 } catch (ELException e) { 497 throw new FacesException(e); 498 } 499 } 500 return null; 501 } 502 503 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) { 504 this.left = left; 505 } 506 507 public java.lang.Integer getColumnSpan() { 508 if (columnSpan != null) { 509 return columnSpan; 510 } 511 ValueExpression ve = getValueExpression("columnSpan"); 512 if (ve != null) { 513 try { 514 Number number = (Number) ve.getValue(getFacesContext().getELContext()); 515 if (number != null) { 516 return number.intValue(); 517 } 518 } catch (ELException e) { 519 throw new FacesException(e); 520 } 521 } 522 return 1; 523 } 524 525 public void setColumnSpan(java.lang.Integer columnSpan) { 526 this.columnSpan = columnSpan; 527 } 528 529 /** 530 This value will usually be set by the layout manager. 531 532 */ 533 public org.apache.myfaces.tobago.layout.Measure getTop() { 534 if (top != null) { 535 return top; 536 } 537 ValueExpression ve = getValueExpression("top"); 538 if (ve != null) { 539 try { 540 Object object = ve.getValue(getFacesContext().getELContext()); 541 return Measure.valueOf(object); 542 } catch (ELException e) { 543 throw new FacesException(e); 544 } 545 } 546 return null; 547 } 548 549 public void setTop(org.apache.myfaces.tobago.layout.Measure top) { 550 this.top = top; 551 } 552 553 public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() { 554 if (maximumHeight != null) { 555 return maximumHeight; 556 } 557 ValueExpression ve = getValueExpression("maximumHeight"); 558 if (ve != null) { 559 try { 560 Object object = ve.getValue(getFacesContext().getELContext()); 561 return Measure.valueOf(object); 562 } catch (ELException e) { 563 throw new FacesException(e); 564 } 565 } 566 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this); 567 } 568 569 public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) { 570 this.maximumHeight = maximumHeight; 571 } 572 573 public void restoreState(FacesContext context, Object componentState) { 574 Object[] values = (Object[]) componentState; 575 super.restoreState(context, values[0]); 576 currentWidth = (org.apache.myfaces.tobago.layout.Measure) values[1]; 577 markup = (org.apache.myfaces.tobago.context.Markup) values[2]; 578 marginLeft = (org.apache.myfaces.tobago.layout.Measure) values[3]; 579 marginTop = (org.apache.myfaces.tobago.layout.Measure) values[4]; 580 width = (org.apache.myfaces.tobago.layout.Measure) values[5]; 581 marginRight = (org.apache.myfaces.tobago.layout.Measure) values[6]; 582 preferredHeight = (org.apache.myfaces.tobago.layout.Measure) values[7]; 583 currentHeight = (org.apache.myfaces.tobago.layout.Measure) values[8]; 584 display = (org.apache.myfaces.tobago.layout.Display) values[9]; 585 minimumHeight = (org.apache.myfaces.tobago.layout.Measure) values[10]; 586 maximumWidth = (org.apache.myfaces.tobago.layout.Measure) values[11]; 587 preferredWidth = (org.apache.myfaces.tobago.layout.Measure) values[12]; 588 marginBottom = (org.apache.myfaces.tobago.layout.Measure) values[13]; 589 height = (org.apache.myfaces.tobago.layout.Measure) values[14]; 590 verticalIndex = (java.lang.Integer) values[15]; 591 minimumWidth = (org.apache.myfaces.tobago.layout.Measure) values[16]; 592 rowSpan = (java.lang.Integer) values[17]; 593 horizontalIndex = (java.lang.Integer) values[18]; 594 left = (org.apache.myfaces.tobago.layout.Measure) values[19]; 595 columnSpan = (java.lang.Integer) values[20]; 596 top = (org.apache.myfaces.tobago.layout.Measure) values[21]; 597 maximumHeight = (org.apache.myfaces.tobago.layout.Measure) values[22]; 598 } 599 600 public Object saveState(FacesContext context) { 601 Object[] values = new Object[23]; 602 values[0] = super.saveState(context); 603 values[1] = currentWidth; 604 values[2] = markup; 605 values[3] = marginLeft; 606 values[4] = marginTop; 607 values[5] = width; 608 values[6] = marginRight; 609 values[7] = preferredHeight; 610 values[8] = currentHeight; 611 values[9] = display; 612 values[10] = minimumHeight; 613 values[11] = maximumWidth; 614 values[12] = preferredWidth; 615 values[13] = marginBottom; 616 values[14] = height; 617 values[15] = verticalIndex; 618 values[16] = minimumWidth; 619 values[17] = rowSpan; 620 values[18] = horizontalIndex; 621 values[19] = left; 622 values[20] = columnSpan; 623 values[21] = top; 624 values[22] = maximumHeight; 625 currentMarkup = null; 626 return values; 627 } 628 629 630 }