Date: 2004-08-13T06:28:30
Editor: MichaelMcGrady <[EMAIL PROTECTED]>
Wiki: Apache Struts Wiki
Page: StrutsCatalogMultipleImageTagsSimplified
URL: http://wiki.apache.org/struts/StrutsCatalogMultipleImageTagsSimplified
no comment
Change Log:
------------------------------------------------------------------------------
@@ -31,6 +31,93 @@
'''There you go. Toss out the !LookupDispatchActions, the !ButtonCommands, etc. This
is a done deal. You can clearly seek other ways to ensure a bit more safety. For
example, the code works equally as well with "submit.button" as it does with "submit".
Elegant, no, eh?
+Surprisingly, some people still prefer the way I used to do this. I think they just
like the plain fanciness of it all. For those people, here is code that is less
extensible, more coupled, heavier, etc.
+package com.crackwillow.struts.form;
+
+import org.apache.struts.action.ActionForm;
+
+import com.crackwillow.log.StdOut;
+
+public class AdminButtonForm
+ extends ActionForm {
+ protected CrackWillowButton button;
+ protected String command;
+
+ public CrackWillowButton getButton() {
+ if(button == null) {
+ this.button = new CrackWillowButton();
+ }
+ return button;
+ }
+
+ public String getCommand() {
+ String hold = command;
+ command = null;
+ return hold;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public void reset() {
+ button = null;
+ }
+
+ public class CrackWillowButton {
+ private Integer x, y;
+ public static final String CREATE = "create";
+ public static final String RETRIEVE = "retrieve";
+ public static final String UPDATE = "update";
+ public static final String DELETE = "delete";
+ public static final String SUBMIT = "submit";
+
+ public CrackWillowButton() {
+ }
+
+ public CrackWillowButton getCreate() {
+ setCommand(this.CREATE);
+ return button;
+ }
+
+ public CrackWillowButton getRetrieve() {
+ setCommand(this.RETRIEVE);
+ return button;
+ }
+
+ public CrackWillowButton getUpdate() {
+ setCommand(this.UPDATE);
+ return button;
+ }
+
+ public CrackWillowButton getDelete() {
+ setCommand(this.DELETE);
+ return button;
+ }
+
+ public CrackWillowButton getSubmit() {
+ setCommand(this.SUBMIT);
+ return button;
+ }
+
+ public void setX(Integer x) {
+ if(y != null) {
+ reset();
+ } else {
+ this.x = x;
+ }
+ }
+
+ public void setY(Integer y) {
+ if(x != null) {
+ reset();
+ } else {
+ this.y = y;
+ }
+ }
+ }
+} ///;-) Michael McGrady
+
Michael !McGrady
Cap't of the Eh Team'''
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]