public DeliveryOptionsConfigurationController( UserRequest ureq, WindowControl wControl, DeliveryOptions config, DeliveryOptions parentConfig) { super(ureq, wControl); this.config = (config == null ? new DeliveryOptions() : config.clone()); this.parentConfig = parentConfig; initForm(ureq); if (parentConfig != null && config != null && config.getInherit() != null && config.getInherit().booleanValue()) { setValues(parentConfig); } else { setValues(config); } updateEnabled(); }
@Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { setFormTitle("option.desc"); setFormContextHelp( this.getClass().getPackage().getName(), "display-options.html", "chelp.display-options.title"); String[] inheritValues = new String[] {translate("inherit"), translate("custom")}; inheritEl = uifactory.addRadiosVertical("inherit.label", formLayout, inheritKeys, inheritValues); inheritEl.addActionListener(this, FormEvent.ONCHANGE); if (config != null && config.getInherit() != null && config.getInherit().booleanValue()) { inheritEl.select(inheritKeys[0], true); } else { inheritEl.select(inheritKeys[1], true); } if (parentConfig == null) { inheritEl.setVisible(false); } else { inheritEl.setVisible(true); uifactory.addSpacerElement("spacer.mode", formLayout, false); } String[] standardModeValues = new String[] {translate("mode.standard"), translate("mode.configured")}; standardModeEl = uifactory.addRadiosVertical("mode", formLayout, standardModeKeys, standardModeValues); standardModeEl.addActionListener(this, FormEvent.ONCHANGE); uifactory.addSpacerElement("spacer.js", formLayout, false); String[] jsValues = new String[] { translate("option.js.none"), translate("option.js.jQuery"), translate("option.js.prototypejs") }; jsOptionEl = uifactory.addRadiosVertical("option.js", formLayout, jsKeys, jsValues); jsOptionEl.addActionListener(this, FormEvent.ONCHANGE); glossarEl = uifactory.addCheckboxesHorizontal( "option.glossary", formLayout, new String[] {"on"}, new String[] {""}, null); String[] values = new String[] { translate("height.auto"), "460px", "480px", "500px", "520px", "540px", "560px", "580px", "600px", "620px", "640px", "660px", "680px", "700px", "720px", "730px", "760px", "780px", "800px", "820px", "840px", "860px", "880px", "900px", "920px", "940px", "960px", "980px", "1000px", "1020px", "1040px", "1060px", "1080px", "1100px", "1120px", "1140px", "1160px", "1180px", "1200px", "1220px", "1240px", "1260px", "1280px", "1300px", "1320px", "1340px", "1360px", "1380px" }; heightEl = uifactory.addDropdownSingleselect("height", "height.label", formLayout, keys, values, null); String[] cssValues = new String[] {translate("option.css.none"), translate("option.css.openolat")}; cssOptionEl = uifactory.addRadiosVertical("option.css", formLayout, cssKeys, cssValues); uifactory.addSpacerElement("spaceman", formLayout, false); Map<String, Charset> charsets = Charset.availableCharsets(); int numOfCharsets = charsets.size() + 1; encodingContentKeys = new String[numOfCharsets]; encodingContentKeys[0] = NodeEditController.CONFIG_CONTENT_ENCODING_AUTO; String[] encodingContentValues = new String[numOfCharsets]; encodingContentValues[0] = translate("encoding.auto"); encodingJSKeys = new String[numOfCharsets]; encodingJSKeys[0] = NodeEditController.CONFIG_JS_ENCODING_AUTO; String[] encodingJSValues = new String[numOfCharsets]; encodingJSValues[0] = translate("encoding.same"); int count = 1; Locale locale = getLocale(); for (Map.Entry<String, Charset> charset : charsets.entrySet()) { encodingContentKeys[count] = charset.getKey(); encodingContentValues[count] = charset.getValue().displayName(locale); encodingJSKeys[count] = charset.getKey(); encodingJSValues[count] = charset.getValue().displayName(locale); count++; } encodingContentEl = uifactory.addDropdownSingleselect( "encoContent", "encoding.content", formLayout, encodingContentKeys, encodingContentValues, null); encodingJSEl = uifactory.addDropdownSingleselect( "encoJS", "encoding.js", formLayout, encodingJSKeys, encodingJSValues, null); FormLayoutContainer buttonsLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator()); buttonsLayout.setRootForm(mainForm); formLayout.add(buttonsLayout); uifactory.addFormSubmitButton("save", buttonsLayout); }
public boolean isInherit() { return parentConfig != null && config != null && config.getInherit() != null && config.getInherit().booleanValue(); }