Esempio n. 1
0
  public static EditableTableComponent instance(
      RequestContext context, String id, TableComponent table) {
    Locale locale = context.getLocale();
    ResourceBundle resb = ResourceBundle.getBundle("com.tonbeller.wcf.table.resources", locale);
    String path = PluginUtils.getPluginDir() + "/ui/resources/wcf/tableproperties.xml";

    /*
    URL url = null;
    try {
    //	url = ResourceLocator.getResource(context.getServletContext(),
    			//locale, path);
    	url = context.getServletContext().getResource(path);
    } catch (Exception e) {
    	e.printStackTrace();
    	throw new SoftException(e);
    }
    */
    // Document doc = XmlUtils.parse(url);
    Document doc = null;
    try {
      doc = XmlUtils.parse(new File(path).toURL());
    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    // In replaceI18n(...) wird geprüft, ob "bundle"-Attribut vorhanden
    FormDocument.replaceI18n(context, doc, null);

    TablePropertiesFormComponent formComp =
        new TablePropertiesFormComponent(id + ".form", null, doc, table);
    formComp.setVisible(false);
    formComp.setCloseable(true);
    return new EditableTableComponent(id, null, table, formComp);
  }
Esempio n. 2
0
  protected Document parseDocument(RequestContext context, String xmlUri)
      throws MalformedURLException, MissingResourceException {

    Locale loc = Resources.instance().getLocaleContextHolderLocale();
    if (loc == null) {
      loc = context.getLocale(); // Default: browser setting
    }
    URL url = ResourceLocator.getResource(context.getServletContext(), loc, xmlUri);

    Document document = XmlUtils.parse(url);
    // In replaceI18n(...) it is examined whether "bundle" - attribute available
    I18nReplacer replacer = I18nReplacer.instance(Resources.instance(getClass()));
    if (replacer != null) {
      replacer.replaceAll(document);
    } else {
      FormDocument.replaceI18n(context, document, getBundle());
    }

    return document;
  }
Esempio n. 3
0
 /** @see junit.framework.TestCase#setUp() */
 protected void setUp() throws Exception {
   doc = XmlUtils.createDocument();
   elm = doc.createElement("elm");
   doc.appendChild(elm);
 }