示例#1
0
  static {
    PLAINHTML_SYNC_SERVICE =
        JavaScriptService.forResource("exxcellent.PlainHtml.Sync", "js/Sync.PlainHtml.js");

    /* Register JavaScriptService with the global service registry.*/
    WebContainerServlet.getServiceRegistry().add(PLAINHTML_SYNC_SERVICE);
  }
示例#2
0
/**
 * Rendering peer for the {@link echopoint.HtmlLayout} class.
 *
 * @author Simon Lei 2009-03-16
 * @version $Id$
 */
public class HtmlLayoutPeer extends AbstractHtmlComponentPeer {
  /** The component name for which this class is a peer. */
  private static final String COMPONENT_NAME = HtmlLayout.class.getName();

  /** The service for the client side peer for this component. */
  private static final Service COMPONENT_SERVICE =
      JavaScriptService.forResource(
          HtmlLayoutPeer.COMPONENT_NAME, "resource/js/Sync.HtmlLayout.js");

  /** Register the services */
  static {
    WebContainerServlet.getServiceRegistry().add(COMPONENT_SERVICE);
  }

  /** {@inheritDoc} */
  @Override
  public void init(final Context context, final Component component) {
    super.init(context, component);
    final ServerMessage serverMessage = (ServerMessage) context.get(ServerMessage.class);
    serverMessage.addLibrary(COMPONENT_NAME);
  }

  /** {@inheritDoc} */
  @Override
  public Class getComponentClass() {
    return HtmlLayout.class;
  }

  /** {@inheritDoc} */
  @Override
  public String getClientComponentType(final boolean shortType) {
    if (shortType) return "HL";
    return COMPONENT_NAME;
  }
}
示例#3
0
/** Synchronization peer for <code>OnLoadPeer</code>s. */
public class OnLoadPeer extends AbstractComponentSynchronizePeer
    implements ComponentSynchronizePeer {

  /** The associated client-side JavaScript module <code>Service</code>. */
  private static final Service ONLOAD_SERVICE =
      JavaScriptService.forResource(
          "UntzUntz.OnLoad", "com/untzuntz/components/resources/Sync.OnLoad.js");

  static {
    WebContainerServlet.getServiceRegistry().add(ONLOAD_SERVICE);
  }

  public OnLoadPeer() {
    super();

    addEvent(
        new EventPeer(OnLoad.INPUT_ACTION, OnLoad.ACTION_LISTENERS_CHANGED_PROPERTY) {
          public boolean hasListeners(Context context, Component c) {
            System.out.println("Has Action Listeners: " + ((OnLoad) c).hasActionListeners());
            return ((OnLoad) c).hasActionListeners();
          }
        });

    System.out.println("Initialized...");
  }

  /** @see nextapp.echo.webcontainer.ComponentSynchronizePeer#getClientComponentType(boolean) */
  public String getClientComponentType(boolean mode) {
    return mode ? "UOL" : "UntzUntz.OnLoad";
  }

  /** @see nextapp.echo.webcontainer.ComponentSynchronizePeer#getComponentClass() */
  @SuppressWarnings("rawtypes")
  public Class getComponentClass() {
    return OnLoad.class;
  }

  /**
   * @see nextapp.echo.webcontainer.ComponentSynchronizePeer#init(nextapp.echo.app.util.Context,
   *     Component)
   */
  public void init(Context context, Component component) {
    super.init(context, component);
    ServerMessage serverMessage = (ServerMessage) context.get(ServerMessage.class);
    serverMessage.addLibrary(ONLOAD_SERVICE.getId());
  }
}