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.AbstractUIImage; 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 an image beside a tree node. 044 * UIComponent class, generated from template {@code component1.2.stg} with class 045 * {@link org.apache.myfaces.tobago.internal.taglib.component.TreeIconTagDeclaration}. 046 */ 047 public class UITreeIcon 048 extends AbstractUIImage implements SupportsMarkup { 049 050 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.TreeIcon"; 051 052 private org.apache.myfaces.tobago.context.Markup markup; 053 private org.apache.myfaces.tobago.layout.Measure marginLeft; 054 private org.apache.myfaces.tobago.layout.Measure minimumHeight; 055 private java.lang.String tip; 056 private org.apache.myfaces.tobago.layout.Measure height; 057 private org.apache.myfaces.tobago.layout.Measure minimumWidth; 058 private java.lang.Integer rowSpan; 059 private org.apache.myfaces.tobago.layout.Measure left; 060 private java.lang.Integer columnSpan; 061 private org.apache.myfaces.tobago.layout.Measure maximumHeight; 062 private org.apache.myfaces.tobago.layout.Measure top; 063 private org.apache.myfaces.tobago.layout.Measure currentWidth; 064 private org.apache.myfaces.tobago.layout.Measure marginTop; 065 private org.apache.myfaces.tobago.layout.Measure marginRight; 066 private org.apache.myfaces.tobago.layout.Measure width; 067 private org.apache.myfaces.tobago.layout.Measure currentHeight; 068 private org.apache.myfaces.tobago.layout.Measure preferredHeight; 069 private org.apache.myfaces.tobago.layout.Display display; 070 private org.apache.myfaces.tobago.layout.Measure maximumWidth; 071 private org.apache.myfaces.tobago.layout.Measure preferredWidth; 072 private org.apache.myfaces.tobago.layout.Measure marginBottom; 073 private java.lang.Integer verticalIndex; 074 private org.apache.myfaces.tobago.context.Markup currentMarkup; 075 private java.lang.Integer horizontalIndex; 076 private java.lang.Boolean disabled; 077 078 079 public org.apache.myfaces.tobago.context.Markup getMarkup() { 080 if (markup != null) { 081 return markup; 082 } 083 ValueExpression ve = getValueExpression("markup"); 084 if (ve != null) { 085 try { 086 Object object = ve.getValue(getFacesContext().getELContext()); 087 return Markup.valueOf(object); 088 } catch (ELException e) { 089 throw new FacesException(e); 090 } 091 } 092 return null; 093 } 094 095 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) { 096 this.markup = markup; 097 } 098 099 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() { 100 if (marginLeft != null) { 101 return marginLeft; 102 } 103 ValueExpression ve = getValueExpression("marginLeft"); 104 if (ve != null) { 105 try { 106 Object object = ve.getValue(getFacesContext().getELContext()); 107 return Measure.valueOf(object); 108 } catch (ELException e) { 109 throw new FacesException(e); 110 } 111 } 112 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this); 113 } 114 115 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) { 116 this.marginLeft = marginLeft; 117 } 118 119 public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() { 120 if (minimumHeight != null) { 121 return minimumHeight; 122 } 123 ValueExpression ve = getValueExpression("minimumHeight"); 124 if (ve != null) { 125 try { 126 Object object = ve.getValue(getFacesContext().getELContext()); 127 return Measure.valueOf(object); 128 } catch (ELException e) { 129 throw new FacesException(e); 130 } 131 } 132 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this); 133 } 134 135 public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) { 136 this.minimumHeight = minimumHeight; 137 } 138 139 /** 140 Text value to display as tooltip. 141 142 */ 143 public java.lang.String getTip() { 144 if (tip != null) { 145 return tip; 146 } 147 ValueExpression ve = getValueExpression("tip"); 148 if (ve != null) { 149 try { 150 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 151 } catch (ELException e) { 152 throw new FacesException(e); 153 } 154 } 155 return null; 156 } 157 158 public void setTip(java.lang.String tip) { 159 this.tip = tip; 160 } 161 162 /** 163 This value will usually be set by the layout manager. 164 165 */ 166 public org.apache.myfaces.tobago.layout.Measure getHeight() { 167 if (height != null) { 168 return height; 169 } 170 ValueExpression ve = getValueExpression("height"); 171 if (ve != null) { 172 try { 173 Object object = ve.getValue(getFacesContext().getELContext()); 174 return Measure.valueOf(object); 175 } catch (ELException e) { 176 throw new FacesException(e); 177 } 178 } 179 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this); 180 } 181 182 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) { 183 this.height = height; 184 } 185 186 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() { 187 if (minimumWidth != null) { 188 return minimumWidth; 189 } 190 ValueExpression ve = getValueExpression("minimumWidth"); 191 if (ve != null) { 192 try { 193 Object object = ve.getValue(getFacesContext().getELContext()); 194 return Measure.valueOf(object); 195 } catch (ELException e) { 196 throw new FacesException(e); 197 } 198 } 199 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this); 200 } 201 202 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) { 203 this.minimumWidth = minimumWidth; 204 } 205 206 public java.lang.Integer getRowSpan() { 207 if (rowSpan != null) { 208 return rowSpan; 209 } 210 ValueExpression ve = getValueExpression("rowSpan"); 211 if (ve != null) { 212 try { 213 Number number = (Number) ve.getValue(getFacesContext().getELContext()); 214 if (number != null) { 215 return number.intValue(); 216 } 217 } catch (ELException e) { 218 throw new FacesException(e); 219 } 220 } 221 return 1; 222 } 223 224 public void setRowSpan(java.lang.Integer rowSpan) { 225 this.rowSpan = rowSpan; 226 } 227 228 /** 229 This value will usually be set by the layout manager. 230 231 */ 232 public org.apache.myfaces.tobago.layout.Measure getLeft() { 233 if (left != null) { 234 return left; 235 } 236 ValueExpression ve = getValueExpression("left"); 237 if (ve != null) { 238 try { 239 Object object = ve.getValue(getFacesContext().getELContext()); 240 return Measure.valueOf(object); 241 } catch (ELException e) { 242 throw new FacesException(e); 243 } 244 } 245 return null; 246 } 247 248 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) { 249 this.left = left; 250 } 251 252 public java.lang.Integer getColumnSpan() { 253 if (columnSpan != null) { 254 return columnSpan; 255 } 256 ValueExpression ve = getValueExpression("columnSpan"); 257 if (ve != null) { 258 try { 259 Number number = (Number) ve.getValue(getFacesContext().getELContext()); 260 if (number != null) { 261 return number.intValue(); 262 } 263 } catch (ELException e) { 264 throw new FacesException(e); 265 } 266 } 267 return 1; 268 } 269 270 public void setColumnSpan(java.lang.Integer columnSpan) { 271 this.columnSpan = columnSpan; 272 } 273 274 public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() { 275 if (maximumHeight != null) { 276 return maximumHeight; 277 } 278 ValueExpression ve = getValueExpression("maximumHeight"); 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())).getMaximumHeight(getFacesContext(), this); 288 } 289 290 public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) { 291 this.maximumHeight = maximumHeight; 292 } 293 294 /** 295 This value will usually be set by the layout manager. 296 297 */ 298 public org.apache.myfaces.tobago.layout.Measure getTop() { 299 if (top != null) { 300 return top; 301 } 302 ValueExpression ve = getValueExpression("top"); 303 if (ve != null) { 304 try { 305 Object object = ve.getValue(getFacesContext().getELContext()); 306 return Measure.valueOf(object); 307 } catch (ELException e) { 308 throw new FacesException(e); 309 } 310 } 311 return null; 312 } 313 314 public void setTop(org.apache.myfaces.tobago.layout.Measure top) { 315 this.top = top; 316 } 317 318 /** 319 This value will usually be set by the layout manager. It holds the current width computed by the layout manager. 320 321 */ 322 public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() { 323 if (currentWidth != null) { 324 return currentWidth; 325 } 326 ValueExpression ve = getValueExpression("currentWidth"); 327 if (ve != null) { 328 try { 329 Object object = ve.getValue(getFacesContext().getELContext()); 330 return Measure.valueOf(object); 331 } catch (ELException e) { 332 throw new FacesException(e); 333 } 334 } 335 return getWidth(); 336 } 337 338 public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) { 339 this.currentWidth = currentWidth; 340 } 341 342 public org.apache.myfaces.tobago.layout.Measure getMarginTop() { 343 if (marginTop != null) { 344 return marginTop; 345 } 346 ValueExpression ve = getValueExpression("marginTop"); 347 if (ve != null) { 348 try { 349 Object object = ve.getValue(getFacesContext().getELContext()); 350 return Measure.valueOf(object); 351 } catch (ELException e) { 352 throw new FacesException(e); 353 } 354 } 355 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this); 356 } 357 358 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) { 359 this.marginTop = marginTop; 360 } 361 362 public org.apache.myfaces.tobago.layout.Measure getMarginRight() { 363 if (marginRight != null) { 364 return marginRight; 365 } 366 ValueExpression ve = getValueExpression("marginRight"); 367 if (ve != null) { 368 try { 369 Object object = ve.getValue(getFacesContext().getELContext()); 370 return Measure.valueOf(object); 371 } catch (ELException e) { 372 throw new FacesException(e); 373 } 374 } 375 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this); 376 } 377 378 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) { 379 this.marginRight = marginRight; 380 } 381 382 /** 383 This value will usually be set by the layout manager. 384 385 */ 386 public org.apache.myfaces.tobago.layout.Measure getWidth() { 387 if (width != null) { 388 return width; 389 } 390 ValueExpression ve = getValueExpression("width"); 391 if (ve != null) { 392 try { 393 Object object = ve.getValue(getFacesContext().getELContext()); 394 return Measure.valueOf(object); 395 } catch (ELException e) { 396 throw new FacesException(e); 397 } 398 } 399 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this); 400 } 401 402 public void setWidth(org.apache.myfaces.tobago.layout.Measure width) { 403 this.width = width; 404 } 405 406 /** 407 This value will usually be set by the layout manager. It holds the current height computed by the layout manager. 408 409 */ 410 public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() { 411 if (currentHeight != null) { 412 return currentHeight; 413 } 414 ValueExpression ve = getValueExpression("currentHeight"); 415 if (ve != null) { 416 try { 417 Object object = ve.getValue(getFacesContext().getELContext()); 418 return Measure.valueOf(object); 419 } catch (ELException e) { 420 throw new FacesException(e); 421 } 422 } 423 return getHeight(); 424 } 425 426 public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) { 427 this.currentHeight = currentHeight; 428 } 429 430 public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() { 431 if (preferredHeight != null) { 432 return preferredHeight; 433 } 434 ValueExpression ve = getValueExpression("preferredHeight"); 435 if (ve != null) { 436 try { 437 Object object = ve.getValue(getFacesContext().getELContext()); 438 return Measure.valueOf(object); 439 } catch (ELException e) { 440 throw new FacesException(e); 441 } 442 } 443 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this); 444 } 445 446 public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) { 447 this.preferredHeight = preferredHeight; 448 } 449 450 /** 451 This attribute is for internal use only. 452 453 */ 454 public org.apache.myfaces.tobago.layout.Display getDisplay() { 455 if (display != null) { 456 return display; 457 } 458 ValueExpression ve = getValueExpression("display"); 459 if (ve != null) { 460 try { 461 return (org.apache.myfaces.tobago.layout.Display) ve.getValue(getFacesContext().getELContext()); 462 } catch (ELException e) { 463 throw new FacesException(e); 464 } 465 } 466 return null; 467 } 468 469 public void setDisplay(org.apache.myfaces.tobago.layout.Display display) { 470 this.display = display; 471 } 472 473 public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() { 474 if (maximumWidth != null) { 475 return maximumWidth; 476 } 477 ValueExpression ve = getValueExpression("maximumWidth"); 478 if (ve != null) { 479 try { 480 Object object = ve.getValue(getFacesContext().getELContext()); 481 return Measure.valueOf(object); 482 } catch (ELException e) { 483 throw new FacesException(e); 484 } 485 } 486 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this); 487 } 488 489 public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) { 490 this.maximumWidth = maximumWidth; 491 } 492 493 public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() { 494 if (preferredWidth != null) { 495 return preferredWidth; 496 } 497 ValueExpression ve = getValueExpression("preferredWidth"); 498 if (ve != null) { 499 try { 500 Object object = ve.getValue(getFacesContext().getELContext()); 501 return Measure.valueOf(object); 502 } catch (ELException e) { 503 throw new FacesException(e); 504 } 505 } 506 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this); 507 } 508 509 public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) { 510 this.preferredWidth = preferredWidth; 511 } 512 513 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() { 514 if (marginBottom != null) { 515 return marginBottom; 516 } 517 ValueExpression ve = getValueExpression("marginBottom"); 518 if (ve != null) { 519 try { 520 Object object = ve.getValue(getFacesContext().getELContext()); 521 return Measure.valueOf(object); 522 } catch (ELException e) { 523 throw new FacesException(e); 524 } 525 } 526 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this); 527 } 528 529 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) { 530 this.marginBottom = marginBottom; 531 } 532 533 /** 534 This attribute is for internal use only. 535 536 */ 537 public java.lang.Integer getVerticalIndex() { 538 if (verticalIndex != null) { 539 return verticalIndex; 540 } 541 ValueExpression ve = getValueExpression("verticalIndex"); 542 if (ve != null) { 543 try { 544 Number number = (Number) ve.getValue(getFacesContext().getELContext()); 545 if (number != null) { 546 return number.intValue(); 547 } 548 } catch (ELException e) { 549 throw new FacesException(e); 550 } 551 } 552 return null; 553 } 554 555 public void setVerticalIndex(java.lang.Integer verticalIndex) { 556 this.verticalIndex = verticalIndex; 557 } 558 559 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() { 560 if (currentMarkup != null) { 561 return currentMarkup; 562 } 563 ValueExpression ve = getValueExpression("currentMarkup"); 564 if (ve != null) { 565 try { 566 Object object = ve.getValue(getFacesContext().getELContext()); 567 return Markup.valueOf(object); 568 } catch (ELException e) { 569 throw new FacesException(e); 570 } 571 } 572 return null; 573 } 574 575 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) { 576 this.currentMarkup = currentMarkup; 577 } 578 579 /** 580 This attribute is for internal use only. 581 582 */ 583 public java.lang.Integer getHorizontalIndex() { 584 if (horizontalIndex != null) { 585 return horizontalIndex; 586 } 587 ValueExpression ve = getValueExpression("horizontalIndex"); 588 if (ve != null) { 589 try { 590 Number number = (Number) ve.getValue(getFacesContext().getELContext()); 591 if (number != null) { 592 return number.intValue(); 593 } 594 } catch (ELException e) { 595 throw new FacesException(e); 596 } 597 } 598 return null; 599 } 600 601 public void setHorizontalIndex(java.lang.Integer horizontalIndex) { 602 this.horizontalIndex = horizontalIndex; 603 } 604 605 /** 606 Flag indicating that this element is disabled. 607 <br />Default: <code>false</code> 608 */ 609 public boolean isDisabled() { 610 if (disabled != null) { 611 return disabled; 612 } 613 ValueExpression ve = getValueExpression("disabled"); 614 if (ve != null) { 615 try { 616 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext()); 617 if (bool != null) { 618 return bool; 619 } 620 } catch (ELException e) { 621 throw new FacesException(e); 622 } 623 } 624 return false; 625 } 626 627 public void setDisabled(boolean disabled) { 628 this.disabled = disabled; 629 } 630 631 public void restoreState(FacesContext context, Object componentState) { 632 Object[] values = (Object[]) componentState; 633 super.restoreState(context, values[0]); 634 markup = (org.apache.myfaces.tobago.context.Markup) values[1]; 635 marginLeft = (org.apache.myfaces.tobago.layout.Measure) values[2]; 636 minimumHeight = (org.apache.myfaces.tobago.layout.Measure) values[3]; 637 tip = (java.lang.String) values[4]; 638 height = (org.apache.myfaces.tobago.layout.Measure) values[5]; 639 minimumWidth = (org.apache.myfaces.tobago.layout.Measure) values[6]; 640 rowSpan = (java.lang.Integer) values[7]; 641 left = (org.apache.myfaces.tobago.layout.Measure) values[8]; 642 columnSpan = (java.lang.Integer) values[9]; 643 maximumHeight = (org.apache.myfaces.tobago.layout.Measure) values[10]; 644 top = (org.apache.myfaces.tobago.layout.Measure) values[11]; 645 currentWidth = (org.apache.myfaces.tobago.layout.Measure) values[12]; 646 marginTop = (org.apache.myfaces.tobago.layout.Measure) values[13]; 647 marginRight = (org.apache.myfaces.tobago.layout.Measure) values[14]; 648 width = (org.apache.myfaces.tobago.layout.Measure) values[15]; 649 currentHeight = (org.apache.myfaces.tobago.layout.Measure) values[16]; 650 preferredHeight = (org.apache.myfaces.tobago.layout.Measure) values[17]; 651 display = (org.apache.myfaces.tobago.layout.Display) values[18]; 652 maximumWidth = (org.apache.myfaces.tobago.layout.Measure) values[19]; 653 preferredWidth = (org.apache.myfaces.tobago.layout.Measure) values[20]; 654 marginBottom = (org.apache.myfaces.tobago.layout.Measure) values[21]; 655 verticalIndex = (java.lang.Integer) values[22]; 656 currentMarkup = (org.apache.myfaces.tobago.context.Markup) values[23]; 657 horizontalIndex = (java.lang.Integer) values[24]; 658 disabled = (java.lang.Boolean) values[25]; 659 } 660 661 public Object saveState(FacesContext context) { 662 Object[] values = new Object[26]; 663 values[0] = super.saveState(context); 664 values[1] = markup; 665 values[2] = marginLeft; 666 values[3] = minimumHeight; 667 values[4] = tip; 668 values[5] = height; 669 values[6] = minimumWidth; 670 values[7] = rowSpan; 671 values[8] = left; 672 values[9] = columnSpan; 673 values[10] = maximumHeight; 674 values[11] = top; 675 values[12] = currentWidth; 676 values[13] = marginTop; 677 values[14] = marginRight; 678 values[15] = width; 679 values[16] = currentHeight; 680 values[17] = preferredHeight; 681 values[18] = display; 682 values[19] = maximumWidth; 683 values[20] = preferredWidth; 684 values[21] = marginBottom; 685 values[22] = verticalIndex; 686 values[23] = currentMarkup; 687 values[24] = horizontalIndex; 688 values[25] = disabled; 689 return values; 690 } 691 692 693 }