package com.jaxfront.html.plugins;

import com.jaxfront.html.visualizers.SimpleTypeView;
import com.jaxfront.objectivehtml.htmlwidget.HtmlContainerWidget;
import com.jaxfront.objectivehtml.htmlwidget.HtmlPlainTextWidget;

/*-- 

 Copyright (C) 2001-2007 by xcentric technology & consulting GmbH. All rights reserved.

 This software is the confidential and proprietary information of xcentric technology & 
 consulting GmbH ("Confidential Information"). You shall not disclose such Confidential 
 Information and shall use it only in accordance with the terms of the license agreement
 you entered into with xcentric.

 www.jaxfront.com

 */
/**
 * Shows how to implement your own plugin for a simple component (leaf) using
 * plain HTML.
 
 @version 2.3
 */
public class SimpleTypePluginPlainHTMLExampleView extends SimpleTypeView {
  protected void createEditorComponent(HtmlContainerWidget container) {
    _component = new HtmlPlainTextWidget(container, getHTMLContent().toString());
  }

  public void populateView() {
    super.populateView();
    ((HtmlPlainTextWidget_component).setHTMLContent(getHTMLContent().toString());
  }

  public StringBuffer getHTMLContent() {
    StringBuffer sb = new StringBuffer();
    sb.append("<h1>Choose your favorite street!</h1>");
    sb.append("<p>");
    sb.append("<select name=\"" + getXPath() "\" size=\"3\" onblur=\"saveData(this)\">");
    String[] names = new String[] { "Nowhere Land""Palm Street""Example Street""Wall Street""Bahnhof Street" };
    String selected = "";
    for (int i = 0; i < names.length; i++) {
      if (getValue() != null && getValue().equals(names[i]))
        selected = "selected";
      else
        selected = "";
      sb.append("<option " + selected + " value=\"" + names[i"\">" + names[i"</option>");
    }
    sb.append("</select>");
    sb.append("</p>");
    return sb;
  }

  public void setSize(String size) {
    // do nothing
  }
}
  
Java2html