Skip to content

Commit

Permalink
Display a Hint
Browse files Browse the repository at this point in the history
New Hint Feature (other updates come later)
  • Loading branch information
ishimoto committed Jul 22, 2012
1 parent 636d0ef commit d5af184
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Frameworks/Core/ERDirectToWeb/Components/ERDDisplayHint.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wodefinitions>
<wo class="ERD2WDisplayHint" wocomponentcontent="false"> <binding name="d2wContext"/>
<validation message="'d2wContext' is a required binding.">
<unbound name="d2wContext"/>
</validation>
</wo>
</wodefinitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<webobject name="CanDisplay">
<webobject name="HasHint">
<span class="ERD2WHint">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<webobject name="VALUE" /></span>
</webobject>
</webobject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CanDisplay : WOConditional {
condition = displayHint;
}

HasHint : WOConditional {
condition = ^d2wContext.hint;
}

VALUE : ERXLocalizedString {
value = ^d2wContext.hint;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"WebObjects Release" = "WebObjects 5.0";
encoding = "UTF-8";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package er.directtoweb.components;

import com.webobjects.appserver.WOContext;
import com.webobjects.directtoweb.D2WContext;

/**
* <span class="ja">
* このコンポーネントは項目のヒントを表示します。
*
* ルール又はユーザ・ディクショナリーで hint を指定します。
*
* そうすると項目の右側にメッセージが表示されます。
* ただし、"inspect" と "edit" タスク時のみで表示される
*
* @d2wKey hint - 表示するヒント
* </span>
*
* @author ishimoto
*/
public class ERDDisplayHint extends ERD2WStatelessComponent {
/**
* Do I need to update serialVersionUID?
* See section 5.6 <cite>Type Changes Affecting Serialization</cite> on page 51 of the
* <a href="http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf">Java Object Serialization Spec</a>
*/
private static final long serialVersionUID = 1L;

public ERDDisplayHint(WOContext aContext) {
super(aContext);
}

public boolean displayHint() {
D2WContext d2w = (D2WContext) valueForBinding("d2wContext");
String task = d2w.task();

if("inspect".equals(task) || "edit".equals(task)) {
return true;
}
return false;
}

}

0 comments on commit d5af184

Please sign in to comment.