1 19 20 21 package org.netbeans.modules.i18n.form; 22 23 24 import java.io.IOException ; 25 import java.lang.reflect.InvocationTargetException ; 26 import java.util.*; 27 import java.util.Iterator ; 28 import java.util.logging.Level ; 29 import java.util.logging.Logger ; 30 import javax.swing.JPanel ; 31 import javax.swing.SwingUtilities ; 32 import javax.swing.text.AbstractDocument ; 33 import javax.swing.text.BadLocationException ; 34 import javax.swing.text.Element ; 35 import javax.swing.text.Position ; 36 import javax.swing.text.StyledDocument ; 37 import org.netbeans.api.editor.guards.GuardedSection; 38 import org.netbeans.api.editor.guards.GuardedSectionManager; 39 40 import org.netbeans.modules.form.*; 41 import org.netbeans.modules.form.RADConnectionPropertyEditor.RADConnectionDesignValue; 42 import org.netbeans.modules.i18n.HardCodedString; 43 import org.netbeans.modules.i18n.I18nString; 44 import org.netbeans.modules.i18n.I18nSupport; 45 import org.netbeans.modules.i18n.InfoPanel; 46 import org.netbeans.modules.i18n.java.JavaI18nString; 47 import org.netbeans.modules.i18n.java.JavaI18nSupport; 48 49 import org.openide.loaders.DataObject; 50 import org.openide.nodes.Node; 51 import org.openide.NotifyDescriptor; 52 import org.openide.DialogDisplayer; 53 import org.openide.ErrorManager; 54 import org.openide.cookies.EditorCookie; 55 import org.openide.util.NbBundle; 56 57 58 63 public class FormI18nSupport extends JavaI18nSupport { 64 65 private static final String RAD_PROPERTIES = "properties"; private static final String RAD_PROPERTIES2 = "properties2"; private static final String RAD_ACCESSIBILITY = "accessibility"; private static final String RAD_LAYOUT = "layout"; 71 78 81 82 private FormI18nSupport(DataObject sourceDataObject) { 83 super(sourceDataObject); 84 } 85 86 87 88 protected I18nFinder createFinder() { 89 return new FormI18nFinder(sourceDataObject, document); 90 } 91 92 93 protected I18nReplacer createReplacer() { 94 return new FormI18nReplacer( (FormI18nFinder)getFinder()); 95 96 100 104 108 112 } 114 115 118 public JPanel getInfo(HardCodedString hcString) { 119 return new FormInfoPanel(hcString, document); 120 } 121 122 123 static String toAscii(String str) { 124 StringBuffer buf = new StringBuffer (str.length() * 6); char[] chars = str.toCharArray(); 127 for (int i = 0; i < chars.length; i++) { 128 char c = chars[i]; 129 switch (c) { 130 case '\b': buf.append("\\b"); break; case '\t': buf.append("\\t"); break; case '\n': buf.append("\\n"); break; case '\f': buf.append("\\f"); break; case '\r': buf.append("\\r"); break; case '\"': buf.append("\\\""); break; case '\\': buf.append("\\\\"); break; default: 139 if (c >= 0x0020 && c <= 0x007f) 140 buf.append(c); 141 else { 142 buf.append("\\u"); String hex = Integer.toHexString(c); 144 for (int j = 0; j < 4 - hex.length(); j++) 145 buf.append('0'); 146 buf.append(hex); 147 } 148 } 149 } 150 return buf.toString(); 151 } 152 153 155 private static class ValidFormProperty { 156 157 private Node.Property property; 158 159 160 private String radCompName; 161 162 167 private int skip; 168 169 170 171 public ValidFormProperty(String radCompName, Node.Property property) { 172 this.radCompName = radCompName; 173 this.property = property; 174 this.skip = 0; 175 } 176 177 178 public ValidFormProperty(ValidFormProperty validProperty) { 179 radCompName = validProperty.getRADComponentName(); 180 property = validProperty.getProperty(); 181 skip = validProperty.getSkip(); 182 } 183 184 185 186 public String getRADComponentName() { 187 return radCompName; 188 } 189 190 192 public Node.Property getProperty() { 193 return property; 194 } 195 196 198 public int getSkip() { 199 return skip; 200 } 201 202 203 public void incrementSkip() { 204 skip++; 205 } 206 207 208 public void decrementSkip() { 209 if(skip > 0) 210 skip--; 211 } 212 213 } 215 228 private static class ValidFormPropertyComparator implements Comparator { 229 230 private static final String CREATION_CODE_PRE = "creationCodePre"; private static final String CREATION_CODE_CUSTOM = "creationCodeCustom"; private static final String CREATION_CODE_POST = "creationCodePost"; 234 private static final String INIT_CODE_PRE = "initCodePre"; private static final String INIT_CODE_POST = "initCodePost"; 237 238 private final FormModel formModel; 239 240 241 242 public ValidFormPropertyComparator(FormDataObject formDataObject) { 243 formModel = formDataObject.getFormEditor().getFormModel(); 244 } 245 246 247 248 public int compare(Object o1, Object o2) { 249 String propName1 = ((ValidFormProperty)o1).getProperty().getName(); 251 String propName2 = ((ValidFormProperty)o2).getProperty().getName(); 252 253 boolean isInCreation1 = false; 254 boolean isInCreation2 = false; 255 256 if(propName1.equals(CREATION_CODE_PRE) || propName1.equals(CREATION_CODE_CUSTOM) || propName1.equals(CREATION_CODE_POST)) 257 isInCreation1 = true; 258 259 if(propName2.equals(CREATION_CODE_PRE) || propName2.equals(CREATION_CODE_CUSTOM) || propName2.equals(CREATION_CODE_POST)) 260 isInCreation2 = true; 261 262 if(isInCreation1 != isInCreation2) 263 return isInCreation1 ? -1 : 1; 265 RADComponent comp1 = formModel.findRADComponent(((ValidFormProperty)o1).getRADComponentName()); 267 RADComponent comp2 = formModel.findRADComponent(((ValidFormProperty)o2).getRADComponentName()); 268 269 int index1 = -1; 270 int index2 = -1; 271 272 if(!comp1.equals(comp2)) { 273 Iterator it = formModel.getOrderedComponentList().iterator(); 274 while (it.hasNext()) { 275 RADComponent comp = (RADComponent) it.next(); 276 if (comp == comp1) 277 return -1; 278 if (comp == comp2) 279 return 1; 280 } 281 assert false; 282 return 0; 283 } 285 if(isInCreation1) { 287 index1 = -1; 289 index2 = -1; 290 291 if(propName1.equals(CREATION_CODE_PRE)) index1 = 0; 292 else if(propName1.equals(CREATION_CODE_CUSTOM)) index1 = 1; 293 else if(propName1.equals(CREATION_CODE_POST)) index1 = 2; 294 295 if(propName2.equals(CREATION_CODE_PRE)) index2 = 0; 296 else if(propName2.equals(CREATION_CODE_CUSTOM)) index2 = 1; 297 else if(propName2.equals(CREATION_CODE_POST)) index2 = 2; 298 299 return index1 - index2; } else { 301 index1 = -1; 303 index2 = -1; 304 305 if(propName1.equals(INIT_CODE_PRE)) index1 = 0; 306 else if(propName1.equals(INIT_CODE_POST)) index1 = 2; 307 else index1 = 1; 309 if(propName2.equals(INIT_CODE_PRE)) index2 = 0; 310 else if(propName2.equals(INIT_CODE_POST)) index2 = 2; 311 else index2 = 1; 313 if (index1 != 1 || index2 != 1) 314 return index1 - index2; } 317 Node.PropertySet[] propSets = comp1.getProperties(); 319 Object [] properties = new Node.Property[0]; 320 321 ArrayList aList = new ArrayList(); 322 for(int i=0; i<propSets.length; i++) { 323 if(RAD_PROPERTIES.equals(propSets[i].getName()) 324 || RAD_PROPERTIES2.equals(propSets[i].getName()) 325 || RAD_LAYOUT.equals(propSets[i].getName()) 326 || RAD_ACCESSIBILITY.equals(propSets[i].getName())) { 327 aList.addAll(Arrays.asList(propSets[i].getProperties())); 328 } 329 } 330 properties = aList.toArray(); 331 332 index1 = -1; 333 index2 = -1; 334 335 Node.Property prop1 = ((ValidFormProperty)o1).getProperty(); 336 Node.Property prop2 = ((ValidFormProperty)o2).getProperty(); 337 338 for(int i=0; i<properties.length; i++) { 339 if(prop1.equals(properties[i])) 340 index1 = i; 341 342 if(prop2.equals(properties[i])) 343 index2 = i; 344 345 if(index1!=-1 && index2!=-1) 346 break; 347 } 348 349 return index1 - index2; } 352 } 354 355 356 private static class FormI18nFinder extends JavaI18nFinder { 357 358 private DataObject sourceDataObject; 359 360 361 private String componentName = ""; 363 364 private String propertyName = ""; 366 367 private TreeSet formProperties; 368 369 370 private ValidFormProperty lastFoundProp; 371 372 373 374 public FormI18nFinder(DataObject sourceDataObject, StyledDocument document) { 375 super(document); 376 this.sourceDataObject = sourceDataObject; 377 378 init(); 379 } 380 381 382 383 private void init() { 384 clearFormInfoValues(); 385 386 lastFoundProp = null; 387 388 createFormProperties(); 389 } 390 391 392 protected void reset() { 393 super.reset(); 394 395 init(); 396 } 397 398 399 void decrementLastFoundSkip() { 400 if(lastFoundProp != null) 401 lastFoundProp.decrementSkip(); 402 } 403 404 408 private synchronized boolean createFormProperties() { 409 formProperties = new TreeSet(new ValidFormPropertyComparator((FormDataObject)sourceDataObject)); 411 updateFormProperties(); 412 413 return true; 414 } 415 416 417 private synchronized void updateFormProperties() { 418 if(formProperties == null) 419 return; 420 421 Collection c = ((FormDataObject)sourceDataObject).getFormEditor().getFormModel().getAllComponents(); 423 Iterator it = c.iterator(); 424 425 while(it.hasNext()) { 427 RADComponent radComponent = (RADComponent)it.next(); 428 Node.PropertySet[] propSets = radComponent.getProperties(); 429 430 for(int i=0; i<propSets.length; i++) { 432 String setName = propSets[i].getName(); 433 if (false == (RAD_PROPERTIES.equals(setName) || RAD_PROPERTIES2.equals(setName) 435 || RAD_ACCESSIBILITY.equals(setName) || RAD_LAYOUT.equals(setName))) { 436 continue; 437 } 438 Node.Property[] properties = propSets[i].getProperties(); 439 440 for(int j=0; j<properties.length; j++) { 442 Node.Property property = properties[j]; 443 444 if (property.isHidden() 446 || !(property instanceof FormProperty) 447 || !((FormProperty)property).isChanged()) 448 continue; 449 450 Object value; 452 try { 453 value = property.getValue(); 454 } catch(IllegalAccessException iae) { 455 continue; } catch(InvocationTargetException ite) { 457 continue; } 459 460 if(value != null && (property.getValueType().equals(String .class) 463 || (value instanceof RADConnectionDesignValue 464 && ( ((RADConnectionDesignValue)value).getType() == RADConnectionDesignValue.TYPE_VALUE 465 || ((RADConnectionDesignValue)value).getType() == RADConnectionDesignValue.TYPE_CODE) 466 ) ) 467 ) { 468 formProperties.add(new ValidFormProperty(radComponent.getName(), property)); 471 } 472 } 473 } 474 } 475 } 476 477 478 protected HardCodedString findNextString() { 479 HardCodedString hcString; 481 482 clearFormInfoValues(); 483 484 boolean guarded = false; 485 486 do { 487 hcString = super.findNextString(); 488 489 if(i18nSearch) 491 return hcString; 492 493 if(hcString != null) { 494 guarded = isInGuardedSection(hcString.getStartPosition(), 495 hcString.getEndPosition()); 496 } else 497 break; 499 500 if(guarded) 501 hcString = findInForm(hcString); 502 503 } while(guarded && (hcString == null)); 505 506 511 return hcString; 512 } 513 514 515 private void clearFormInfoValues() { 516 componentName = ""; propertyName = ""; } 519 520 521 525 private synchronized HardCodedString findInForm(HardCodedString hcString) { 526 boolean found = false; 527 528 String hardString = hcString.getText(); 529 530 ValidFormProperty validProp = null; 532 533 Node.Property nodeProperty = null; 535 536 Iterator it; 537 538 if(lastFoundProp != null) { 539 validProp = lastFoundProp; 540 it = formProperties.tailSet(lastFoundProp).iterator(); 541 } else 542 it = formProperties.iterator(); 543 544 do { 545 if(validProp == null && it.hasNext()) 546 validProp = (ValidFormProperty)it.next(); 547 548 if(validProp == null) 549 break; 550 551 Node.Property property = validProp.getProperty(); 552 String radCompName = validProp.getRADComponentName(); 553 554 Object value; 556 try { 557 value = property.getValue(); 558 } catch(IllegalAccessException iae) { 559 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, iae); 560 validProp = null; 561 continue; } catch(InvocationTargetException ite) { 563 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ite); 564 validProp = null; 565 continue; } 567 568 if(value != null && (property.getValueType().equals(String .class) 571 || (value instanceof RADConnectionDesignValue 572 && ( ((RADConnectionDesignValue)value).getType() == RADConnectionDesignValue.TYPE_VALUE 573 || ((RADConnectionDesignValue)value).getType() == RADConnectionDesignValue.TYPE_CODE) 574 ) ) 575 ) { 576 577 String string; 578 579 if(property instanceof FormProperty) { 580 if(value instanceof FormI18nString) { 582 validProp = null; 584 continue; } else if (value instanceof RADConnectionDesignValue) { 586 string = ""; RADConnectionDesignValue connectionValue = (RADConnectionDesignValue)value; 589 if(connectionValue.getType() == RADConnectionDesignValue.TYPE_VALUE) { 590 string = connectionValue.getValue(); 592 593 if(indexOfNonI18nString(string, hardString, validProp.getSkip()) != -1) 594 found = true; 595 } else if (connectionValue.getType() == RADConnectionDesignValue.TYPE_CODE) { 596 string = connectionValue.getCode(); 598 599 if(indexOfNonI18nString(string, hardString, validProp.getSkip()) != -1) 600 found = true; 601 } 602 } else { 603 string = toAscii((String )value); 607 608 if(validProp.getSkip()==0 && string.equals(hardString)) 609 found = true; 610 } 611 } else { 612 string = (String )value; 614 615 if(indexOfNonI18nString(string, hardString, validProp.getSkip()) != -1) { 616 found = true; 618 } 619 } 620 } 621 if(found) { 622 nodeProperty = property; 623 componentName = radCompName; 624 propertyName = property.getName(); 625 626 break; 627 } else 628 validProp = null; 629 630 } while(it.hasNext()); 631 632 if(found) { 633 lastFoundProp = new ValidFormProperty(validProp); 634 lastFoundProp.incrementSkip(); 635 636 return new FormHardCodedString( 637 hcString.getText(), 638 hcString.getStartPosition(), 639 hcString.getEndPosition(), 640 validProp, 641 nodeProperty 642 ); 643 } else { 644 return null; 645 } 646 } 647 648 649 650 public Position getLastPosition() { 651 return lastPosition; 652 } 653 654 655 public void setLastPosition(Position lastPosition) { 656 super.lastPosition = lastPosition; 657 } 658 659 660 public int indexOfNonI18nString(String source, String hardString, int skip) { 661 int index = 0; 663 664 int startIndex=0; 666 667 while(true) { 668 int startString = source.indexOf('\"', startIndex); 670 671 if(startString == -1) 672 break; 673 674 int endString = source.indexOf('\"', startString+1); 676 677 int endLineIndex = source.indexOf('\n', startString+1); 678 679 if(endLineIndex == -1 || endString < endLineIndex) { 681 String foundString = source.substring(startString, endString+1); 683 684 String partLine; 686 687 int startLine = source.indexOf('\n', startIndex + 1); 689 if(startLine != -1 && startLine < startString) 690 startIndex = startLine + 1; 691 692 if(endLineIndex == -1) 693 partLine = source.substring(startIndex); 694 else { 695 int quote = source.indexOf('\"', endString+1); 696 697 if(quote != -1 && quote < endLineIndex) 699 partLine = source.substring(startIndex, quote) + source.substring(quote, endLineIndex).replace('\"','_'); 701 else 702 partLine = source.substring(startIndex, endLineIndex); 703 } 704 705 if(isSearchedString(partLine, foundString)) { 707 if(index == skip) { 709 if(foundString.equals("\""+hardString+"\"")) 710 return startString; 712 else 713 return -1; 715 } 716 717 index++; 718 } 719 720 startIndex = endString + 1; 722 } else 723 startIndex = endLineIndex + 1; 724 } 726 return -1; 727 } 728 729 738 private synchronized boolean isInGuardedSection(final Position startPos, 739 final Position endPos) { 740 EditorCookie editor = (EditorCookie) sourceDataObject.getCookie(EditorCookie.class); 741 StyledDocument doc = null; 742 GuardedSectionManager guards = null; 743 if (editor != null) { 744 try { 745 doc = editor.openDocument(); 746 } 747 catch (IOException ex) { 748 Logger.getLogger("global").log(Level.SEVERE, ex.getLocalizedMessage(), ex); 749 return false; 750 } 751 } 752 753 if (doc != null) { 754 guards = GuardedSectionManager.getInstance(doc); 755 } 756 757 if (guards != null) { 758 for (Iterator it = guards.getGuardedSections().iterator(); it.hasNext();) { 759 GuardedSection gsection = (GuardedSection) it.next(); 760 if (gsection.contains(startPos, true) || 761 gsection.contains(endPos, true)) { 762 return true; 763 } 764 } 765 766 } 767 return false; 768 } 769 770 DataObject getSourceDataObject() { 771 return sourceDataObject; 772 } 773 774 775 } 777 778 779 private static class FormI18nReplacer extends JavaI18nReplacer { 780 781 782 private FormI18nFinder finder; 783 784 private final ResourceBundle bundle; 785 786 787 public FormI18nReplacer(FormI18nFinder finder) { 788 this.finder = finder; 789 bundle = NbBundle.getBundle(FormI18nSupport.class); 790 } 791 792 793 794 public void replace(final HardCodedString hcString, final I18nString i18nString) { 795 if(hcString instanceof FormHardCodedString) { 796 replaceInGuarded((FormHardCodedString)hcString, (JavaI18nString)i18nString); 797 } else 798 super.replace(hcString, i18nString); 799 } 800 801 802 private void replaceInGuarded(FormHardCodedString formHcString, JavaI18nString javaI18nString) { 803 try { 804 String replaceString = javaI18nString.getReplaceString(); 805 806 int lastPos = ((FormI18nFinder)finder).getLastPosition().getOffset(); 808 809 int pos = formHcString.getEndPosition().getOffset(); 810 811 Object newValue; 813 814 Node.Property nodeProperty = formHcString.getNodeProperty(); 815 816 ValidFormProperty validProp = formHcString.getValidProperty(); 817 818 Object oldValue = nodeProperty.getValue(); 820 821 if(nodeProperty instanceof FormProperty) { 823 if(oldValue instanceof RADConnectionDesignValue 824 && ((RADConnectionDesignValue)oldValue).getType() == RADConnectionDesignValue.TYPE_CODE) { 825 String oldString = ((RADConnectionDesignValue)oldValue).getCode(); 828 829 StringBuffer buff = new StringBuffer (oldString); 830 831 int index = indexOfHardString(oldString, formHcString.getText(), validProp.getSkip()); 832 833 if (index == -1) { 834 NotifyDescriptor.Message message = new NotifyDescriptor.Message( 835 bundle.getString("MSG_StringNotFoundInGuarded"), NotifyDescriptor.ERROR_MESSAGE); 836 DialogDisplayer.getDefault().notify(message); 837 838 return; 839 } 840 841 int startOffset = index; 842 843 int endOffset = startOffset + formHcString.getText().length() + 2; 845 buff.replace(startOffset, endOffset, replaceString); 846 847 RADConnectionDesignValue newConnectionValue = new RADConnectionDesignValue(buff.toString()); 848 newValue = newConnectionValue; 849 } else { 850 ((FormProperty)nodeProperty).setCurrentEditor(new FormI18nStringEditor()); 854 newValue = new FormI18nString(javaI18nString); 855 } 856 } else { 857 String oldString = (String )oldValue; 860 StringBuffer buff = new StringBuffer (oldString); 861 862 int index = indexOfHardString(oldString, formHcString.getText(), validProp.getSkip()); 863 864 if(index == -1) { 865 NotifyDescriptor.Message message = new NotifyDescriptor.Message( 866 bundle.getString("MSG_StringNotFoundInGuarded"), NotifyDescriptor.ERROR_MESSAGE); 867 DialogDisplayer.getDefault().notify(message); 868 869 return; 870 } 871 872 int startOffset = index; 873 874 int endOffset = startOffset + formHcString.getText().length() + 2; 876 buff.replace(startOffset, endOffset, replaceString); 877 878 newValue = buff.toString(); 879 } 880 881 nodeProperty.setValue(newValue); 883 884 finder.decrementLastFoundSkip(); 886 887 final StyledDocument document = javaI18nString.getSupport().getDocument(); 888 889 int replaceStringLength = newValue instanceof FormI18nString ? 0 : replaceString.length(); 891 final int lastP = lastPos + replaceStringLength - formHcString.getText().length() - 2; SwingUtilities.invokeLater(new Runnable () { 893 public void run() { 894 if(document instanceof AbstractDocument ) 896 ((AbstractDocument )document).readLock(); 897 try { 898 ((FormI18nFinder)finder).setLastPosition(document.createPosition(lastP)); 899 } catch (BadLocationException ble) { 900 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ble); 901 } finally { 902 if(document instanceof AbstractDocument ) 903 ((AbstractDocument )document).readUnlock(); 904 } 905 } 906 }); 907 } catch (IllegalAccessException iae) { 908 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, iae); 909 } catch (InvocationTargetException ite) { 910 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ite); 911 } 912 } 913 914 915 private int indexOfHardString(String source, String hardString, int skip) { 916 while(skip >= 0) { 917 int index = finder.indexOfNonI18nString(source, hardString, skip); 918 if(index >= 0) 919 return index; 920 skip--; 921 } 922 923 return -1; 924 } 925 926 } 928 929 931 private static class FormHardCodedString extends HardCodedString { 932 933 934 private ValidFormProperty validProperty; 935 936 937 private Node.Property nodeProperty; 938 939 940 941 FormHardCodedString(String text, Position startPosition, Position endPosition, 942 ValidFormProperty validProperty, Node.Property nodeProperty) { 943 944 super(text, startPosition, endPosition); 945 this.validProperty = validProperty; 946 this.nodeProperty = nodeProperty; 947 } 948 949 950 951 public ValidFormProperty getValidProperty() { 952 return validProperty; 953 } 954 955 956 public Node.Property getNodeProperty() { 957 return nodeProperty; 958 } 959 960 } 962 963 964 private static class FormInfoPanel extends InfoPanel { 965 966 967 public FormInfoPanel(HardCodedString hcString, StyledDocument document) { 968 super(hcString, document); 969 } 970 971 972 973 protected void setHardCodedString(HardCodedString hcString, StyledDocument document) { 974 975 getStringText().setText(hcString == null ? "" : hcString.getText()); 977 int pos; 978 979 String hardLine; 980 981 if(hcString.getStartPosition() == null) 982 hardLine = ""; else { 984 pos = hcString.getStartPosition().getOffset(); 985 986 try { 987 Element paragraph = document.getParagraphElement(pos); 988 hardLine = document.getText(paragraph.getStartOffset(), paragraph.getEndOffset()-paragraph.getStartOffset()).trim(); 989 } catch (BadLocationException ble) { 990 hardLine = ""; } 992 } 993 994 getFoundInText().setText(hardLine); 995 996 if(hcString instanceof FormHardCodedString) { 997 getComponentText().setText( ((FormHardCodedString)hcString).getValidProperty().getRADComponentName()); 998 getPropertyText().setText( ((FormHardCodedString)hcString).getNodeProperty().getName()); 999 } else { 1000 remove(getComponentLabel()); 1001 remove(getComponentText()); 1002 remove(getPropertyLabel()); 1003 remove(getPropertyText()); 1004 } 1005 1006 } 1007 } 1009 1010 public static class Factory extends I18nSupport.Factory { 1011 1012 1013 public Factory() { 1014 } 1015 1016 1018 public I18nSupport create(DataObject dataObject) throws IOException { 1019 I18nSupport support = super.create(dataObject); 1020 1021 FormEditorSupport formSupport = ((FormDataObject)dataObject).getFormEditor(); 1022 if(formSupport.isOpened()) 1023 return support; 1024 1025 if(formSupport.loadForm()) 1026 return support; 1027 1028 throw new IOException ("I18N: Loading form for " + dataObject.getName() + " was not succesful."); } 1030 1031 1032 public I18nSupport createI18nSupport(DataObject dataObject) { 1033 return new FormI18nSupport(dataObject); 1034 } 1035 1036 1038 public Class getDataObjectClass() { 1039 return FormDataObject.class; 1040 } 1048 1049 } 1051} 1052 | Popular Tags |