sourceforge > tacos
 

InlineEditBox

Provides ability to hover over a piece of text and dynamically edit it. Integrated from dojo toolkit.

See also: Live Demo

Parameters

Name Type Direction Required Default Description
direct boolean in no false Specifies whether to invoke listener directly or if the cycle should refresh on the entire page. (If ajax the refresh won't be shown). Use at your own risk, components contained by lists, like Foreach and For will likely not be directly updateable.
stateful boolean in no false Whether or not the request created by this component should be required to be stateful or not, default is false.
listener IActionListener no no   Specifies the listener that will be notified when the contents of this inline edit area are changed. The first parameter in the IRequestCycle will be the new value changed. This is optional, the value will be updated already.
value Object yes no   Specifies the binding/value that will be updated by changing the value of this area.

Body: not allowed

Informal parameters: allowed

Reserved parameters: none

Examples

Shows inline edit from demo

HTML template

          
<div id="notes">

  <div class="note" >
  <h2>Sample Text</h2>

  <p>
      This is a block of sample text.
      <div jwcid="editText">Dancing(edit me)</div> is fun.
  </p>
  </div>

</div>
          
        

Page specification

          
<page-specification class="net.sf.tacos.demo.pages.ajax.InlineEditBoxExample">

<description>Partial Page Rendering example with forms</description>

<property name="editedText" persist="session" initial-value="literal:Dancing"/>

<component id="editText" type="tacos:InlineEditBox" >
      <binding name="listener" value="listener:processEdit" />
      <binding name="value" value="ognl:editedText" />
      <binding name="direct" value="ognl:false" />
</component>

</page-specification>
          
        

Java sources

          
public abstract class InlineEditBox extends BasePage {

  /** Logger */
  private static final Log log = LogFactory.getLog(InlineEditBox.class);

  /**
   * Processes a newly selected value.
   * @param newValue
   */
  public void processEdit(String newValue)
  {
      log.debug("processEdit(" + newValue + ")");
      if (newValue != null) {
          setEditedText("--" + newValue + "--");
      }
  }

  /** Gets the value */
  public abstract String getEditedText();
  /** Sets the value */
  public abstract void setEditedText(String value);
}