📄 cmsdialog.java
字号:
* Builds a button row with an "ok" and a "cancel" button.<p>
*
* @return the button row
*/
public String dialogButtonsOkCancel() {
return dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2]);
}
/**
* Builds a button row with an "ok" and a "cancel" button.<p>
*
* @param okAttributes additional attributes for the "ok" button
* @param cancelAttributes additional attributes for the "cancel" button
* @return the button row
*/
public String dialogButtonsOkCancel(String okAttributes, String cancelAttributes) {
return dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[] {okAttributes, cancelAttributes});
}
/**
* Builds a button row with an "ok", a "cancel" and an "advanced" button.<p>
*
* @param okAttributes additional attributes for the "ok" button
* @param cancelAttributes additional attributes for the "cancel" button
* @param advancedAttributes additional attributes for the "advanced" button
* @return the button row
*/
public String dialogButtonsOkCancelAdvanced(String okAttributes, String cancelAttributes, String advancedAttributes) {
return dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL, BUTTON_ADVANCED}, new String[] {
okAttributes,
cancelAttributes,
advancedAttributes});
}
/**
* Builds a button row with a "set", an "ok", and a "cancel" button.<p>
*
* @param setAttributes additional attributes for the "set" button
* @param okAttributes additional attributes for the "ok" button
* @param cancelAttributes additional attributes for the "cancel" button
* @return the button row
*/
public String dialogButtonsSetOkCancel(String setAttributes, String okAttributes, String cancelAttributes) {
return dialogButtons(new int[] {BUTTON_SET, BUTTON_OK, BUTTON_CANCEL}, new String[] {
setAttributes,
okAttributes,
cancelAttributes});
}
/**
* Builds the content area of the dialog window.<p>
*
* @param segment the HTML segment (START / END)
* @param title the title String for the dialog window
* @return a content area start / end segment
*/
public String dialogContent(int segment, String title) {
if (segment == HTML_START) {
StringBuffer result = new StringBuffer(512);
// null title is ok, we always want the title headline
result.append(dialogHead(title));
result.append("<div class=\"dialogcontent\" unselectable=\"on\">\n");
result.append("<!-- dialogcontent start -->\n");
return result.toString();
} else {
return "<!-- dialogcontent end -->\n</div>\n";
}
}
/**
* Returns the end html for the content area of the dialog window.<p>
*
* @return the end html for the content area of the dialog window
*/
public String dialogContentEnd() {
return dialogContent(HTML_END, null);
}
/**
* Returns the start html for the content area of the dialog window.<p>
*
* @param title the title for the dialog
* @return the start html for the content area of the dialog window
*/
public String dialogContentStart(String title) {
return dialogContent(HTML_START, title);
}
/**
* Returns the end html for the outer dialog window border.<p>
*
* @return the end html for the outer dialog window border
*/
public String dialogEnd() {
return dialog(HTML_END, null);
}
/**
* Builds the title of the dialog window.<p>
*
* @param title the title String for the dialog window
* @return the HTML title String for the dialog window
*/
public String dialogHead(String title) {
return "<div class=\"dialoghead\" unselectable=\"on\">" + (title == null ? "" : title) + "</div>";
}
/**
* Builds an invisible horiziontal spacer with the specified width.<p>
* @param width the width of the spacer in pixels
* @return an invisible horiziontal spacer with the specified width
*/
public String dialogHorizontalSpacer(int width) {
return "<td><span style=\"display:block; height: 1px; width: " + width + "px;\"></span></td>";
}
/**
* Builds the necessary button row.<p>
*
* @return the button row
*/
public String dialogLockButtons() {
StringBuffer html = new StringBuffer(512);
html.append("<div id='butClose' >\n");
html.append(dialogButtonsClose());
html.append("</div>\n");
html.append("<div id='butContinue' class='hide' >\n");
html.append(dialogButtons(new int[] {BUTTON_CONTINUE, BUTTON_CANCEL}, new String[] {
" onclick=\"submitAction('" + DIALOG_OK + "', form); form.submit();\"",
""}));
html.append("</div>\n");
return html.toString();
}
/**
* Builds a dialog line without break (display: block).<p>
*
* @param segment the HTML segment (START / END)
* @return a row start / end segment
*/
public String dialogRow(int segment) {
if (segment == HTML_START) {
return "<div class=\"dialogrow\">";
} else {
return "</div>\n";
}
}
/**
* Builds the end of a dialog line without break (display: block).<p>
*
* @return the row end segment
*/
public String dialogRowEnd() {
return dialogRow(HTML_END);
}
/**
* Builds the start of a dialog line without break (display: block).<p>
*
* @return the row start segment
*/
public String dialogRowStart() {
return dialogRow(HTML_START);
}
/**
* Builds the standard javascript for submitting the dialog.<p>
*
* @return the standard javascript for submitting the dialog
*/
public String dialogScriptSubmit() {
if (useNewStyle()) {
return super.dialogScriptSubmit();
}
StringBuffer result = new StringBuffer(512);
result.append("function submitAction(actionValue, theForm, formName) {\n");
result.append("\tif (theForm == null) {\n");
result.append("\t\ttheForm = document.forms[formName];\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_FRAMENAME + ".value = window.name;\n");
result.append("\tif (actionValue == \"" + DIALOG_OK + "\") {\n");
result.append("\t\treturn true;\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_ACTION + ".value = actionValue;\n");
result.append("\ttheForm.submit();\n");
result.append("\treturn false;\n");
result.append("}\n");
return result.toString();
}
/**
* Builds a horizontal separator line in the dialog content area.<p>
*
* @return a separator element
*/
public String dialogSeparator() {
return "<div class=\"dialogseparator\" unselectable=\"on\"></div>";
}
/**
* Builds a space between two elements in the dialog content area.<p>
*
* @return a space element
*/
public String dialogSpacer() {
return "<div class=\"dialogspacer\" unselectable=\"on\"> </div>";
}
/**
* Returns the start html for the outer dialog window border.<p>
*
* @return the start html for the outer dialog window border
*/
public String dialogStart() {
return dialog(HTML_START, null);
}
/**
* Returns the start html for the outer dialog window border.<p>
*
* @param attributes optional html attributes to insert
* @return the start html for the outer dialog window border
*/
public String dialogStart(String attributes) {
return dialog(HTML_START, attributes);
}
/**
* Builds a subheadline in the dialog content area.<p>
*
* @param headline the desired headline string
* @return a subheadline element
*/
public String dialogSubheadline(String headline) {
StringBuffer retValue = new StringBuffer(128);
retValue.append("<div class=\"dialogsubheader\" unselectable=\"on\">");
retValue.append(headline);
retValue.append("</div>\n");
return retValue.toString();
}
/**
* Builds the HTML code to fold and unfild a white-box.<p>
*
* @param headline the heading to display
* @param id the id of the toggle
* @param show true if the white box is open at the beginning
*
* @return HTML code to fold and unfild a white-box
*/
public String dialogToggleStart(String headline, String id, boolean show) {
StringBuffer result = new StringBuffer(512);
// set icon and style class to use: hide user permissions
String image = "plus.png";
String styleClass = "hide";
if (show) {
// show user permissions
image = "minus.png";
styleClass = "show";
}
result.append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
result.append("<tr>\n");
result.append("\t<td style=\"vertical-align: bottom; padding-bottom: 2px;\"><a href=\"javascript:toggleDetail('");
result.append(id);
result.append("');\"><img src=\"");
result.append(getSkinUri());
result.append("commons/");
result.append(image);
result.append("\" class=\"noborder\" id=\"ic-");
result.append(id);
result.append("\"></a></td>\n");
result.append("\t<td>");
result.append(dialogSubheadline(headline));
result.append("</td>\n");
result.append("</tr>\n");
result.append("</table>\n");
result.append("<div class=\"");
result.append(styleClass);
result.append("\" id=\"");
result.append(id);
result.append("\">\n");
return result.toString();
}
/**
* Builds a white box in the dialog content area.<p>
*
* @param segment the HTML segment (START / END)
* @return the white box start / end segment
*/
public String dialogWhiteBox(int segment) {
if (segment == HTML_START) {
return "<!-- white box start -->\n"
+ "<div class=\"dialoginnerboxborder\">\n"
+ "<div class=\"dialoginnerbox\" unselectable=\"off\">\n";
} else {
return "</div>\n</div>\n<!-- white box end -->\n";
}
}
/**
* Builds the end of a white box in the dialog content area.<p>
*
* @return the white box end segment
*/
public String dialogWhiteBoxEnd() {
return dialogWhiteBox(HTML_END);
}
/**
* Builds the start of a white box in the dialog content area.<p>
*
* @return the white box start segment
*/
public String dialogWhiteBoxStart() {
return dialogWhiteBox(HTML_START);
}
/**
* Returns the action value.<p>
*
* The action value is used on JSP pages to select the proper action
* in a large "switch" statement.<p>
*
* @return the action value
*/
public int getAction() {
return m_action;
}
/**
* Returns the action to be carried out after a click on the cancel button..<p>
*
* @return the action to be carried out after a click on the cancel button.
*/
public String getCancelAction() {
return DIALOG_CANCEL;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -