Class DefaultOWThinlet

java.lang.Object
java.awt.Component
java.awt.Container
tripleo.vendor.thinlet.Thinlet
tripleo.vendor.thinlet.objectwrapper.DefaultOWThinlet
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Runnable, OWThinlet

public class DefaultOWThinlet extends Thinlet implements OWThinlet
The default OWThinlet implementation, directly based on thinlet.Thinlet, that manage the life cycle of Object Wrapper Component.

DefaultOWThinlet maintain a repository of related (Object wrapper - thinlet compoennt), and define the API required to retrieve OWObject from a given thinlet component.

Implementation Note:

  • With JDK < 1.3, all widget which are definitively removed from the hierachy must have it's conter part OWObject released by the OWObject.release() call, to avoid leak memory.
  • For JDK >= 1.3, the repository use a java.util.WeakHashMap, so explicit OWObject.release() is optional.
See Also:
  • Field Details

    • frepository

      protected final transient OWRepository frepository
  • Constructor Details

    • DefaultOWThinlet

      public DefaultOWThinlet()
      build a new OWThinlet, for managing Objecr Wrapper thinlet widget
  • Method Details

    • invoke

      protected boolean invoke(Object component, Object part, String event)
      overload to call the registered objectwrapper method
      Overrides:
      invoke in class Thinlet
      Parameters:
      component - the component to fire the event on, such as a textfield or table
      part - the part of the component, null for a textfield, the row for a table
      event - the event to send, such as 'action'
      Returns:
      true if a method object was fired
    • wrap

      @NotNull public @NotNull OWObject wrap(Object component)
      return a previously registered object wrapper from the given thinlet component, or build a new wrapper object, ans register it.
      Specified by:
      wrap in interface OWThinlet
    • register

      public void register(@NotNull @NotNull OWObject widget)
      register the given OWObject, as managed by the given thinlet
      Specified by:
      register in interface OWThinlet
    • unregister

      public void unregister(@NotNull @NotNull OWObject widget)
      unregister the given OWObject, as not managed by the given thinlet
      Specified by:
      unregister in interface OWThinlet
    • add

      public void add(@NotNull @NotNull OWWidget component)
      Adds the specified component to the root desktop
      Specified by:
      add in interface OWThinlet
      Parameters:
      component - a widget to be added
    • findObject

      public OWObject findObject(@NotNull @NotNull OWWidget component, @NotNull @NotNull String name)
      Finds the first component from the specified component by a name
      Specified by:
      findObject in interface OWThinlet
      Parameters:
      component - the widget is searched inside this component
      name - parameter value identifies the widget
      Returns:
      the first suitable component, or null
    • findObject

      public OWObject findObject(@NotNull @NotNull String name)
      Finds the first component from the root desktop by a specified name value
      Specified by:
      findObject in interface OWThinlet
      Parameters:
      name - parameter value identifies the widget
      Returns:
      the first suitable component, or null
    • parseAsObject

      public OWWidget parseAsObject(@NotNull @NotNull String path) throws IOException
      Creates a component (and its subcomponents, and properties) from the given xml resource
      Specified by:
      parseAsObject in interface OWThinlet
      Parameters:
      path - is relative to your thinlet instance or the classpath (if the path starts with an / character), or a full URL
      Returns:
      the root component of the parsed resource
      Throws:
      IOException
    • parseAsObject

      public OWWidget parseAsObject(@NotNull @NotNull String path, @NotNull @NotNull Object handler) throws IOException
      Creates a component from the given xml resource using the specified event handler
      Specified by:
      parseAsObject in interface OWThinlet
      Parameters:
      path - is relative to your application package or the classpath, or an URL
      handler - bussiness methods are implemented in this object
      Returns:
      the parsed components' root
      Throws:
      IOException
    • parseAsObject

      public OWWidget parseAsObject(@NotNull @NotNull InputStream inputstream) throws IOException
      Creates a component from the given stream
      Specified by:
      parseAsObject in interface OWThinlet
      Parameters:
      inputstream - e.g. new URL("http://myserver/myservlet").openStream()
      Returns:
      the root component of the parsed stream
      Throws:
      IOException
    • parseAsObject

      public OWWidget parseAsObject(@NotNull @NotNull InputStream inputstream, @NotNull @NotNull Object handler) throws IOException
      Creates a component from the given stream and event handler
      Specified by:
      parseAsObject in interface OWThinlet
      Parameters:
      inputstream - read xml from this stream
      handler - event handlers are implemented in this object
      Returns:
      the parsed components' root
      Throws:
      IOException
    • defineMethod

      public void defineMethod(Object component, String methodName, Method method)
      register the given method as named method on the given component
      Specified by:
      defineMethod in interface OWThinlet
    • setComponent

      public void setComponent(Object component, String key, Object widget)
      Description copied from interface: OWThinlet
      Issued from thinlet.Thinlet. Part of the thinlet like interface, required to have several ObjectWrapperThinlet implementation.
      Specified by:
      setComponent in interface OWThinlet