Search in sources :

Example 1 with RegistrarFormItemGenerator

use of cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator in project perun by CESNET.

the class PreviewFormTabItem method prepareApplicationForm.

/**
	 * Prepares the widgets from the items as A DISPLAY FOR THE USER
	 *
	 * @param sp scroll panel
	 */
public void prepareApplicationForm(ScrollPanel sp) {
    FlexTable ft = new FlexTable();
    ft.setSize("100%", "100%");
    ft.setCellPadding(10);
    FlexCellFormatter fcf = ft.getFlexCellFormatter();
    int i = 0;
    for (final ApplicationFormItem item : formItems) {
        // skip items not from correct app type
        ArrayList<String> itemApplicationTypes = JsonUtils.listFromJsArrayString(item.getApplicationTypes());
        if (!itemApplicationTypes.contains(appType))
            continue;
        // generate correct items
        RegistrarFormItemGenerator gen = new RegistrarFormItemGenerator(item, locale);
        this.applFormGenerators.add(gen);
        gen.addValidationTrigger(new FormValidator() {

            public void triggerValidation() {
                validateFormValues(false);
            }
        });
        // if button, add onclick
        if (item.getType().equals("SUBMIT_BUTTON")) {
            this.sendButton = (Button) gen.getWidget();
            sendButton.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    // revalidate again, with force validation
                    if (!validateFormValues(true)) {
                        return;
                    }
                    // sending is disabled
                    Confirm c = new Confirm("Sending disabled", new Label("Sending form is disabled in preview mode, but form items value validation works."), true);
                    c.show();
                }
            });
        }
        // get localized texts
        ItemTexts itemTexts = item.getItemTexts(locale);
        if (!gen.isVisible()) {
            continue;
        }
        // WITH LABEL (input box ...)
        if (gen.isLabelShown()) {
            // 0 = label
            if (item.isRequired() == true) {
                // required
                ft.setHTML(i, 0, "<strong>" + gen.getLabelOrShortname() + "*</strong>");
            } else {
                // optional
                ft.setHTML(i, 0, "<strong>" + gen.getLabelOrShortname() + "</strong>");
            }
            // 1 = widget
            Widget w = gen.getWidget();
            w.setTitle(itemTexts.getHelp());
            ft.setWidget(i, 1, w);
            // 2 = status
            ft.setWidget(i, 2, gen.getStatusWidget());
            // 3 = HELP
            if (itemTexts.getHelp() != null && itemTexts.getHelp().length() > 0) {
                Label help = new Label(itemTexts.getHelp());
                ft.setWidget(i, 3, help);
            }
            // format
            fcf.setStyleName(i, 0, "applicationFormLabel");
            fcf.setStyleName(i, 1, "applicationFormWidget");
            fcf.setStyleName(i, 2, "applicationFormCheck");
            fcf.setStyleName(i, 3, "applicationFormHelp");
            ft.setWidth("100%");
        // ELSE HTML COMMENT
        } else {
            ft.setWidget(i, 0, gen.getWidget());
            // colspan = 2
            fcf.setColSpan(i, 0, 4);
            fcf.setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_LEFT);
            fcf.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
        }
        i++;
    }
    sp.setWidget(ft);
}
Also used : FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) FormValidator(cz.metacentrum.perun.webgui.client.applicationresources.FormValidator) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) RegistrarFormItemGenerator(cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator)

Example 2 with RegistrarFormItemGenerator

use of cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator in project perun by CESNET.

the class CreateFormItemTabItem method draw.

public Widget draw() {
    // vertical panel
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("425px", "100%");
    // flex table
    final FlexTable layout = new FlexTable();
    layout.setStyleName("inputFormFlexTable");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
    // select widget short name
    final ExtendedTextBox shortNameTextBox = new ExtendedTextBox();
    shortNameTextBox.setWidth("200px");
    final ExtendedTextBox.TextBoxValidator validator = new ExtendedTextBox.TextBoxValidator() {

        @Override
        public boolean validateTextBox() {
            if (shortNameTextBox.getTextBox().getText().trim().isEmpty()) {
                shortNameTextBox.setError("Short name can't be empty.");
                return false;
            } else {
                shortNameTextBox.setOk();
                return true;
            }
        }
    };
    shortNameTextBox.setValidator(validator);
    // select widget type
    final ListBox typeListBox = new ListBox();
    for (String type : inputTypes.keySet()) {
        typeListBox.addItem(inputTypes.get(type), type);
    }
    // insert after
    final ListBox insertAfterListBox = new ListBox();
    insertAfterListBox.addItem(" - insert to the beginning - ", 0 + "");
    for (int i = 0; i < sourceList.size(); i++) {
        ApplicationFormItem item = sourceList.get(i);
        // with default en locale
        RegistrarFormItemGenerator gen = new RegistrarFormItemGenerator(item, "");
        String label = gen.getFormItem().getShortname();
        // crop length
        if (label.length() > CROP_LABEL_LENGTH) {
            label = label.substring(0, CROP_LABEL_LENGTH);
        }
        // add to box
        insertAfterListBox.addItem(label, (i + 1) + "");
    }
    layout.setHTML(0, 0, "Short name:");
    layout.setWidget(0, 1, shortNameTextBox);
    layout.setHTML(1, 0, "Input widget:");
    layout.setWidget(1, 1, typeListBox);
    layout.setHTML(2, 0, "Insert after:");
    layout.setWidget(2, 1, insertAfterListBox);
    for (int i = 0; i < layout.getRowCount(); i++) {
        cellFormatter.addStyleName(i, 0, "itemName");
    }
    layout.setHTML(3, 0, "");
    cellFormatter.setColSpan(3, 0, 2);
    cellFormatter.setStyleName(3, 0, "inputFormInlineComment");
    typeListBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            String type = typeListBox.getValue(typeListBox.getSelectedIndex());
            if (type.equals("TEXTFIELD")) {
                layout.setHTML(3, 0, "Editable text field useful to gather short text input, e.g. name, phone.");
            } else if (type.equals("TEXTAREA")) {
                layout.setHTML(3, 0, "Editable text area useful to gather longer text input with linebreaks, e.g. comments, SSH key");
            } else if (type.equals("SELECTIONBOX")) {
                layout.setHTML(3, 0, "Simple selection box with defined custom values that user can choose.");
            } else if (type.equals("COMBOBOX")) {
                layout.setHTML(3, 0, "Selection box with defined custom values and one special option: \"--custom value--\", which allows users to input own text (as simple text field).");
            } else if (type.equals("CHECKBOX")) {
                layout.setHTML(3, 0, "List of defined custom options with checkboxes. Selected values are gathered as comma separated string.");
            } else if (type.equals("USERNAME")) {
                layout.setHTML(3, 0, "Special text field to gather user`s login. It checks login availability on user input.");
            } else if (type.equals("PASSWORD")) {
                layout.setHTML(3, 0, "Two password fields to gather user`s new password. Input is never displayed. User must type same password in both fields.");
            } else if (type.equals("VALIDATED_EMAIL")) {
                layout.setHTML(3, 0, "Special text field to gather and verify user`s email address. Input is checked on email address format. If user enters new value, then validation email is sent. Application then can't be approved unless provided email address is validated.");
            } else if (type.equals("SUBMIT_BUTTON")) {
                layout.setHTML(3, 0, "Button used to submit the form with custom label. All other form items are checked on valid input before submission. If it fails, form is not sent.");
            } else if (type.equals("AUTO_SUBMIT_BUTTON")) {
                layout.setHTML(3, 0, "Button used to auto-submit the form with custom label. All other form items are checked on valid input before submission. If validation fail (at least once) user must submit form manually. If it's OK, then form is automatically submitted.");
            } else if (type.equals("HTML_COMMENT")) {
                layout.setHTML(3, 0, "Item is used to display custom HTML content anywhere on form. Useful for explanation descriptions, dividing parts of form etc.");
            } else if (type.equals("HEADING")) {
                layout.setHTML(3, 0, "Item is used to display customizable heading of form. Can have any HTML content.");
            } else if (type.equals("TIMEZONE")) {
                layout.setHTML(3, 0, "Selection box with pre-defined values of UTC timezones.");
            } else if (type.equals("FROM_FEDERATION_HIDDEN")) {
                layout.setHTML(3, 0, "Non-editable and hidden form item. Form is submitted even on invalid input ! Useful to automatically gather information provided by AUTH mechanism (IdP federation, certificate).");
            } else if (type.equals("FROM_FEDERATION_SHOW")) {
                layout.setHTML(3, 0, "Non-editable and visible form item. Form is submitted even on invalid input ! Useful to automatically gather information provided by AUTH mechanism (IdP federation, certificate).");
            } else {
                layout.setHTML(3, 0, "");
            }
        }
    });
    layout.setHTML(3, 0, "Editable text field useful to gather short text input, e.g. name, phone.");
    TabMenu menu = new TabMenu();
    // create button
    menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CREATE, ButtonTranslation.INSTANCE.createFormItem(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (validator.validateTextBox()) {
                int positionToAdd = Integer.parseInt(insertAfterListBox.getValue(insertAfterListBox.getSelectedIndex()));
                String type = typeListBox.getValue(typeListBox.getSelectedIndex());
                String shortName = shortNameTextBox.getTextBox().getText().trim();
                createItem(shortName, type, positionToAdd);
            }
        }
    }));
    final TabItem tab = this;
    menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CANCEL, "", new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            session.getTabManager().closeTab(tab, false);
        }
    }));
    vp.add(layout);
    vp.add(menu);
    vp.setCellHorizontalAlignment(menu, HasHorizontalAlignment.ALIGN_RIGHT);
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ExtendedTextBox(cz.metacentrum.perun.webgui.widgets.ExtendedTextBox) JSONString(com.google.gwt.json.client.JSONString) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ApplicationFormItem(cz.metacentrum.perun.webgui.model.ApplicationFormItem) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) RegistrarFormItemGenerator(cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler)

Example 3 with RegistrarFormItemGenerator

use of cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator in project perun by CESNET.

the class GetFormItemsWithPrefilledValues method getValues.

/**
	 * Generates the values from the form
	 *
	 * @return
	 */
public ArrayList<ApplicationFormItemData> getValues() {
    ArrayList<ApplicationFormItemData> formItemDataList = new ArrayList<ApplicationFormItemData>();
    // goes through all the item generators and retrieves the value
    for (RegistrarFormItemGenerator gen : applFormGenerators) {
        String value = gen.getValue();
        String prefilled = gen.getPrefilledValue();
        JSONObject formItemJSON = new JSONObject(gen.getFormItem());
        // remove text (locale), saves data transfer & removes problem with parsing locale
        formItemJSON.put("i18n", new JSONObject());
        // cast form item back
        ApplicationFormItem formItem = formItemJSON.getJavaScriptObject().cast();
        // prepare package with data
        ApplicationFormItemData data = ApplicationFormItemData.construct(formItem, formItem.getShortname(), value, prefilled, gen.getAssuranceLevel() != null ? gen.getAssuranceLevel() : "");
        formItemDataList.add(data);
    }
    return formItemDataList;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) RegistrarFormItemGenerator(cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator) ArrayList(java.util.ArrayList)

Example 4 with RegistrarFormItemGenerator

use of cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator in project perun by CESNET.

the class GetApplicationDataById method prepareApplicationForm.

/**
	 * Prepares the widgets from the items as A DISPLAY FOR THE USER
	 */
public void prepareApplicationForm() {
    FlexTable ft = new FlexTable();
    ft.setWidth("100%");
    ft.setCellPadding(10);
    FlexCellFormatter fcf = ft.getFlexCellFormatter();
    String locale = "en";
    if (!Utils.getNativeLanguage().isEmpty() && !LocaleInfo.getCurrentLocale().getLocaleName().equals("default") && !LocaleInfo.getCurrentLocale().getLocaleName().equals("en")) {
        locale = Utils.getNativeLanguage().get(0);
    }
    int i = 0;
    for (final ApplicationFormItemData item : applFormItems) {
        RegistrarFormItemGenerator gen = new RegistrarFormItemGenerator(item.getFormItem(), item.getValue(), locale);
        this.applFormGenerators.add(gen);
        // show only visible items - show also hidden to perun admin and vo/group admin
        if (!gen.isVisible() && !(session.isPerunAdmin() || session.isVoAdmin() || session.isGroupAdmin())) {
            continue;
        }
        // if only for admin
        if (!showAdminItems && gen.isVisibleOnlyToAdmin()) {
            continue;
        }
        // WITH LABEL (input box ...)
        if (gen.isLabelShown()) {
            // don't show password
            if (!item.getFormItem().getType().equalsIgnoreCase("PASSWORD")) {
                // 0 = label or shortname
                if (item.getFormItem().getType().startsWith("FROM_FEDERATION_HIDDEN")) {
                    // hidden
                    ft.setHTML(i, 0, "<strong>" + gen.getLabelOrShortname() + "</strong><br /><i>(value provided by external source)</i>");
                } else if (item.getFormItem().getType().startsWith("FROM_FEDERATION_SHOW")) {
                    // show
                    ft.setHTML(i, 0, "<strong>" + gen.getLabelOrShortname() + "</strong><br /><i>(value provided by external source)</i>");
                } else {
                    ft.setHTML(i, 0, "<strong>" + gen.getLabelOrShortname() + "</strong>");
                }
                // 1 = value
                ft.setWidget(i, 1, new HTML(item.getValue()));
                // format
                fcf.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_TOP);
                fcf.setVerticalAlignment(i, 1, HasVerticalAlignment.ALIGN_TOP);
                fcf.setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
                fcf.setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_LEFT);
                fcf.setWidth(i, 0, "25%");
                fcf.setWidth(i, 1, "75%");
            }
        }
        i++;
    }
    // set empty text
    if (!applFormItems.isEmpty()) {
        contents.setWidget(ft);
    }
}
Also used : RegistrarFormItemGenerator(cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) ApplicationFormItemData(cz.metacentrum.perun.webgui.model.ApplicationFormItemData)

Example 5 with RegistrarFormItemGenerator

use of cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator in project perun by CESNET.

the class GetFormItems method prepareSettings.

/**
	 * Prepares the widgets from the items as A FORM FOR SETTINGS
	 *
	 * @param items
	 */
public void prepareSettings(final ArrayList<ApplicationFormItem> items) {
    // refresh table events
    final JsonCallbackEvents refreshEvents = new JsonCallbackEvents() {

        public void onFinished(JavaScriptObject jso) {
            prepareSettings(items);
        }
    };
    FlexTable ft = new FlexTable();
    ft.setWidth("100%");
    ft.setCellPadding(8);
    FlexCellFormatter fcf = ft.getFlexCellFormatter();
    ft.addStyleName("borderTable");
    ft.setHTML(0, 0, "<strong>Short name</strong>");
    ft.setHTML(0, 1, "<strong>Type</strong>");
    ft.setHTML(0, 2, "<strong>Preview</strong>");
    ft.setHTML(0, 3, "<strong>Edit</strong>");
    fcf.setStyleName(0, 0, "header");
    fcf.setStyleName(0, 1, "header");
    fcf.setStyleName(0, 2, "header");
    fcf.setStyleName(0, 3, "header");
    String locale = "en";
    if (!Utils.getNativeLanguage().isEmpty() && !LocaleInfo.getCurrentLocale().getLocaleName().equals("default") && !LocaleInfo.getCurrentLocale().getLocaleName().equals("en")) {
        locale = Utils.getNativeLanguage().get(0);
    }
    int i = 1;
    for (final ApplicationFormItem item : items) {
        final int index = i - 1;
        // not yet set locale on config page
        RegistrarFormItemGenerator gen = new RegistrarFormItemGenerator(item, locale);
        // 0 = label
        String label = "";
        label = item.getShortname();
        if (item.isRequired() == true) {
            label += "*";
        }
        ft.setHTML(i, 0, label);
        // 1 = type
        Label type_label = new Label(CreateFormItemTabItem.inputTypes.get(item.getType()));
        type_label.setTitle(item.getType());
        ft.setWidget(i, 1, type_label);
        // 2 = preview
        Widget w = gen.getWidget();
        ft.setWidget(i, 2, w);
        // 3 = EDIT
        FlexTable editTable = new FlexTable();
        editTable.setStyleName("noBorder");
        ft.setWidget(i, 3, editTable);
        // color for items with unsaved changes
        if (item.wasEdited() == true) {
            ft.getFlexCellFormatter().setStyleName(i, 0, "log-changed");
            ft.getFlexCellFormatter().setStyleName(i, 1, "log-changed");
            ft.getFlexCellFormatter().setStyleName(i, 2, "log-changed");
            ft.getFlexCellFormatter().setStyleName(i, 3, "log-changed");
        }
        // mark row for deletion
        if (item.isForDelete()) {
            ft.getFlexCellFormatter().setStyleName(i, 0, "log-error");
            ft.getFlexCellFormatter().setStyleName(i, 1, "log-error");
            ft.getFlexCellFormatter().setStyleName(i, 2, "log-error");
            ft.getFlexCellFormatter().setStyleName(i, 3, "log-error");
            // undelete button
            CustomButton undelete = new CustomButton(ButtonTranslation.INSTANCE.undeleteFormItemButton(), ButtonTranslation.INSTANCE.undeleteFormItem(), SmallIcons.INSTANCE.arrowLeftIcon(), new ClickHandler() {

                public void onClick(ClickEvent event) {
                    items.get(index).setForDelete(false);
                    // refresh
                    prepareSettings(items);
                }
            });
            FlexTable undelTable = new FlexTable();
            undelTable.setStyleName("noBorder");
            undelTable.setHTML(0, 0, "<strong><span style=\"color:red;\">MARKED FOR DELETION</span></strong>");
            undelTable.setWidget(0, 1, undelete);
            ft.setWidget(i, 3, undelTable);
        }
        // color for new items to be saved
        if (item.getId() == 0) {
            ft.getFlexCellFormatter().setStyleName(i, 0, "log-success");
            ft.getFlexCellFormatter().setStyleName(i, 1, "log-success");
            ft.getFlexCellFormatter().setStyleName(i, 2, "log-success");
            ft.getFlexCellFormatter().setStyleName(i, 3, "log-success");
        }
        // up
        PushButton upButton = new PushButton(new Image(SmallIcons.INSTANCE.arrowUpIcon()), new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (index - 1 < 0) {
                    // move to the bottom
                    items.remove(index);
                    items.add(item);
                    for (int i = 0; i < items.size(); i++) {
                        items.get(i).setOrdnum(i);
                    }
                } else {
                    // move it up
                    items.remove(index);
                    items.add(index - 1, item);
                    item.setOrdnum(item.getOrdnum() - 1);
                }
                item.setEdited(true);
                // refresh
                prepareSettings(items);
            }
        });
        editTable.setWidget(0, 0, upButton);
        upButton.setTitle(ButtonTranslation.INSTANCE.moveFormItemUp());
        // down
        PushButton downButton = new PushButton(new Image(SmallIcons.INSTANCE.arrowDownIcon()), new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (index + 1 >= items.size()) {
                    // move to the top
                    items.remove(index);
                    items.add(0, item);
                    for (int i = 0; i < items.size(); i++) {
                        items.get(i).setOrdnum(i);
                    }
                } else {
                    // move it down
                    items.remove(index);
                    items.add(index + 1, item);
                    item.setOrdnum(item.getOrdnum() + 1);
                }
                item.setEdited(true);
                // refresh
                prepareSettings(items);
            }
        });
        editTable.setWidget(0, 1, downButton);
        downButton.setTitle(ButtonTranslation.INSTANCE.moveFormItemDown());
        // edit
        CustomButton editButton = new CustomButton(ButtonTranslation.INSTANCE.editFormItemButton(), ButtonTranslation.INSTANCE.editFormItem(), SmallIcons.INSTANCE.applicationFormEditIcon());
        editButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                session.getTabManager().addTabToCurrentTab(new EditFormItemTabItem(item, refreshEvents));
            }
        });
        editTable.setWidget(0, 2, editButton);
        // remove
        CustomButton removeButton = new CustomButton(ButtonTranslation.INSTANCE.deleteButton(), ButtonTranslation.INSTANCE.deleteFormItem(), SmallIcons.INSTANCE.deleteIcon());
        removeButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                boolean forDelete = false;
                for (ApplicationFormItem it : items) {
                    if (it.isForDelete())
                        forDelete = true;
                }
                if (forDelete) {
                    // mark for deletion when save changes
                    items.get(index).setForDelete(true);
                    // remove if newly created
                    if (items.get(index).getId() == 0) {
                        items.remove(index);
                    }
                    // refresh
                    prepareSettings(items);
                } else {
                    HTML text = new HTML("<p>Deleting of form items is <strong>NOT RECOMMENDED!</strong><p>You will loose access to data users submitted in older applications within this form item!<p>Do you want to continue?");
                    Confirm c = new Confirm("Delete confirm", text, new ClickHandler() {

                        public void onClick(ClickEvent event) {
                            // mark for deletion when save changes
                            items.get(index).setForDelete(true);
                            // remove if newly created
                            if (items.get(index).getId() == 0) {
                                items.remove(index);
                            }
                            // refresh
                            prepareSettings(items);
                        }
                    }, true);
                    c.setNonScrollable(true);
                    c.show();
                }
            }
        });
        editTable.setWidget(0, 3, removeButton);
        if ((PerunEntity.GROUP.equals(entity) && !session.isGroupAdmin(id) && !session.isVoAdmin(group.getVoId())) || (PerunEntity.VIRTUAL_ORGANIZATION.equals(entity) && !session.isVoAdmin(id))) {
            editButton.setEnabled(false);
            upButton.setEnabled(false);
            downButton.setEnabled(false);
            removeButton.setEnabled(false);
        }
        // format
        fcf.setHeight(i, 0, "28px");
        fcf.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
        fcf.setVerticalAlignment(i, 1, HasVerticalAlignment.ALIGN_MIDDLE);
        fcf.setVerticalAlignment(i, 2, HasVerticalAlignment.ALIGN_MIDDLE);
        i++;
    }
    // set empty table widget
    if (items == null || items.isEmpty()) {
        ft.setWidget(1, 0, loaderImage);
        ft.getFlexCellFormatter().addStyleName(1, 0, "noBorder");
        ft.getFlexCellFormatter().setColSpan(1, 0, 4);
    }
    contents.setWidget(ft);
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) AjaxLoaderImage(cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage) EditFormItemTabItem(cz.metacentrum.perun.webgui.tabs.registrartabs.EditFormItemTabItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) RegistrarFormItemGenerator(cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton)

Aggregations

RegistrarFormItemGenerator (cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator)10 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)6 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 JSONObject (com.google.gwt.json.client.JSONObject)2 FormValidator (cz.metacentrum.perun.webgui.client.applicationresources.FormValidator)2 Confirm (cz.metacentrum.perun.webgui.widgets.Confirm)2 ArrayList (java.util.ArrayList)2 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 JSONString (com.google.gwt.json.client.JSONString)1 Element (com.google.gwt.user.client.Element)1 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)1 ApplicationFormItem (cz.metacentrum.perun.webgui.model.ApplicationFormItem)1 ApplicationFormItemData (cz.metacentrum.perun.webgui.model.ApplicationFormItemData)1 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)1 EditFormItemTabItem (cz.metacentrum.perun.webgui.tabs.registrartabs.EditFormItemTabItem)1 AjaxLoaderImage (cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage)1 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)1