use of org.olat.repository.CatalogEntry.Style in project OpenOLAT by OpenOLAT.
the class CatalogEntryEditController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormStyle("o_catalog");
String name = catalogEntry == null ? "" : catalogEntry.getName();
nameEl = uifactory.addTextElement("name", "entry.category", 255, name, formLayout);
nameEl.setMandatory(true);
nameEl.setNotEmptyCheck("form.legende.mandatory");
String desc = catalogEntry == null ? "" : catalogEntry.getDescription();
descriptionEl = uifactory.addRichTextElementForStringDataMinimalistic("description", "entry.description", desc, 10, -1, formLayout, getWindowControl());
String[] styleValues = new String[] { translate("tiles"), translate("list"), translate("list.compact") };
styleEl = uifactory.addDropdownSingleselect("style", "style", formLayout, styleKeys, styleValues, null);
Style style = catalogEntry == null ? null : catalogEntry.getStyle();
if (style != null) {
for (String styleKey : styleKeys) {
if (styleKey.equals(style.name())) {
styleEl.select(styleKey, true);
}
}
}
if (!styleEl.isOneSelected()) {
styleEl.select(styleKeys[0], true);
}
VFSLeaf img = catalogEntry == null || catalogEntry.getKey() == null ? null : catalogManager.getImage(catalogEntry);
fileUpload = uifactory.addFileElement(getWindowControl(), "entry.pic", "entry.pic", formLayout);
fileUpload.setMaxUploadSizeKB(picUploadlimitKB, null, null);
fileUpload.addActionListener(FormEvent.ONCHANGE);
fileUpload.setPreview(ureq.getUserSession(), true);
fileUpload.setCropSelectionEnabled(true);
fileUpload.setDeleteEnabled(true);
if (img instanceof LocalFileImpl) {
fileUpload.setInitialFile(((LocalFileImpl) img).getBasefile());
}
fileUpload.limitToMimeType(mimeTypes, "cif.error.mimetype", new String[] { mimeTypes.toString() });
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
buttonLayout.setElementCssClass("o_sel_catalog_entry_form_buttons");
formLayout.add(buttonLayout);
uifactory.addFormSubmitButton("submit", buttonLayout);
uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
use of org.olat.repository.CatalogEntry.Style in project openolat by klemens.
the class CatalogEntryEditController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormStyle("o_catalog");
String name = catalogEntry == null ? "" : catalogEntry.getName();
nameEl = uifactory.addTextElement("name", "entry.category", 255, name, formLayout);
nameEl.setMandatory(true);
nameEl.setNotEmptyCheck("form.legende.mandatory");
String desc = catalogEntry == null ? "" : catalogEntry.getDescription();
descriptionEl = uifactory.addRichTextElementForStringDataMinimalistic("description", "entry.description", desc, 10, -1, formLayout, getWindowControl());
String[] styleValues = new String[] { translate("tiles"), translate("list"), translate("list.compact") };
styleEl = uifactory.addDropdownSingleselect("style", "style", formLayout, styleKeys, styleValues, null);
Style style = catalogEntry == null ? null : catalogEntry.getStyle();
if (style != null) {
for (String styleKey : styleKeys) {
if (styleKey.equals(style.name())) {
styleEl.select(styleKey, true);
}
}
}
if (!styleEl.isOneSelected()) {
styleEl.select(styleKeys[0], true);
}
VFSLeaf img = catalogEntry == null || catalogEntry.getKey() == null ? null : catalogManager.getImage(catalogEntry);
fileUpload = uifactory.addFileElement(getWindowControl(), "entry.pic", "entry.pic", formLayout);
fileUpload.setMaxUploadSizeKB(picUploadlimitKB, null, null);
fileUpload.addActionListener(FormEvent.ONCHANGE);
fileUpload.setPreview(ureq.getUserSession(), true);
fileUpload.setCropSelectionEnabled(true);
fileUpload.setDeleteEnabled(true);
if (img instanceof LocalFileImpl) {
fileUpload.setInitialFile(((LocalFileImpl) img).getBasefile());
}
fileUpload.limitToMimeType(mimeTypes, "cif.error.mimetype", new String[] { mimeTypes.toString() });
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
buttonLayout.setElementCssClass("o_sel_catalog_entry_form_buttons");
formLayout.add(buttonLayout);
uifactory.addFormSubmitButton("submit", buttonLayout);
uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
Aggregations