[MAGNOLIA-511] Make it easiear to extend DialogDialog Created: 28/Jul/05  Updated: 23/Jan/13  Resolved: 17/May/06

Status: Closed
Project: Magnolia
Component/s: admininterface
Affects Version/s: 2.1 Final
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Michael Aemisegger Assignee: Boris Kraft
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

all


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

I splitted the methods drawHtmlPostSubs(Writer) and drawHtmlPreSubs(Writer) into several methods and made them protected. Before, when extending DialogDialog.java a lot of unnecessary redundant code got spread all over the subclasses which is hard to maintain.

Patch for revision 1139:

— originals/magnolia-2.1-SNAPSHOT/src/main/info/magnolia/cms/gui/dialog/DialogDialog.java 2005-07-13 17:15:01.000000000 +0200
+++ patched/magnolia-2.1-SNAPSHOT/src/main/info/magnolia/cms/gui/dialog/DialogDialog.java 2005-07-28 13:49:02.000000000 +0200
@@ -136,6 +136,13 @@
// out.write(" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");

out.write("<html>"); //$NON-NLS-1$
+ this.drawHtmlPreSubsHead(out);
+ out.write("<body class=\"mgnlDialogBody\" onload=\"mgnlDialogInit();\">"); //$NON-NLS-1$
+ this.drawHtmlPreSubsForm(out);
+ this.drawHtmlPreSubsTabSet(out);
+ }
+
+ protected void drawHtmlPreSubsHead(Writer out) throws IOException

{ out.write("<head>"); //$NON-NLS-1$ out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>"); // kupu //$NON-NLS-1$ out.write("<script type=\"text/javascript\">"); //$NON-NLS-1$ @@ -159,7 +166,9 @@ this.drawJavascriptSources(out); this.drawCssSources(out); out.write("</head>"); //$NON-NLS-1$ - out.write("<body class=\"mgnlDialogBody\" onload=\"mgnlDialogInit();\">"); //$NON-NLS-1$ + }

+
+ protected void drawHtmlPreSubsForm(Writer out) throws IOException {
out.write("<form action=\"" //$NON-NLS-1$
+ this.getAction() + "\" name=\"mgnlFormMain\" method=\"post\" enctype=\"multipart/form-data\">"); //$NON-NLS-1$
out.write(new Hidden("mgnlDialog", this.getConfigValue("dialog"), false).getHtml()); //$NON-NLS-1$ //$NON-NLS-2$
@@ -173,19 +182,25 @@
if (this.getConfigValue("paragraph").indexOf(",") == -1)

{ //$NON-NLS-1$ //$NON-NLS-2$ out.write(new Hidden("mgnlParagraph", this.getConfigValue("paragraph"), false).getHtml()); //$NON-NLS-1$ //$NON-NLS-2$ }

// else multiple paragraph selection -> radios for selection

  • // TabSet stuff
    + }
    +
    + protected void drawHtmlPreSubsTabSet(Writer out) throws IOException { String id = this.getId(); out.write("<script type=\"text/javascript\">"); //$NON-NLS-1$ out.write("mgnlControlSets['" + id + "']=new Object();"); //$NON-NLS-1$ //$NON-NLS-2$ out.write("mgnlControlSets['" + id + "'].items=new Array();"); //$NON-NLS-1$ //$NON-NLS-2$ out.write("mgnlControlSets['" + id + "'].resize=true;"); //$NON-NLS-1$ //$NON-NLS-2$ out.write("</script>"); //$NON-NLS-1$ - // end TabSet stuff }

public void drawHtmlPostSubs(Writer out) throws IOException

{ - Messages msgs = MessagesManager.getMessages(getRequest()); + this.drawHtmlPostSubsTabSet(out); + this.drawHtmlPostSubsButtons(out); + out.write("</form></body></html>"); //$NON-NLS-1$ + }

+
+ protected void drawHtmlPostSubsTabSet(Writer out) throws IOException

{ // TabSet stuff String id = this.getId(); out.write("<div class=\"" + CssConstants.CSSCLASS_TABSETBUTTONBAR + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -206,6 +221,11 @@ out.write("mgnlDialogShiftTab('" + id + "',false,0)"); //$NON-NLS-1$ //$NON-NLS-2$ out.write("</script>"); //$NON-NLS-1$ // end TabSet stuff + }

+
+ protected void drawHtmlPostSubsButtons(Writer out) throws IOException

{ + Messages msgs = MessagesManager.getMessages(getRequest()); + out.write("<div class=\"" + CssConstants.CSSCLASS_TABSETSAVEBAR + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ Button save = new Button(); @@ -218,6 +238,5 @@ out.write(cancel.getHtml()); out.write("</div>"); //$NON-NLS-1$ - out.write("</form></body></html>"); //$NON-NLS-1$ }

}



 Comments   
Comment by Philipp Bracher [ 17/May/06 ]

looking forward to the next dialog generation

Generated at Mon Feb 12 03:18:09 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.