Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
(
	{
		name = Root;
		directActionClass = DirectAction;
		directActionName = default;
		children = "session.navigationRootChoice";
		childrenChoices = {
			home = (
				Posts,
				Authors,
			);
		};
	},
	{
		name = "Posts";
		action = "session.navController.listPostsAction";
		children = ("CreatePost","SearchPosts");
	},
	{
		name = CreatePost;
		action = "session.navController.createPostAction";
	},
	{
		name = SearchPosts;
		action = "session.navController.searchPostsAction";
	},
	{
		name = Authors;
		action = "session.navController.listAuthorsAction";
		children = ("CreateAuthor","SearchAuthors");
	},
	{
		name = CreateAuthor;
		action = "session.navController.createAuthorAction";
	},
	{
		name = SearchAuthors;
		action = "session.navController.searchAuthorsAction";
	}
)

Add the following method in the Session class for the navigation root.

Code Block

public String navigationRootChoice() {
	return "home";
}

The first array in the plist defines what the top level navigation is going to be, and this is where we define the two tabs (the childrenChoice dictionary). After that, we define the other parts of the navigation. You see references to action = session.navController. This is the action (method) that will be called for the specified navigation element, so let's create those methods in the MainNavigationController class.

...

After login, you will see the blog entries and if you click the Authors tab, you see the list of authors. Each item in the list have has 3 actions by default: Inspect (view the object), Edit (modify the object) and the red X button to delete the object.

Click Edit on an author, and you will see that it display displays not only the author's details but also blog entries created for that user. You can even create a new blog entry directly from the author.

...

Viewing or editing a blog entry can be improveimproved. The three things we want to customize:

...

Those two customizations can be done by adding D2W rules. The D2W rules are in two files, located in the Resources folder, d2w.d2wmodel and user.d2wmodel. To edit the files, make sure you installed RulesModeler, a Mac application that manages D2W rule files. If RuleModeler is present, you can simply double-click on d2w.d2wmodel and the file will open in RulesModeler.

The first rule we need to add is a rule to specify that the richTextMode will be _ simpleRichTextMode_, which is a built-in definition that will put TinyMCE in a simple configuration. Create the New button in RulesModeler, and the rule must looks like this:

Image Added

The next rule will specify that we want to use the EREditHTML component for the content attribute. Again, click New in RulesModeler, and add this rule:

Image Added

Last rule: when we want to inspect or edit the blog entry, we want to change how the attributes are displayed, so add this new rule:

Image Added

We are done. Save the file in RulesModeler, and run the application again. Try editing a blog entry and you will notice that we know have a rich editor for the content and that the ordering of the fields is different, without having to change the HTML or the Java code!

Congratulations, you are done with the D2W tutorial! The next tutorial is about creating a stateful application.