Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Orion/How Tos/Client How Tos"

< Orion‎ | How Tos
Line 4: Line 4:
  
 
== Register services  ==
 
== Register services  ==
 
+
#Define a '''DIV''' with id in the html where the tree table wil be rendered.
*Define a '''DIV''' with id in the html where the tree table wil be rendered.
+
#In the html loading js file , create the [[Orion/Client API#Service_Registry|Service Registry]].
*In the html loading js file , create the [[Orion/Client API#Service_Registry|Service Registry]].
+
#Register the {{Orion/JSDOCRef|FileService}} in the registry.
<pre style="color: green;">registry = new eclipse.Registry(); </pre>
+
#Register the {{Orion/JSDOCRef|CommandService}} in the registry.
*Register the {{Orion/JSDOCRef|FileService}} in the registry.
+
#Create {{Orion/JSDOCRef|Command}} and add commands to {{Orion/JSDOCRef|CommandService}}.
 
{{Orion/CodeBlock|code =
 
{{Orion/CodeBlock|code =
 +
var registry = new eclipse.Registry();
 
  registry.registerLocalService("IFileService", "FileService", new eclipse.FileService());
 
  registry.registerLocalService("IFileService", "FileService", new eclipse.FileService());
}}
 
*Register the {{Orion/JSDOCRef|CommandService}} in the registry.
 
{{Orion/CodeBlock|code =
 
 
  var commandService = new eclipse.CommandService(registry);
 
  var commandService = new eclipse.CommandService(registry);
 
  registry.registerLocalService("ICommandService", "CommandService", commandService);
 
  registry.registerLocalService("ICommandService", "CommandService", commandService);
 +
var favoriteCommand = new eclipse.Command();
 +
commandService.addCommand(favoriteCommand, "object");
 
}}
 
}}
 
== Model Creation  ==
 
== Model Creation  ==

Revision as of 18:44, 12 January 2011

Render file tree table inside an html DIV

Steps to render a file tree table inside a given div in a html shown as below. A combination of Orion/Client API are used in the section.

Orion-TableTree.png

Register services

  1. Define a DIV with id in the html where the tree table wil be rendered.
  2. In the html loading js file , create the Service Registry.
  3. Register the FileService in the registry.
  4. Register the CommandService in the registry.
  5. Create Command and add commands to CommandService.
var registry = new eclipse.Registry(); 
registry.registerLocalService("IFileService", "FileService", new eclipse.FileService());
var commandService = new eclipse.CommandService(registry);
registry.registerLocalService("ICommandService", "CommandService", commandService);
var favoriteCommand = new eclipse.Command();
commandService.addCommand(favoriteCommand, "object");

Model Creation

  1. Create an instance of the model class to provide the tree model , the model has to implement the following functions required by TableTree.
    • getRoot(onItem).
    • getChildren(parentItem, onComplete) . It uses the FileService.getChildren to provide childen items.
    • getId(item)

Renderer Creation

  1. Create an instance of the renderer class to render table rows (refer to Table Tree)
    • Implement check box rendering
    • Implement table-row based actions
    • Implement folder toggles by calling Table Tree's other API(TODO: Define other APIs)

TableTree Creation

  1. Create an instance of Table Tree
  2. In the onLoad of the html , use a wrapper class instance to wrap the Table Tree and initialize the table.

Render a file selection and auto expand

Describes how to render a file selection from persisted preference.

Back to the top