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);
  }
  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;
  }
  /** loads a form from an xml file and registeres it with the controller. */
  public Component createComponent(RequestContext context) throws JspException {
    try {

      Document doc = parseDocument(context, getXmlUri());

      // find the bean model
      Object bean = null;
      if (model != null) bean = context.getModelReference(model);

      // create the component
      FormComponent fc = createFormComponent(context, id, doc, bean);
      fc.setBookmarkable(bookmarkable);
      fc.setFinishButton(finishButton);

      registerWithWizard(fc);
      return fc;

    } catch (MalformedURLException e) {
      logger.error(null, e);
      throw new JspException(e);
    }
  }
 /** @see com.tonbeller.wcf.tags.ComponentTag#createComponent() */
 public Component createComponent(RequestContext context) throws JspException {
   CategoryModel cm;
   if (model != null) cm = (CategoryModel) context.getModelReference(getModel());
   else cm = new TestCategoryModel();
   return new CategoryEditor(getId(), null, cm);
 }