EchoPoint API - 3.0.0b5
App Webcontainer

echopoint
Class HtmlLayout

java.lang.Object
  extended by nextapp.echo.app.Component
      extended by echopoint.internal.AbstractContainer
          extended by echopoint.internal.AbstractHtmlComponent
              extended by echopoint.HtmlLayout
All Implemented Interfaces:
Serializable, RenderIdSupport

public class HtmlLayout
extends AbstractHtmlComponent

A container component that uses user specified XHTML layout to render components. Provides a more flexible and powerful alternative to usual layout containers.

The following code shows sample use of this component:

  import echopoint.HtmlLayout;
  import echopoint.layout.HtmlLayoutData;
  import nextapp.echo.app.Button;
  import nextapp.echo.app.Component;
  import nextapp.echo.app.Label;

    ...
    final String text = "<table border='1'>" +
        "<tr>" +
        "<td colspan='2'>" +
        "This is regular HTML text in layout component!" +
        "</td>" +
        "</tr>" +
        "<tr>" +
         "<td id='one' colspan='2'></td>" +
         "</tr>" +
         "<tr>" +
         "<td id='two'></td>" +
         "<td id='three'></td>" +
         "</tr>" +
         "</table>";
    final HtmlLayout container = new HtmlLayout( text );
    Component child = new Button( "Button One" );

    // Layout data that specified that component is child of td with id one
    HtmlLayoutData layout = new HtmlLayoutData( "one" );
    child.setLayoutData( layout );
    container.add( child );

    child = new Label( "Label One" );
    layout = new HtmlLayoutData( "two" );
    child.setLayoutData( layout );
    container.add( child );

    child = new Label( "Label Two" );
    layout = new HtmlLayoutData( "three" );
    child.setLayoutData( layout );
    container.add( child );
    ...
    parent.add( container );
    ...
    final HtmlLayout fromFile = new HtmlLayout( "/tmp/test.html", "UTF-8" );
 

Since:
3.0.0a11
Version:
$Id: HtmlLayout.java 152 2009-04-19 21:53:22Z sptrakesh $
Author:
Simon Lei 2009-03-16
See Also:
Serialized Form

Field Summary
 
Fields inherited from class echopoint.internal.AbstractHtmlComponent
PROPERTY_TARGET, PROPERTY_TEXT
 
Fields inherited from class echopoint.internal.AbstractContainer
ACTION_COMMAND_PROPERTY, ACTION_LISTENERS_CHANGED_PROPERTY, INPUT_ACTION, PROPERTY_ALIGNMENT, PROPERTY_BACKGROUND_IMAGE, PROPERTY_BORDER, PROPERTY_HEIGHT, PROPERTY_INSETS, PROPERTY_WIDTH
 
Fields inherited from class nextapp.echo.app.Component
CHILD_VISIBLE_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_NEXT_ID_CHANGED_PROPERTY, FOCUS_PREVIOUS_ID_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
HtmlLayout()
          Default constructor.
HtmlLayout(InputStream instream, String charset)
          Create a new instance using the XHTML layout data specified in the input stream (file or resource usually).
HtmlLayout(String text)
          Create a new instance using the specified XHTML layout code.
 
Method Summary
 boolean isValidChild(Component component)
          Over-ridden to return true since this component allows children.
 void setTarget(String target)
          Over-ridden to make no-op.
 
Methods inherited from class echopoint.internal.AbstractHtmlComponent
append, getTarget, getText, setText
 
Methods inherited from class echopoint.internal.AbstractContainer
addActionListener, fireActionPerformed, getAlignment, getBackgroundImage, getBorder, getHeight, getInsets, getWidth, hasActionListeners, removeActionListener, setAlignment, setBackgroundImage, setBorder, setHeight, setInsets, setWidth
 
Methods inherited from class nextapp.echo.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, get, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusNextId, getFocusPreviousId, getFont, getForeground, getId, getIndex, getLayoutData, getLayoutDirection, getLocale, getLocalStyle, getParent, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidParent, isVisible, processInput, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, set, setBackground, setComponents, setEnabled, setFocusNextId, setFocusPreviousId, setFocusTraversalParticipant, setFont, setForeground, setId, setIndex, setLayoutData, setLayoutDirection, setLocale, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlLayout

public HtmlLayout()
Default constructor. Not particularly useful. You must invoke AbstractHtmlComponent.setText(java.lang.String) before the layout container is rendered to avoid a client-side exception.


HtmlLayout

public HtmlLayout(String text)
Create a new instance using the specified XHTML layout code.

Parameters:
text - The layout code to use to embed components.

HtmlLayout

public HtmlLayout(InputStream instream,
                  String charset)
           throws IOException
Create a new instance using the XHTML layout data specified in the input stream (file or resource usually).

Parameters:
instream - The input stream from which to read the XHTML layout data.
charset - The character set to use to read the input stream.
Throws:
IOException - If errors are encountered while reading the contents of the input stream.
Method Detail

isValidChild

public boolean isValidChild(Component component)
Over-ridden to return true since this component allows children.

Overrides:
isValidChild in class AbstractHtmlComponent
Parameters:
component - The component to check.
Returns:
Returns true.

setTarget

public void setTarget(String target)
Over-ridden to make no-op.

Overrides:
setTarget in class AbstractHtmlComponent
Parameters:
target - The value to set.

EchoPoint API - 3.0.0b5
App Webcontainer