com.ibm.mashups.enabler.model
Interface LayoutModel

All Superinterfaces:
com.ibm.mashups.enabler.DirtyFlagProvider, Locator, Model, TreeModel, TreeModelController, WireModelProvider

public LayoutModel
extends TreeModelController, WireModelProvider, com.ibm.mashups.enabler.DirtyFlagProvider

This tree model exposes containers and controls. The following applies to the topology:

The layout model supports the following strategies:

See Also:
LayoutContainer, LayoutControl

Method Summary
 LayoutControl create(Object context)
           Creates a layout control.
 Deferred getRoot()
           Returns the root node of the layout model; never null.
 Boolean hasChildren(LayoutNode node)
           Returns whether or not the given node has children.
 DeferredIterator getChildren(LayoutNode node)
           Returns an iterator of the child nodes for the given node.
 Deferred getParent(LayoutNode node)
           Returns the parent of a given node.
 Boolean isModifiable(LayoutNode node)
           Indicates if the specified resource is modifiable.
 Boolean isDeletable(LayoutNode node)
           Indicates if the specified layout node is deletable.
 Deferred find(Identifiable id)
           Returns an element of a model (searches throughout the whole tree) with the given ID.
 
Methods inherited from interface com.ibm.mashups.enabler.TreeModelController
create, confirmCreate, insert, confirmInsert, remove, confirmRemove
 
Methods inherited from interface com.ibm.mashups.enabler.TreeModel
getRoot, hasChildren, getChildren, getParent
 
Methods inherited from interface com.ibm.mashups.enabler.model.Model
setStrategy, getStrategies, getStrategy, addStrategy, removeStrategy
 
Methods inherited from interface com.ibm.mashups.enabler.Locator
find
 
Methods inherited from interface com.ibm.mashups.enabler.wire.WireModelProvider
getWireModel
 

Method Detail

create

LayoutControl create(Object context)
Creates a layout control. Note that the layout control will not appear in the model unless it is inserted using the insert method.

Example: To create a layout control based on a widget definition located at a specific URL, you do the following:
  var context = { };
  context["type"] = com.ibm.mashups.enabler.layout.Constants.LAYOUT_CONTROL;
  context[com.ibm.mashups.enabler.layout.Constants.WIDGET_DEFINITION_URL] = "http://my/widget/definition.xml";
  layoutModel.create(context);

Parameters:
context - context with predefined information used for the creation of the layout control. Must not be null. You must specify the following:
  type - type of layout entity to create as defined in  Constants ; must be one of the following:
   LAYOUT_CONTROL

  In case type equals LAYOUT_CONTROL, you must specify the widget to create using one of the following keys as defined in  Constants
  WIDGET_DEFINITION_ID -  Identifiable of widget definition to instantiate for this control, or
  WIDGET_DEFINITION_URL - URL (string) pointing to a widget definition to instantiate for this control; note that the widget definition will be managed by the backend after this layout control is inserted into a layout container and the layout model is committed.
Returns:
the created layout control, or null if it can not be created.
See Also:
WidgetDefinition, Constants

getRoot

Deferred getRoot()
Returns the root node of the layout model; never null.

Returns:
a deferred object used to start this operation. The return value when executed through the deferred object is the root  LayoutNode of the layout model

hasChildren

Boolean hasChildren(LayoutNode node)
Returns whether or not the given node has children.

Parameters:
node - the layout node for which to check if it has children; must not be null.
Returns:
true if the specified node has children, false otherwise

getChildren

DeferredIterator getChildren(LayoutNode node)
Returns an iterator of the child nodes for the given node.

Parameters:
node - the node object for which to return its children; must not be null.
Returns:
deferred iterator of the children for the given node; never null

getParent

Deferred getParent(LayoutNode node)
Returns the parent of a given node.

Parameters:
node - node object for which to return its parent node; must not be null
Returns:
a deferred object used to start this operation. The return value when executed through the deferred object is the parent  LayoutNode of the given node, or null, if the node has no parent

isModifiable

Boolean isModifiable(LayoutNode node)
Indicates if the specified resource is modifiable.

Parameters:
node - the layout node to check; must not be null
Returns:
true if the node is modifiable, false otherwise
Since:
2.4

isDeletable

Boolean isDeletable(LayoutNode node)
Indicates if the specified layout node is deletable.

Parameters:
node - The layout node to check; must not be null
Returns:
true if the node is deletable, false otherwise
Since:
2.4

find

Deferred find(Identifiable id)
Returns an element of a model (searches throughout the whole tree) with the given ID. May be either aLayoutControl or aLayoutContainer

Parameters:
id - identifiable or string id of the object to find; must not be null.
Returns:
a deferred object used to start this operation. The return value when executed through the deferred object is the element with the given ID or null if the element cannot be found.


Copyright IBM Corp. 2010 All Rights Reserved.