Search in sources :

Example 46 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class EditSolutionController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    formLayout.setElementCssClass("o_sel_course_gta_upload_solution_form");
    String title = solution.getTitle() == null ? "" : solution.getTitle();
    titleEl = uifactory.addTextElement("title", "solution.title", 128, title, formLayout);
    titleEl.setElementCssClass("o_sel_course_gta_upload_solution_title");
    titleEl.setMandatory(true);
    fileEl = uifactory.addFileElement(getWindowControl(), "file", "solution.file", formLayout);
    fileEl.setMandatory(true);
    fileEl.addActionListener(FormEvent.ONCHANGE);
    if (StringHelper.containsNonWhitespace(solution.getFilename())) {
        File currentFile = new File(solutionDir, solution.getFilename());
        if (currentFile.exists()) {
            fileEl.setInitialFile(currentFile);
        }
    }
    FormLayoutContainer buttonCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    buttonCont.setRootForm(mainForm);
    formLayout.add(buttonCont);
    uifactory.addFormSubmitButton("save", buttonCont);
    uifactory.addFormCancelButton("cancel", buttonCont, ureq, getWindowControl());
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) File(java.io.File)

Example 47 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class CPFileImportController method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    formLayout.setElementCssClass("o_sel_cp_import");
    setFormDescription("cpfileuploadcontroller.form.description");
    file = uifactory.addFileElement(getWindowControl(), "file", flc);
    file.setLabel("cpfileuploadcontroller.import.text", null);
    file.addActionListener(FormEvent.ONCHANGE);
    Long uploadLimitKb = getUploadLimitKb();
    if (uploadLimitKb != null) {
        Long uploadLimitMb = new Long(uploadLimitKb / 1024);
        file.setMaxUploadSizeKB(uploadLimitKb.intValue(), "cpfileuploadcontroller.tooBig", new String[] { uploadLimitMb.toString() });
    }
    // checkboxes
    String[] keys = { "htm", "pdf", "doc", "xls", "ppt", ALL };
    String[] values = { "HTML", "PDF", "Word", "Excel", "PowerPoint", translate("cpfileuploadcontroller.form.all.types") };
    checkboxes = uifactory.addCheckboxesVertical("checkboxes", "cpfileuploadcontroller.form.file.types", this.flc, keys, values, 1);
    checkboxes.setVisible(false);
    // Submit and cancel buttons
    final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
    this.flc.add(buttonLayout);
    uifactory.addFormSubmitButton("submit", "cpfileuploadcontroller.import.button", buttonLayout);
    cancelButton = uifactory.addFormLink("cancel", buttonLayout, Link.BUTTON);
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 48 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class GuiDemoFlexiFormAdvancedController method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("guidemo_flexi_form_advanced");
    setFormDescription("advanced_form.description");
    setFormContextHelp("Introduction");
    // Mandatory and read-only text fields
    this.addTextFields(formLayout);
    // More form items: Date, link and file selector
    this.addDateLinkAndFileItems(formLayout);
    // Separator with line
    uifactory.addSpacerElement("spacer", formLayout, false);
    // Single and multible selections (radio buttons and checkboxes)
    this.addSelections(formLayout);
    // Separator without line
    uifactory.addSpacerElement("spacernoline", formLayout, true);
    // Sublayout (shown if no is selected)
    this.addSublayout(formLayout);
    // Here's a text area
    uifactory.addTextAreaElement("guidemo.form.textarea", 0, 2, null, formLayout);
    // Add some rich text elements
    richTextElement = uifactory.addRichTextElementForStringData("guidemo.form.richtext.simple", "guidemo.form.richtext.simple", "click <i>to</i> <b>edit</b>. This one has an event listener and an <b>external menu with auto hide</b>", -1, -1, false, null, null, formLayout, ureq.getUserSession(), getWindowControl());
    // richTextElement.addActionListener(FormEvent.ONCHANGE);
    uifactory.addRichTextElementForStringData("guidemo.form.richtext.simple2", null, "one <i>with</i> <b>height</b> and <span style='color:red'>no</span> event listener and an <b>internal</b> menu", 10, 40, true, null, null, formLayout, ureq.getUserSession(), getWindowControl());
    disabledRichTextElement = uifactory.addRichTextElementForStringData("guidemo.form.richtext.simple3", "guidemo.form.richtext.simple", "this <i>is</i> <b>disabled</b>", -1, -1, false, null, null, formLayout, ureq.getUserSession(), getWindowControl());
    disabledRichTextElement.setEnabled(false);
    // Button layout
    final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
    formLayout.add(buttonLayout);
    // Submit and cancel buttons (without effect)
    uifactory.addFormSubmitButton("advanced_form.submit", buttonLayout);
    uifactory.addFormLink("advanced_form.cancel", buttonLayout, Link.BUTTON);
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 49 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class OAuthAdminController method initLinkedInForm.

private void initLinkedInForm(FormItemContainer formLayout) {
    FormLayoutContainer linkedinCont = FormLayoutContainer.createDefaultFormLayout("linkedin", getTranslator());
    linkedinCont.setFormTitle(translate("linkedin.admin.title"));
    linkedinCont.setFormTitleIconCss("o_icon o_icon_provider_linkedin");
    linkedinCont.setRootForm(mainForm);
    formLayout.add(linkedinCont);
    linkedInEl = uifactory.addCheckboxesHorizontal("linkedin.enabled", linkedinCont, keys, values);
    linkedInEl.addActionListener(FormEvent.ONCHANGE);
    String ApiKey = oauthModule.getLinkedInApiKey();
    linkedInApiKeyEl = uifactory.addTextElement("linkedin.id", "linkedin.api.id", 256, ApiKey, linkedinCont);
    String apiSecret = oauthModule.getLinkedInApiSecret();
    linkedInApiSecretEl = uifactory.addTextElement("linkedin.secret", "linkedin.api.secret", 256, apiSecret, linkedinCont);
    if (oauthModule.isLinkedInEnabled()) {
        linkedInEl.select(keys[0], true);
    } else {
        linkedInApiKeyEl.setVisible(false);
        linkedInApiSecretEl.setVisible(false);
    }
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 50 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class OAuthAdminController method initGoogleForm.

private void initGoogleForm(FormItemContainer formLayout) {
    FormLayoutContainer googleCont = FormLayoutContainer.createDefaultFormLayout("google", getTranslator());
    googleCont.setFormTitle(translate("google.admin.title"));
    googleCont.setFormTitleIconCss("o_icon o_icon_provider_google");
    googleCont.setRootForm(mainForm);
    formLayout.add(googleCont);
    googleEl = uifactory.addCheckboxesHorizontal("google.enabled", googleCont, keys, values);
    googleEl.addActionListener(FormEvent.ONCHANGE);
    String googleApiKey = oauthModule.getGoogleApiKey();
    googleApiKeyEl = uifactory.addTextElement("google.id", "google.api.id", 256, googleApiKey, googleCont);
    String googleApiSecret = oauthModule.getGoogleApiSecret();
    googleApiSecretEl = uifactory.addTextElement("google.secret", "google.api.secret", 256, googleApiSecret, googleCont);
    if (oauthModule.isGoogleEnabled()) {
        googleEl.select(keys[0], true);
    } else {
        googleApiKeyEl.setVisible(false);
        googleApiSecretEl.setVisible(false);
    }
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Aggregations

FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)844 ArrayList (java.util.ArrayList)96 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)76 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)76 Date (java.util.Date)56 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)56 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)42 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)40 FormItem (org.olat.core.gui.components.form.flexible.FormItem)38 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)32 Translator (org.olat.core.gui.translator.Translator)30 Identity (org.olat.core.id.Identity)30 VFSContainer (org.olat.core.util.vfs.VFSContainer)28 File (java.io.File)26 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)26 BusinessGroup (org.olat.group.BusinessGroup)26 HashMap (java.util.HashMap)22 HashSet (java.util.HashSet)22 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)22 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)20