public class Model extends Object implements EventTarget
The model class is also used to create instances of built in and custom collaborative objects via the appropriate create method.
Listen on the model for the following events:
This class should not be instantiated directly. The collaborative model is generated during the document load process. The model can be initialized by passing an initializer function to com.goodow.realtime.load.
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
__jsniRunAfter__() |
void |
addEventListener(EventType type,
EventHandler<?> handler,
boolean opt_capture)
Adds an event listener to the event target.
|
void |
addUndoRedoStateChangedListener(EventHandler<UndoRedoStateChangedEvent> handler) |
void |
beginCompoundOperation(String opt_name)
Starts a compound operation.
|
boolean |
canRedo() |
boolean |
canUndo() |
Object |
create(String ref,
Object... var_args)
Creates and returns a new collaborative object.
|
CollaborativeList |
createList(Object... opt_initialValue)
Creates a collaborative list.
|
CollaborativeMap |
createMap(Map<String,?> opt_initialValue)
Creates a collaborative map.
|
CollaborativeString |
createString(String opt_initialValue)
Creates a collaborative string.
|
void |
endCompoundOperation()
Ends a compound operation.
|
double |
getBytesUsed() |
<T extends CollaborativeObject> |
getObject(String objectId) |
String[] |
getParents(String objectId) |
CollaborativeMap |
getRoot()
Returns the root of the object model.
|
boolean |
isInitialized()
Returns whether the model is initialized.
|
boolean |
isReadOnly() |
void |
redo()
Redo the last thing the active collaborator undid.
|
void |
removeEventListener(EventType type,
EventHandler<?> handler,
boolean opt_capture)
Removes an event listener from the event target.
|
void |
undo()
Undo the last thing the active collaborator did.
|
@GwtIncompatible(value="J2ObjC blocked by JSNI") public static void __jsniRunAfter__()
public void addEventListener(EventType type, EventHandler<?> handler, boolean opt_capture)
EventTargetaddEventListener 在接口中 EventTargettype - The type of the event to listen for.handler - The function to handle the event. The handler can also be an object that
implements the handleEvent method which takes the event object as argument.opt_capture - In DOM-compliant browsers, this determines whether the listener is fired
during the capture or bubble phase of the event.public void addUndoRedoStateChangedListener(EventHandler<UndoRedoStateChangedEvent> handler)
public void beginCompoundOperation(String opt_name)
opt_name - An optional name for this compound operation.public boolean canRedo()
public boolean canUndo()
public Object create(String ref, Object... var_args)
ref - An object constructor or type name.var_args - Arguments to the newly-created object's initialize() method.public CollaborativeList createList(Object... opt_initialValue)
opt_initialValue - Initial value for the list.public CollaborativeMap createMap(Map<String,?> opt_initialValue)
opt_initialValue - Initial value for the map.public CollaborativeString createString(String opt_initialValue)
opt_initialValue - Sets the initial value for this string.public void endCompoundOperation()
public double getBytesUsed()
public <T extends CollaborativeObject> T getObject(String objectId)
public CollaborativeMap getRoot()
public boolean isInitialized()
public boolean isReadOnly()
public void redo()
public void removeEventListener(EventType type, EventHandler<?> handler, boolean opt_capture)
EventTargetremoveEventListener 在接口中 EventTargettype - The type of the event to listen for.handler - The function to handle the event. The handler can also be an object that
implements the handleEvent method which takes the event object as argument.opt_capture - In DOM-compliant browsers, this determines whether the listener is fired
during the capture or bubble phase of the event.public void undo()
Copyright © 2013. All Rights Reserved.