From d5af184a4b088930958201eead456a60023d2433 Mon Sep 17 00:00:00 2001 From: Ken ISHIMOTO Date: Sun, 22 Jul 2012 18:47:59 +0200 Subject: [PATCH] Display a Hint New Hint Feature (other updates come later) --- .../Components/ERDDisplayHint.api | 8 ++++ .../ERDDisplayHint.wo/ERDDisplayHint.html | 5 +++ .../ERDDisplayHint.wo/ERDDisplayHint.wod | 11 +++++ .../ERDDisplayHint.wo/ERDDisplayHint.woo | 4 ++ .../components/ERDDisplayHint.java | 42 +++++++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 Frameworks/Core/ERDirectToWeb/Components/ERDDisplayHint.api create mode 100644 Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.html create mode 100644 Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.wod create mode 100644 Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.woo create mode 100644 Frameworks/Core/ERDirectToWeb/Sources/er/directtoweb/components/ERDDisplayHint.java diff --git a/Frameworks/Core/ERDirectToWeb/Components/ERDDisplayHint.api b/Frameworks/Core/ERDirectToWeb/Components/ERDDisplayHint.api new file mode 100644 index 00000000000..1ec7fa1adf8 --- /dev/null +++ b/Frameworks/Core/ERDirectToWeb/Components/ERDDisplayHint.api @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.html b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.html new file mode 100644 index 00000000000..a56907c4b64 --- /dev/null +++ b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.html @@ -0,0 +1,5 @@ + + +       + + \ No newline at end of file diff --git a/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.wod b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.wod new file mode 100644 index 00000000000..2c104a4bd0c --- /dev/null +++ b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.wod @@ -0,0 +1,11 @@ +CanDisplay : WOConditional { + condition = displayHint; +} + +HasHint : WOConditional { + condition = ^d2wContext.hint; +} + +VALUE : ERXLocalizedString { + value = ^d2wContext.hint; +} diff --git a/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.woo b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.woo new file mode 100644 index 00000000000..e5207230f67 --- /dev/null +++ b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDDisplayHint.wo/ERDDisplayHint.woo @@ -0,0 +1,4 @@ +{ + "WebObjects Release" = "WebObjects 5.0"; + encoding = "UTF-8"; +} diff --git a/Frameworks/Core/ERDirectToWeb/Sources/er/directtoweb/components/ERDDisplayHint.java b/Frameworks/Core/ERDirectToWeb/Sources/er/directtoweb/components/ERDDisplayHint.java new file mode 100644 index 00000000000..94c54db29f4 --- /dev/null +++ b/Frameworks/Core/ERDirectToWeb/Sources/er/directtoweb/components/ERDDisplayHint.java @@ -0,0 +1,42 @@ +package er.directtoweb.components; + +import com.webobjects.appserver.WOContext; +import com.webobjects.directtoweb.D2WContext; + +/** + * + * このコンポーネントは項目のヒントを表示します。 + * + * ルール又はユーザ・ディクショナリーで hint を指定します。 + * + * そうすると項目の右側にメッセージが表示されます。 + * ただし、"inspect" と "edit" タスク時のみで表示される + * + * @d2wKey hint - 表示するヒント + * + * + * @author ishimoto + */ +public class ERDDisplayHint extends ERD2WStatelessComponent { + /** + * Do I need to update serialVersionUID? + * See section 5.6 Type Changes Affecting Serialization on page 51 of the + * Java Object Serialization Spec + */ + 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; + } + +}