D2W Rules Reference - Cookbook - FAQ

Last modified by Kieran Kelleher on 2011/04/20 04:04

Rule Lists

Below are some commonly used rules and information on keys which control D2W templates. You may wish to keep your own library of commonly used D2W rules, something like "D2WRuleLibrary.d2wmodel", which can then be used to copy and paste rules into your projects.

For quick reference:

1. How do I make my attributes and entities editable?

Unknown macro: noformat. Click on this message for details.

2. How do I make my relationships editable in ERD2W? (They are already are editable in D2W.)
 Add two rules. This:

Unknown macro: noformat. Click on this message for details.

and the below:

Unknown macro: noformat. Click on this message for details.

3. Similarly how do I make my relationships display nicely in an Inspect page in ERD2W? By default they show up as an array fault.
 There are many possible components to choose from. These are just a couple as an example.
 Add two rules. This:

Unknown macro: noformat. Click on this message for details.

and the below:

Unknown macro: noformat. Click on this message for details.

4. I don't like the defaults for attributes that D2W chooses. Sometimes it chooses wisely, but not always. How do I change what gets displayed for an entity's attributes?

The key is: displayPropertyKeys. This key represents a list of attributes to display for an entity. An example rule:

Unknown macro: noformat. Click on this message for details.

Note that you can pick attributes across relationships. You now have total control of what gets displayed.

5. If you want to use Click to Open for your D2W project, you'll need to disable it when you are generating ERExcelLook pages or the resulting Excel file will be unreadable gibberish.

The key is: clickToOpenEnabled. This key is on ERD2WPage and controls whether clickToOpen is enabled for that specific page. An example rule:

Unknown macro: noformat. Click on this message for details.

6. How do I control the list of visible Entities in my PageWrapper? My select entity popup is showing entities I don't want to be visible (ERAttachment, Lookup values, etc).

Unknown macro: noformat. Click on this message for details.

7. How do I easily use my own custom component in a Direct to Web page?

Step 1:

Add the following rules to your rule file:

Unknown macro: noformat. Click on this message for details.

Step 2:

Create a component in your project named 'MyThePropertyComponent' and give it an 'object' and 'key' binding. The object will receive the current object, and the key will receive the current propertyKey (as a string) from DirectToWeb. Do with them what you will.


  public EOEnterpriseObject object() {
   return (EOEnterpriseObject) valueForBinding("object");
  }

 public String key() {
   return (String) valueForBinding("key");
  }

8. How do I use features such as sections and tabs with the rules?

Unknown macro: noformat. Click on this message for details.

The second rule will give you:

Tabs: Foo, Bar

Sections under Foo: FooBar, FooBaz

Like:

FooBar
 title
 category
 dateReleased

FooBaz
 plotSummary
 posterName

9. A simpler way to specify this stuff is:

Unknown macro: noformat. Click on this message for details.

10. Changing the display name for a PageConfiguration

You may want to use a Page Configuration Name that is consistent with the rules for your application (uses an EntityName), but it looks weird when it is parsed for display in the default way.

For example, in Bugtracker there is a page configuration named "EditMyPeople" which makes perfect sense for the rules, but not too much as an "Edit My Profile" page. The easy way around it is:

Unknown macro: noformat. Click on this message for details.

However, it is better practice to get labels out of the rules altogether unless you want to make use of variables inside them. You put labels in your Localizable.strings file. If you just want plain text, no rule is necessary. For the following examples, "MyDocuments" is the pageConfigurationName.

Unknown macro: noformat. Click on this message for details.

This entry can be used with no associated rule and it will do the right thing.

If you want to use the @@session.variable.blah@@ in your pageConfigurationNames, you'll need to use a rule with a delayed assignment.

Unknown macro: noformat. Click on this message for details.

Adding a normal component to a ModernDirectToWeb App

seeĀ Adding a Normal WOComponent Page to an ERModernLook-based application

ERExcelLook specific rules

Additional tips for ERExcelLook