1 33 34 package com.icesoft.faces.component.inputfile; 35 36 import com.icesoft.faces.component.CSS_DEFAULT; 37 import com.icesoft.faces.component.ext.taglib.Util; 38 import com.icesoft.faces.component.style.OutputStyle; 39 import com.icesoft.faces.context.BridgeFacesContext; 40 import com.icesoft.faces.util.CoreUtils; 41 import com.icesoft.faces.utils.MessageUtils; 42 import com.icesoft.faces.webapp.http.servlet.FileUploadComponent; 43 import com.icesoft.faces.webapp.xmlhttp.PersistentFacesState; 44 import org.apache.commons.fileupload.FileItemStream; 45 import org.apache.commons.fileupload.FileUploadBase; 46 import org.apache.commons.fileupload.util.Streams; 47 import org.apache.commons.logging.Log; 48 import org.apache.commons.logging.LogFactory; 49 50 import javax.faces.component.UICommand; 51 import javax.faces.component.UIComponent; 52 import javax.faces.context.FacesContext; 53 import javax.faces.context.ExternalContext; 54 import javax.faces.el.MethodBinding; 55 import javax.faces.el.ValueBinding; 56 import javax.faces.event.ActionEvent; 57 import javax.faces.event.ActionListener; 58 import javax.servlet.ServletContext ; 59 60 import java.io.File ; 61 import java.io.FileOutputStream ; 62 import java.io.IOException ; 63 import java.io.OutputStream ; 64 import java.io.Serializable ; 65 import java.io.Writer ; 66 import java.util.ArrayList ; 67 import java.util.EventObject ; 68 import java.util.Iterator ; 69 70 71 74 public class InputFile extends UICommand implements Serializable , FileUploadComponent { 75 private static final Log log = LogFactory.getLog(InputFile.class); 76 77 public static final int DEFAULT = 0; 78 public static final int UPLOADING = 1; 79 public static final int SAVED = 2; 80 public static final int INVALID = 3; 81 public static final int SIZE_LIMIT_EXCEEDED = 4; 82 public static final int UNKNOWN_SIZE = 5; 83 public static final int INVALID_NAME_PATTERN = 6; 84 85 public static final String INVALID_FILE_MESSAGE_ID = "com.icesoft.faces.component.inputfile.INVALID_FILE"; 86 public static final String INVALID_NAME_PATTERN_MESSAGE_ID = "com.icesoft.faces.component.inputfile.INVALID_NAME_PATTERN"; 87 public static final String SIZE_LIMIT_EXCEEDED_MESSAGE_ID = "com.icesoft.faces.component.inputfile.SIZE_LIMIT_EXCEEDED"; 88 public static final String UNKNOWN_SIZE_MESSAGE_ID = "com.icesoft.faces.component.inputfile.UNKNOWN_SIZE"; 89 90 public static final String FILE_UPLOAD_PREFIX = "fileUpload"; 91 private Boolean disabled; 92 private String style; 93 private String styleClass; 94 private String label; 95 private String enabledOnUserRole; 96 private String renderedOnUserRole; 97 private String title; 98 private int height = 30; 99 private int width = 500; 100 private int inputTextSize = 35; 101 private String inputTextClass; 102 private String fileNamePattern; 103 private boolean uniqueFolder = true; 104 private boolean uniqueFolderSet = false; 105 private String uploadDirectory; 106 private Boolean uploadDirectoryAbsolute; 107 private Throwable uploadException; 108 private int status = DEFAULT; 109 private FileInfo fileInfo = new FileInfo(); 110 private int progress = 0; 111 private File file; 112 private long sizeMax; 113 private MethodBinding progressListener; 114 115 119 public String getComponentType() { 120 return "com.icesoft.faces.File"; 121 } 122 123 127 public String getRendererType() { 128 return "com.icesoft.faces.Upload"; 129 } 130 131 135 public String getFamily() { 136 return "com.icesoft.faces.File"; 137 } 138 139 public void upload( 140 FileItemStream stream, 141 String uploadDirectory, 142 boolean uploadDirectoryAbsolute, 143 long maxSize, 144 BridgeFacesContext bfc, 145 ServletContext servletContext, 146 String sessionId) 147 throws IOException 148 { 149 this.uploadException = null; 150 this.status = UPLOADING; 151 this.sizeMax = maxSize; 152 FacesContext context = FacesContext.getCurrentInstance(); 153 String folder = getUploadDirectory(); 157 if(folder == null) { 158 folder = uploadDirectory; 159 } 160 Boolean folderAbs = getUploadDirectoryAbsolute(); 164 if(folderAbs == null) { 165 folderAbs = uploadDirectoryAbsolute ? Boolean.TRUE : Boolean.FALSE; 166 } 167 if(!folderAbs.booleanValue()) { 168 folder = servletContext.getRealPath(folder); 169 } 170 if(isUniqueFolder()) { 171 String FILE_SEPARATOR = System.getProperty("file.separator"); 172 folder = folder + FILE_SEPARATOR + sessionId; 173 } 174 175 String namePattern = getFileNamePattern().trim(); 176 String fileName = stream.getName(); 177 try { 178 if(fileName != null && fileName.length() > 0) { 179 File tempFileName = new File (fileName); 182 fileName = tempFileName.getName(); 183 } else { 184 throw new FileUploadBase.FileUploadIOException( 185 new FileUploadBase.InvalidContentTypeException()); 186 } 187 188 fileInfo.setFileName(fileName); 189 fileInfo.setContentType(stream.getContentType()); 190 if (fileName != null && fileName.trim().matches(namePattern)) { 191 File folderFile = new File (folder); 192 if(!folderFile.exists()) 193 folderFile.mkdirs(); 194 file = new File (folder, fileName); 195 OutputStream output = new FileOutputStream (file); 196 Streams.copy(stream.openStream(), output, true); 197 if (file.length() == 0 ) { 198 setProgress(0); 199 file.delete(); 200 throw new FileUploadBase.FileUploadIOException( 201 new FileUploadBase.InvalidContentTypeException()); 202 } 203 status = SAVED; 204 fileInfo.setPhysicalPath(file.getAbsolutePath()); 205 updateFileValueBinding(context); 206 notifyDone(bfc); 207 } else { 208 fileInfo.reset(); 209 file = null; 210 status = INVALID_NAME_PATTERN; 211 context.addMessage(null, MessageUtils.getMessage(context, INVALID_NAME_PATTERN_MESSAGE_ID, new Object [] { fileName, namePattern })); 212 notifyDone(bfc); 213 } 214 } catch (FileUploadBase.FileUploadIOException uploadException) { 215 this.uploadException = uploadException.getCause(); 216 try { 217 throw this.uploadException; 218 } catch (FileUploadBase.FileSizeLimitExceededException e) { 219 status = SIZE_LIMIT_EXCEEDED; 220 } catch (FileUploadBase.UnknownSizeException e) { 221 status = UNKNOWN_SIZE; 222 } catch (FileUploadBase.InvalidContentTypeException e) { 223 status = INVALID; 224 } catch (Throwable t) { 225 status = INVALID; 226 } 227 fileInfo.setException(uploadException); 228 if(file != null) 229 file.delete(); 230 notifyDone(bfc); 231 throw uploadException; 232 } 233 catch(IOException e) { this.uploadException = e; 235 status = INVALID; 236 fileInfo.setException(e); 237 if(file != null) 238 file.delete(); 239 notifyDone(bfc); 240 throw e; 241 } 242 243 PersistentFacesState.getInstance().renderLater(); 244 } 245 246 protected void notifyDone(BridgeFacesContext bfc) { 247 ActionEvent event = new ActionEvent(this); 248 249 bfc.setCurrentInstance(); 250 251 MethodBinding actionListener = getActionListener(); 253 if(actionListener != null) { 254 actionListener.invoke( 255 FacesContext.getCurrentInstance(), 256 new Object [] {event} ); 257 } 258 259 ActionListener[] actionListeners = getActionListeners(); 261 for (int i=0; i< actionListeners.length; i++) { 262 actionListeners[i].processAction(event); 263 } 264 MethodBinding action = getAction(); 265 if(action != null) { 266 action.invoke(FacesContext.getCurrentInstance(), null); 267 } 268 269 if(fileInfo != null) 270 fileInfo.reset(); 271 } 272 273 public void renderIFrame(Writer writer, BridgeFacesContext context) throws IOException { 274 writer.write("<html style=\"overflow:hidden;\">"); 275 ArrayList outputStyleComponents = findOutputStyleComponents(context.getViewRoot()); 276 if (outputStyleComponents != null) 277 { 278 writer.write("<head>"); 279 for (int i = 0; i < outputStyleComponents.size(); i++) 280 { 281 OutputStyle outputStyle = (OutputStyle) outputStyleComponents.get(i); 282 String href = outputStyle.getHref(); 283 if ((href != null) && (href.length() > 0)) 284 { 285 href = CoreUtils.resolveResourceURL(context, href); 286 writer.write("<link rel=\"stylesheet\" type=\"text/css\" HREF=\"" + href + "\">"); 287 } 288 } 289 writer.write("</head>"); 290 } 291 String srv = getUploadServletPath(context); 292 writer.write("<body style=\"background-color:transparent; overflow:hidden\"><form method=\"post\" action=\""+srv+"\" enctype=\"multipart/form-data\" id=\"fileUploadForm\">"); 293 writer.write("<input type=\"hidden\" name=\"componentID\" value=\""); 294 writer.write(this.getClientId(context)); 295 writer.write("\"/>"); 296 writer.write("<input type=\"hidden\" name=\"viewNumber\""); 297 writer.write(" value=\"" + context.getViewNumber() + "\"/>"); 298 writer.write("<input type=\"file\" name=\"upload\""); 299 writer.write(" size=\"" + getInputTextSize() + "\""); 300 String inputTextClass = getInputTextClass(); 301 if (inputTextClass != null) writer.write(" class=\"" + inputTextClass + "\""); 302 String title = getTitle(); 303 if (title != null) writer.write(" title=\"" + title +"\""); 304 writer.write("/>"); 305 writer.write("<input type=\"submit\" value=\"" + getLabel() + "\""); 306 String buttonClass = getButtonClass(); 307 if (buttonClass != null) writer.write(" class=\"" + buttonClass + "\""); 308 if (isDisabled()) writer.write(" disabled=\"disabled\""); 309 writer.write("/>"); 310 writer.write("</form>"); 311 writer.write("</body></html>"); 312 } 313 314 private String getUploadServletPath(BridgeFacesContext context) { 315 String requestContextPath = null; 316 if(context != null) { 317 ExternalContext externalContext = context.getExternalContext(); 318 if(externalContext != null) { 319 requestContextPath = externalContext.getRequestContextPath(); 320 } 321 } 322 if(requestContextPath == null || requestContextPath.length() == 0) 323 return "./uploadHtml"; 324 else 325 return requestContextPath + "/uploadHtml"; 326 } 327 328 public Throwable getUploadException() { 329 return uploadException; 330 } 331 332 336 public void setLabel(String label) { 337 this.label = label; 338 } 339 340 344 public void setUniqueFolder(boolean uniqueFolder) { 345 if (uniqueFolder != this.uniqueFolder) { 346 this.uniqueFolder = uniqueFolder; 347 } 348 this.uniqueFolderSet = true; 349 } 350 351 355 public boolean isUniqueFolder() { 356 if (this.uniqueFolderSet) { 357 return (this.uniqueFolder); 358 } 359 ValueBinding vb = getValueBinding("uniqueFolder"); 360 if (vb != null) { 361 return (Boolean.TRUE.equals(vb.getValue(getFacesContext()))); 362 } 363 return true; 364 } 365 366 370 public String getLabel() { 371 if (label != null) { 372 return label; 373 } 374 ValueBinding vb = getValueBinding("label"); 375 return vb != null ? (String ) vb.getValue(getFacesContext()) : "Upload"; 376 } 377 378 381 public boolean isDisabled() { 382 if (!Util.isEnabledOnUserRole(this)) { 383 return true; 384 } else { 385 if (disabled != null) { 386 return disabled.booleanValue(); 387 } 388 ValueBinding vb = getValueBinding("disabled"); 389 Boolean boolVal = vb != null ? 390 (Boolean ) vb.getValue(getFacesContext()) : null; 391 return boolVal != null ? boolVal.booleanValue() : false; 392 393 } 394 395 } 396 397 400 public void setDisabled(boolean disabled) { 401 this.disabled = Boolean.valueOf(disabled); 402 } 403 404 407 public void setEnabledOnUserRole(String enabledOnUserRole) { 408 this.enabledOnUserRole = enabledOnUserRole; 409 } 410 411 414 public String getEnabledOnUserRole() { 415 if (enabledOnUserRole != null) { 416 return enabledOnUserRole; 417 } 418 ValueBinding vb = getValueBinding("enabledOnUserRole"); 419 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 420 } 421 422 423 public void setUploadDirectory(String uploadDirectory) { 424 this.uploadDirectory = uploadDirectory; 425 } 426 427 public String getUploadDirectory() { 428 if (uploadDirectory != null) { 429 return uploadDirectory; 430 } 431 ValueBinding vb = getValueBinding("uploadDirectory"); 432 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 433 } 434 435 public void setUploadDirectoryAbsolute(Boolean uploadDirectoryAbsolute) { 436 this.uploadDirectoryAbsolute = uploadDirectoryAbsolute; 437 } 438 439 public Boolean getUploadDirectoryAbsolute() { 440 if (uploadDirectoryAbsolute != null) { 441 return uploadDirectoryAbsolute; 442 } 443 ValueBinding vb = getValueBinding("uploadDirectoryAbsolute"); 444 return vb != null ? (Boolean ) vb.getValue(getFacesContext()) : null; 445 } 446 447 450 public void setRenderedOnUserRole(String renderedOnUserRole) { 451 this.renderedOnUserRole = renderedOnUserRole; 452 } 453 454 457 public String getRenderedOnUserRole() { 458 if (renderedOnUserRole != null) { 459 return renderedOnUserRole; 460 } 461 ValueBinding vb = getValueBinding("renderedOnUserRole"); 462 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 463 } 464 465 468 public boolean isRendered() { 469 if (!Util.isRenderedOnUserRole(this)) { 470 return false; 471 } 472 return super.isRendered(); 473 } 474 475 478 public void setStyle(String style) { 479 this.style = style; 480 } 481 482 485 public String getStyle() { 486 if (style != null) { 487 return style; 488 } 489 ValueBinding vb = getValueBinding("style"); 490 return vb != null ? (String ) vb.getValue(getFacesContext()) : 491 "border-collapse:collapse; border-spacing:0px; padding:0px;"; 492 } 493 494 497 public void setStyleClass(String styleClass) { 498 this.styleClass = styleClass; 499 } 500 501 504 public String getStyleClass() { 505 return Util.getQualifiedStyleClass(this, 506 styleClass, 507 CSS_DEFAULT.ICE_FILE_UPLOAD_BASE_CLASS, 508 "styleClass", 509 isDisabled()); 510 } 511 512 516 public Object saveState(FacesContext context) { 517 Object values[] = new Object [24]; 518 values[0] = super.saveState(context); 519 values[1] = disabled; 520 values[2] = style; 521 values[3] = styleClass; 522 values[4] = label; 523 values[5] = enabledOnUserRole; 524 values[6] = renderedOnUserRole; 525 values[7] = title; 526 values[8] = new Integer (height); 527 values[9] = new Integer (width); 528 values[10] = new Integer (inputTextSize); 529 values[11] = inputTextClass; 530 values[12] = fileNamePattern; 531 values[13] = uniqueFolder ? Boolean.TRUE : Boolean.FALSE; 532 values[14] = uniqueFolderSet ? Boolean.TRUE : Boolean.FALSE; 533 values[15] = uploadDirectory; 534 values[16] = uploadDirectoryAbsolute; 535 values[17] = uploadException; 536 values[18] = new Integer (status); 537 values[19] = fileInfo; 538 values[20] = new Integer (progress); 539 values[21] = file; 540 values[22] = new Long (sizeMax); 541 values[23] = saveAttachedState(context, progressListener); 542 return ((Object ) (values)); 543 } 544 545 549 public void restoreState(FacesContext context, Object state) { 550 Object values[] = (Object []) state; 551 super.restoreState(context, values[0]); 552 disabled = (Boolean ) values[1]; 553 style = (String ) values[2]; 554 styleClass = (String ) values[3]; 555 label = (String ) values[4]; 556 enabledOnUserRole = (String ) values[5]; 557 renderedOnUserRole = (String ) values[6]; 558 title = (String ) values[7]; 559 height = ((Integer ) values[8]).intValue(); 560 width = ((Integer ) values[9]).intValue(); 561 inputTextSize = ((Integer ) values[10]).intValue(); 562 inputTextClass = (String ) values[11]; 563 fileNamePattern = (String ) values[12]; 564 uniqueFolder = ((Boolean ) values[13]).booleanValue(); 565 uniqueFolderSet = ((Boolean ) values[14]).booleanValue(); 566 uploadDirectory = (String ) values[15]; 567 uploadDirectoryAbsolute = (Boolean ) values[16]; 568 uploadException = (Throwable ) values[17]; 569 status = ((Integer ) values[18]).intValue(); 570 fileInfo = (FileInfo) values[19]; 571 progress = ((Integer ) values[20]).intValue(); 572 file = (File ) values[21]; 573 sizeMax = ((Long ) values[22]).longValue(); 574 progressListener = (MethodBinding) restoreAttachedState(context, values[23]); 575 } 576 577 580 public void setTitle(String title) { 581 this.title = title; 582 } 583 584 587 public String getTitle() { 588 if (title != null) { 589 return title; 590 } 591 ValueBinding vb = getValueBinding("title"); 592 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 593 } 594 595 private String size = null; 597 598 601 public void setSize(String size) { 602 this.size = size; 603 } 604 605 608 public String getSize() { 609 if (size != null) { 610 return size; 611 } 612 ValueBinding vb = getValueBinding("size"); 613 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 614 } 615 616 617 public int getHeight() { 618 ValueBinding vb = getValueBinding("height"); 619 if (vb != null) { 620 Integer value = (Integer ) vb.getValue(getFacesContext()); 621 if (null == value) { 622 return height; 623 } 624 return (value.intValue()); 625 } else { 626 return (this.height); 627 } 628 } 629 630 public void setHeight(int height) { 631 this.height = height; 632 } 633 634 public int getWidth() { 635 ValueBinding vb = getValueBinding("width"); 636 if (vb != null) { 637 Integer value = (Integer ) vb.getValue(getFacesContext()); 638 if (null == value) { 639 return width; 640 } 641 return (value.intValue()); 642 } else { 643 return (this.width); 644 } 645 } 646 647 public void setWidth(int width) { 648 this.width = width; 649 } 650 651 public int getInputTextSize() { 652 ValueBinding vb = getValueBinding("inputTextSize"); 653 if (vb != null) { 654 Integer value = (Integer ) vb.getValue(getFacesContext()); 655 if (null == value) { 656 return inputTextSize; 657 } 658 return (value.intValue()); 659 } else { 660 return (this.inputTextSize); 661 } 662 } 663 664 public void setInputTextSize(int inputTextSize) { 665 this.inputTextSize = inputTextSize; 666 } 667 668 public String getFileNamePattern() { 669 if (fileNamePattern != null) { 670 return fileNamePattern; 671 } 672 ValueBinding vb = getValueBinding("fileNamePattern"); 673 return vb != null ? (String ) vb.getValue(getFacesContext()) : ".+"; 674 } 675 676 public void setFileNamePattern(String fileNamePattern) { 677 this.fileNamePattern = fileNamePattern; 678 } 679 680 681 public void setInputTextClass(String inputTextClass) { 682 this.inputTextClass = inputTextClass; 683 } 684 685 public String getInputTextClass() { 686 return Util.getQualifiedStyleClass(this, 687 inputTextClass, 688 CSS_DEFAULT.ICE_FILE_UPLOAD_DEFAULT_INPUT_TEXT_CLASS, 689 "inputTextClass", 690 isDisabled()); 691 } 692 693 private String buttonClass = null; 694 695 public void setButtonClass(String buttonClass) { 696 this.buttonClass = buttonClass; 697 } 698 699 public String getButtonClass() { 700 return Util.getQualifiedStyleClass(this, 701 buttonClass, 702 CSS_DEFAULT.ICE_FILE_UPLOAD_DEFAULT_BUTTON_CLASS, 703 "buttonClass", 704 isDisabled()); 705 } 706 707 boolean isRegister() { 708 return false; 709 } 710 711 public void setRegister(FacesContext facesContext) { 712 } 714 715 719 public FileInfo getFileInfo() { 720 return fileInfo; 721 } 722 723 void setFileInfo(FileInfo fileInfo) { 724 } 726 727 731 public File getFile() { 732 return file; 733 } 734 735 739 public void setFile(File file) { 740 } 742 743 748 protected void updateFileValueBinding(FacesContext context) { 749 try { 750 ValueBinding vb = getValueBinding("file"); 751 if(vb != null) 752 vb.setValue(context, getFile()); 753 } 754 catch(Exception e) { 755 log.warn("The InputFile's file attribute has a ValueBinding, whose value could not be set",e); 756 } 757 } 758 759 public int getStatus() { 760 return status; 761 } 762 763 768 public String getFilename() { 769 return fileInfo.getFileName(); 770 } 771 772 777 public void setFilename(String filename) { 778 fileInfo.setFileName(filename); 779 } 780 781 786 public long getFilesize() { 787 return fileInfo.getSize(); 788 } 789 790 794 public void setFilesize(long filesize) { 795 fileInfo.setSize(filesize); 796 } 797 798 public long getSizeMax() { 799 return sizeMax; 800 } 801 802 public MethodBinding getProgressListener() { 803 return progressListener; 804 } 805 806 public void setProgressListener(MethodBinding binding) { 807 progressListener = binding; 808 } 809 810 public int getProgress(){ 811 return progress; 812 } 813 814 public void setProgress(int i){ 815 816 progress = i; 817 fileInfo.setPercent(i); 818 if( getProgressListener() != null ) 819 getProgressListener().invoke(FacesContext.getCurrentInstance(), new Object [] {new EventObject (this)}); 820 } 821 822 public String getCssFile() { 823 return null; 824 } 825 826 private String getDisabled() { 827 return null; 828 } 829 830 private String getStyleClassString() { 831 return null; 832 } 833 834 private String getStyleString() { 835 return null; 836 } 837 838 private String getStyleInfo() { 839 return null; 840 } 841 private String getInputTextClassString() { 842 return null; 843 } 844 845 private String getButtonClassString() { 846 return null; 847 } 848 849 private String getTitleAsString(){ 850 return null; 851 } 852 853 private static ArrayList findOutputStyleComponents(UIComponent parent) { 854 ArrayList returnValue = null; 855 Iterator children = parent.getChildren().iterator(); 856 UIComponent childComponent = null; 857 while (children.hasNext()) { 858 childComponent = (UIComponent) children.next(); 859 if (childComponent instanceof OutputStyle) { 860 if (returnValue == null) { 861 returnValue = new ArrayList (); 862 } 863 returnValue.add(childComponent); 864 } 865 else { 866 ArrayList outputStyleComponents = findOutputStyleComponents(childComponent); 867 if (outputStyleComponents != null) { 868 if (returnValue == null) { 869 returnValue = outputStyleComponents; 870 } 871 else { 872 returnValue.add(outputStyleComponents); 873 } 874 } 875 } 876 } 877 return returnValue; 878 } 879 880 private String onfocus; 881 882 public void setOnfocus(String onfocus) { 883 this.onfocus = onfocus; 884 } 885 886 public String getOnfocus() { 887 if (onfocus != null) { 888 return onfocus; 889 } 890 ValueBinding vb = getValueBinding("onfocus"); 891 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 892 } 893 894 private String onchange; 895 896 public void setOnchange(String onchange) { 897 this.onchange = onchange; 898 } 899 900 public String getOnchange() { 901 if (onchange != null) { 902 return onchange; 903 } 904 ValueBinding vb = getValueBinding("onchange"); 905 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 906 } 907 908 private String accept; 909 910 public void setAccept(String accept) { 911 this.accept = accept; 912 } 913 914 public String getAccept() { 915 if (accept != null) { 916 return accept; 917 } 918 ValueBinding vb = getValueBinding("accept"); 919 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 920 } 921 922 private String accesskey; 923 924 public void setAccesskey(String accesskey) { 925 this.accesskey = accesskey; 926 } 927 928 public String getAccesskey() { 929 if (accesskey != null) { 930 return accesskey; 931 } 932 ValueBinding vb = getValueBinding("accesskey"); 933 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 934 } 935 936 private String onblur; 937 938 public void setOnblur(String onblur) { 939 this.onblur = onblur; 940 } 941 942 public String getOnblur() { 943 if (onblur != null) { 944 return onblur; 945 } 946 ValueBinding vb = getValueBinding("onblur"); 947 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 948 } 949 950 private String tabindex; 951 952 public void setTabindex(String tabindex) { 953 this.tabindex = tabindex; 954 } 955 956 public String getTabindex() { 957 if (tabindex != null) { 958 return tabindex; 959 } 960 ValueBinding vb = getValueBinding("tabindex"); 961 return vb != null ? (String ) vb.getValue(getFacesContext()) : null; 962 } 963 } 964 | Popular Tags |