Search in sources :

Example 1 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project kapua by eclipse.

the class AccountForm method onRender.

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    FormData formData = new FormData("-30");
    m_formPanel = new FormPanel();
    m_formPanel.setFrame(false);
    m_formPanel.setBodyBorder(true);
    m_formPanel.setHeaderVisible(false);
    m_formPanel.setScrollMode(Scroll.AUTOY);
    m_formPanel.setLayout(new FlowLayout());
    // //////////////////////////////////////////
    // Account Information field set
    // //////////////////////////////////////////
    FieldSet fieldSet = new FieldSet();
    fieldSet.setHeading(MSGS.accountFormInformation());
    FormLayout layoutAccount = new FormLayout();
    layoutAccount.setLabelWidth(LABEL_WIDTH_FORM);
    fieldSet.setLayout(layoutAccount);
    // 
    // Show parent account name
    // 
    final LabelField parentAccountName = new LabelField();
    parentAccountName.setName("parentAccountName");
    parentAccountName.setFieldLabel(MSGS.accountFormParentAccount());
    parentAccountName.setLabelSeparator(":");
    fieldSet.add(parentAccountName, formData);
    // 
    // Account name field
    // 
    final LabelField accountNameLabel = new LabelField();
    accountNameLabel.setName("accountNameLabel");
    accountNameLabel.setFieldLabel(MSGS.accountFormName());
    accountNameLabel.setLabelSeparator(":");
    fieldSet.add(accountNameLabel, formData);
    final TextField<String> accountNameField = new TextField<String>();
    accountNameField.setAllowBlank(false);
    accountNameField.setName("accountName");
    accountNameField.setFieldLabel("* " + MSGS.accountFormName());
    accountNameField.setValidator(new TextFieldValidator(accountNameField, FieldType.SIMPLE_NAME));
    fieldSet.add(accountNameField, formData);
    // 
    // passwords
    // 
    final TextField<String> accountPassword = new TextField<String>();
    accountPassword.setAllowBlank(false);
    accountPassword.setName("accountPassword");
    accountPassword.setFieldLabel("* " + MSGS.accountFormPassword());
    accountPassword.setValidator(new TextFieldValidator(accountPassword, FieldType.PASSWORD));
    accountPassword.setPassword(true);
    fieldSet.add(accountPassword, formData);
    // 
    // Confirm password
    // 
    final TextField<String> confirmPassword = new TextField<String>();
    confirmPassword.setAllowBlank(false);
    confirmPassword.setName("confirmPassword");
    confirmPassword.setFieldLabel("* " + MSGS.accountFormConfirmPassword());
    confirmPassword.setValidator(new ConfirmPasswordFieldValidator(confirmPassword, accountPassword));
    confirmPassword.setPassword(true);
    fieldSet.add(confirmPassword, formData);
    m_formPanel.add(fieldSet);
    // //////////////////////////////////////////
    // Deployment Information field set
    // //////////////////////////////////////////
    FieldSet fieldSetDeployment = new FieldSet();
    fieldSetDeployment.setHeading(MSGS.accountFormDeploymentInformation());
    FormLayout layoutDeployment = new FormLayout();
    layoutDeployment.setLabelWidth(LABEL_WIDTH_FORM);
    fieldSetDeployment.setLayout(layoutDeployment);
    // 
    // broker cluster
    // 
    final LabelField accountClusterLabel = new LabelField();
    accountClusterLabel.setName("accountBrokerLabel");
    accountClusterLabel.setFieldLabel(MSGS.accountFormBrokerCluster());
    accountClusterLabel.setLabelSeparator(":");
    fieldSetDeployment.add(accountClusterLabel, formData);
    final NumberField optlock = new NumberField();
    optlock.setName("optlock");
    optlock.setEditable(false);
    optlock.setVisible(false);
    fieldSetDeployment.add(optlock, formData);
    // add the field set and reset
    m_formPanel.add(fieldSetDeployment);
    // //////////////////////////////////////////
    // Organization Information field set
    // //////////////////////////////////////////
    FieldSet fieldSetOrg = new FieldSet();
    fieldSetOrg.setHeading(MSGS.accountFormOrgInformation());
    FormLayout layoutOrg = new FormLayout();
    layoutOrg.setLabelWidth(LABEL_WIDTH_FORM);
    fieldSetOrg.setLayout(layoutOrg);
    // 
    // Organization name
    // 
    final TextField<String> organizationName = new TextField<String>();
    organizationName.setAllowBlank(false);
    organizationName.setName("organizationName");
    organizationName.setFieldLabel("* " + MSGS.accountFormOrgName());
    fieldSetOrg.add(organizationName, formData);
    // 
    // Organization email
    // 
    final TextField<String> organizationEmail = new TextField<String>();
    organizationEmail.setAllowBlank(false);
    organizationEmail.setName("organizationEmail");
    organizationEmail.setFieldLabel("* " + MSGS.accountFormOrgEmail());
    organizationEmail.setValidator(new TextFieldValidator(organizationEmail, FieldType.EMAIL));
    fieldSetOrg.add(organizationEmail, formData);
    // //////////////////////////////////////////
    // Organization Information sub field set
    // //////////////////////////////////////////
    FieldSet organizationSubFieldSet = new FieldSet();
    organizationSubFieldSet.setHeading(MSGS.accountFormOrgMoreInformation());
    organizationSubFieldSet.setBorders(false);
    organizationSubFieldSet.setCollapsible(true);
    organizationSubFieldSet.setWidth(515);
    FormLayout organizationSubLayout = new FormLayout();
    organizationSubLayout.setLabelWidth(LABEL_WIDTH_FORM - 11);
    organizationSubFieldSet.setLayout(organizationSubLayout);
    // 
    // Other organization data
    // 
    FormData subFieldsetFormData = new FormData("-7");
    final TextField<String> organizationPersonName = new TextField<String>();
    organizationPersonName.setName("organizationPersonName");
    organizationPersonName.setFieldLabel(MSGS.accountFormOrgPersonName());
    organizationSubFieldSet.add(organizationPersonName, subFieldsetFormData);
    final TextField<String> organizationPhoneNumber = new TextField<String>();
    organizationPhoneNumber.setName("organizationPhoneNumber");
    organizationPhoneNumber.setFieldLabel(MSGS.accountFormOrgPhoneNumber());
    organizationSubFieldSet.add(organizationPhoneNumber, subFieldsetFormData);
    final TextField<String> organizationAddressLine1 = new TextField<String>();
    organizationAddressLine1.setName("organizationAddressLine1");
    organizationAddressLine1.setFieldLabel(MSGS.accountFormOrgAddress1());
    organizationSubFieldSet.add(organizationAddressLine1, subFieldsetFormData);
    final TextField<String> organizationAddressLine2 = new TextField<String>();
    organizationAddressLine2.setName("organizationAddressLine2");
    organizationAddressLine2.setFieldLabel(MSGS.accountFormOrgAddress2());
    organizationSubFieldSet.add(organizationAddressLine2, subFieldsetFormData);
    final TextField<String> organizationZipPostCode = new TextField<String>();
    organizationZipPostCode.setName("organizationZipPostCode");
    organizationZipPostCode.setFieldLabel(MSGS.accountFormOrgZipPostCode());
    organizationSubFieldSet.add(organizationZipPostCode, subFieldsetFormData);
    final TextField<String> organizationCity = new TextField<String>();
    organizationCity.setName("organizationCity");
    organizationCity.setFieldLabel(MSGS.accountFormOrgCity());
    organizationSubFieldSet.add(organizationCity, subFieldsetFormData);
    final TextField<String> organizationStateProvinceCounty = new TextField<String>();
    organizationStateProvinceCounty.setName("organizationStateProvinceCounty");
    organizationStateProvinceCounty.setFieldLabel(MSGS.accountFormOrgState());
    organizationSubFieldSet.add(organizationStateProvinceCounty, subFieldsetFormData);
    final TextField<String> organizationCountry = new TextField<String>();
    organizationCountry.setName("organizationCountry");
    organizationCountry.setFieldLabel(MSGS.accountFormOrgCountry());
    organizationSubFieldSet.add(organizationCountry, subFieldsetFormData);
    // add the field set and reset
    fieldSetOrg.add(organizationSubFieldSet);
    m_formPanel.add(fieldSetOrg);
    // 
    if (m_existingAccount == null) {
        // Show editable name, password, confirm password
        accountNameLabel.setVisible(false);
        accountClusterLabel.setVisible(false);
    } else // 
    // If is an update of an existing account
    // 
    {
        // Show parent account name and account name
        accountNameField.setVisible(false);
        accountPassword.setVisible(false);
        confirmPassword.setVisible(false);
    }
    m_status = new Status();
    m_status.setBusy(MSGS.waitMsg());
    m_status.hide();
    m_status.setAutoWidth(true);
    m_formPanel.setButtonAlign(HorizontalAlignment.LEFT);
    m_formPanel.getButtonBar().add(m_status);
    m_formPanel.getButtonBar().add(new FillToolItem());
    // 
    // Behave of Submit Button
    // 
    m_formPanel.addButton(new Button(MSGS.submitButton(), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            // make sure all visible fields are valid before performing the action
            for (Field<?> field : m_formPanel.getFields()) {
                if (field.isVisible() && !field.isValid()) {
                    MessageBox.alert(MSGS.error(), MSGS.formErrors(), null);
                    return;
                }
            }
            // 
            // Hold the dialog until the action comes back
            m_status.show();
            m_formPanel.getButtonBar().disable();
            // 
            if (m_existingAccount == null) {
                final GwtAccountCreator gwtAccountCreator = new GwtAccountCreator();
                gwtAccountCreator.setParentAccountId(m_currentSession.getSelectedAccount().getId());
                gwtAccountCreator.setAccountName(accountNameField.getValue());
                gwtAccountCreator.setAccountPassword(accountPassword.getValue());
                // Organization data
                gwtAccountCreator.setOrganizationName(organizationName.getValue());
                gwtAccountCreator.setOrganizationPersonName(organizationPersonName.getValue());
                gwtAccountCreator.setOrganizationEmail(organizationEmail.getValue());
                gwtAccountCreator.setOrganizationPhoneNumber(organizationPhoneNumber.getValue());
                gwtAccountCreator.setOrganizationAddressLine1(organizationAddressLine1.getValue());
                gwtAccountCreator.setOrganizationAddressLine2(organizationAddressLine2.getValue());
                gwtAccountCreator.setOrganizationCity(organizationCity.getValue());
                gwtAccountCreator.setOrganizationZipPostCode(organizationZipPostCode.getValue());
                gwtAccountCreator.setOrganizationStateProvinceCounty(organizationStateProvinceCounty.getValue());
                gwtAccountCreator.setOrganizationCountry(organizationCountry.getValue());
                // 
                // Call to create an account
                // Getting XSRF token
                gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

                    @Override
                    public void onFailure(Throwable ex) {
                        FailureHandler.handle(ex);
                    }

                    @Override
                    public void onSuccess(GwtXSRFToken token) {
                        gwtAccountService.create(token, gwtAccountCreator, new AsyncCallback<GwtAccount>() {

                            public void onFailure(Throwable caught) {
                                FailureHandler.handleFormException(m_formPanel, caught);
                                m_status.hide();
                                m_formPanel.getButtonBar().enable();
                            }

                            public void onSuccess(GwtAccount account) {
                                ConsoleInfo.display(MSGS.info(), MSGS.accountCreatedConfirmation(account.getUnescapedName()));
                                m_newAccount = account;
                                // gwtAccountUtils.loadChildAccounts();
                                hide();
                            }
                        });
                    }
                });
            } else // 
            // Update the account
            // 
            {
                // Organization data
                GwtOrganization gwtOrganization = new GwtOrganization();
                gwtOrganization.setName(organizationName.getValue());
                gwtOrganization.setPersonName(organizationPersonName.getValue());
                gwtOrganization.setEmailAddress(organizationEmail.getValue());
                gwtOrganization.setPhoneNumber(organizationPhoneNumber.getValue());
                gwtOrganization.setAddressLine1(organizationAddressLine1.getValue());
                gwtOrganization.setAddressLine2(organizationAddressLine2.getValue());
                gwtOrganization.setZipPostCode(organizationZipPostCode.getValue());
                gwtOrganization.setCity(organizationCity.getValue());
                gwtOrganization.setStateProvinceCounty(organizationStateProvinceCounty.getValue());
                gwtOrganization.setCountry(organizationCountry.getValue());
                m_existingAccount.setGwtOrganization(gwtOrganization);
                // 
                // Call to update the account
                // Getting XSRF token
                gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

                    @Override
                    public void onFailure(Throwable ex) {
                        FailureHandler.handle(ex);
                    }

                    @Override
                    public void onSuccess(GwtXSRFToken token) {
                        gwtAccountService.update(token, m_existingAccount, new AsyncCallback<GwtAccount>() {

                            public void onFailure(Throwable caught) {
                                FailureHandler.handleFormException(m_formPanel, caught);
                                m_status.hide();
                                m_formPanel.getButtonBar().enable();
                            }

                            public void onSuccess(GwtAccount account) {
                                ConsoleInfo.display(MSGS.info(), MSGS.accountUpdatedConfirmation(account.getUnescapedName()));
                                m_existingAccount = account;
                                hide();
                            }
                        });
                    }
                });
            }
        }
    }));
    // 
    // Cancel Button
    // 
    m_formPanel.addButton(new Button(MSGS.cancelButton(), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            hide();
        }
    }));
    m_formPanel.setButtonAlign(HorizontalAlignment.CENTER);
    // 
    // Populate field if necessary
    // 
    parentAccountName.setValue(m_currentSession.getSelectedAccount().getName());
    if (m_existingAccount != null) {
        gwtAccountService.find(m_existingAccount.getId(), new AsyncCallback<GwtAccount>() {

            public void onFailure(Throwable caught) {
                FailureHandler.handle(caught);
            }

            public void onSuccess(GwtAccount account) {
                // set value and original value as we want to track the Dirty state
                accountNameLabel.setValue(account.getName());
                accountNameField.setValue(account.getName());
                accountNameField.setOriginalValue(account.getName());
                accountClusterLabel.setValue(account.getBrokerURL());
                organizationName.setValue(account.getGwtOrganization().getName());
                organizationName.setOriginalValue(account.getGwtOrganization().getName());
                organizationPersonName.setValue(account.getGwtOrganization().getPersonName());
                organizationPersonName.setOriginalValue(account.getGwtOrganization().getPersonName());
                organizationEmail.setValue(account.getGwtOrganization().getEmailAddress());
                organizationEmail.setOriginalValue(account.getGwtOrganization().getEmailAddress());
                organizationPhoneNumber.setValue(account.getGwtOrganization().getPhoneNumber());
                organizationPhoneNumber.setOriginalValue(account.getGwtOrganization().getPhoneNumber());
                organizationAddressLine1.setValue(account.getGwtOrganization().getAddressLine1());
                organizationAddressLine1.setOriginalValue(account.getGwtOrganization().getAddressLine1());
                organizationAddressLine2.setValue(account.getGwtOrganization().getAddressLine2());
                organizationAddressLine2.setOriginalValue(account.getGwtOrganization().getAddressLine2());
                organizationZipPostCode.setValue(account.getGwtOrganization().getZipPostCode());
                organizationZipPostCode.setOriginalValue(account.getGwtOrganization().getZipPostCode());
                organizationCity.setValue(account.getGwtOrganization().getCity());
                organizationCity.setOriginalValue(account.getGwtOrganization().getCity());
                organizationStateProvinceCounty.setValue(account.getGwtOrganization().getStateProvinceCounty());
                organizationStateProvinceCounty.setOriginalValue(account.getGwtOrganization().getStateProvinceCounty());
                organizationCountry.setValue(account.getGwtOrganization().getCountry());
                organizationCountry.setOriginalValue(account.getGwtOrganization().getCountry());
                optlock.setValue(account.getOptlock());
            }
        });
    }
    add(m_formPanel);
}
Also used : FlowLayout(com.extjs.gxt.ui.client.widget.layout.FlowLayout) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) GwtXSRFToken(org.eclipse.kapua.app.console.shared.model.GwtXSRFToken) FieldSet(com.extjs.gxt.ui.client.widget.form.FieldSet) Button(com.extjs.gxt.ui.client.widget.button.Button) GwtOrganization(org.eclipse.kapua.app.console.shared.model.GwtOrganization) ConfirmPasswordFieldValidator(org.eclipse.kapua.app.console.client.util.ConfirmPasswordFieldValidator) TextField(com.extjs.gxt.ui.client.widget.form.TextField) LabelField(com.extjs.gxt.ui.client.widget.form.LabelField) FormData(com.extjs.gxt.ui.client.widget.layout.FormData) FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) Status(com.extjs.gxt.ui.client.widget.Status) GwtAccount(org.eclipse.kapua.app.console.shared.model.GwtAccount) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) GwtAccountCreator(org.eclipse.kapua.app.console.shared.model.GwtAccountCreator) TextFieldValidator(org.eclipse.kapua.app.console.client.util.TextFieldValidator) FillToolItem(com.extjs.gxt.ui.client.widget.toolbar.FillToolItem) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener)

Example 2 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project kapua by eclipse.

the class DeviceConfigPanel method paintConfig.

private void paintConfig() {
    LayoutContainer lcAction = new LayoutContainer();
    lcAction.setLayout(new BorderLayout());
    lcAction.setBorders(true);
    lcAction.setSize(475, -1);
    add(lcAction);
    // center panel: action form
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER, .75F);
    centerData.setSplit(false);
    centerData.setMargins(new Margins(0, 0, 0, 0));
    FormData formData = new FormData("-20");
    formData.setMargins(new Margins(0, 10, 0, 0));
    if (!UserAgentUtils.isIE()) {
        m_actionFormPanel = new FormPanel();
        m_actionFormPanel.setFrame(false);
        m_actionFormPanel.setBodyBorder(false);
        m_actionFormPanel.setHeaderVisible(false);
        m_actionFormPanel.setLabelWidth(Constants.LABEL_WIDTH_CONFIG_FORM);
        m_actionFormPanel.setStyleAttribute("padding", "0px");
        m_actionFormPanel.setScrollMode(Scroll.AUTO);
        m_actionFormPanel.setLayout(new FlowLayout());
        m_actionFormPanel.addListener(Events.Render, new Listener<BaseEvent>() {

            public void handleEvent(BaseEvent be) {
                NodeList<Element> nl = m_actionFormPanel.getElement().getElementsByTagName("form");
                if (nl.getLength() > 0) {
                    Element elemForm = nl.getItem(0);
                    elemForm.setAttribute("autocomplete", "off");
                }
            }
        });
    }
    m_actionFieldSet = new FieldSet();
    m_actionFieldSet.setId("configuration-form");
    m_actionFieldSet.setBorders(false);
    m_actionFieldSet.setStyleAttribute("padding", "0px");
    m_actionFieldSet.setScrollMode(Scroll.AUTO);
    if (m_configComponent.getComponentDescription() != null && m_configComponent.getComponentDescription().trim().length() > 0) {
        m_actionFieldSet.addText(KapuaSafeHtmlUtils.htmlEscape(m_configComponent.getComponentDescription()));
    }
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(Constants.LABEL_WIDTH_CONFIG_FORM);
    m_actionFieldSet.setLayout(layout);
    Field<?> field = null;
    for (GwtConfigParameter param : m_configComponent.getParameters()) {
        if (param.getCardinality() == 0 || param.getCardinality() == 1 || param.getCardinality() == -1) {
            field = paintConfigParameter(param);
        } else {
            field = paintMultiFieldConfigParameter(param);
        }
        m_actionFieldSet.add(field, formData);
    }
    if (!UserAgentUtils.isIE()) {
        m_actionFormPanel.add(m_actionFieldSet, formData);
        lcAction.add(m_actionFormPanel, centerData);
    } else {
        lcAction.add(m_actionFieldSet, centerData);
    }
}
Also used : FormData(com.extjs.gxt.ui.client.widget.layout.FormData) FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) FlowLayout(com.extjs.gxt.ui.client.widget.layout.FlowLayout) BorderLayoutData(com.extjs.gxt.ui.client.widget.layout.BorderLayoutData) NodeList(com.google.gwt.dom.client.NodeList) Element(com.google.gwt.dom.client.Element) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) FieldSet(com.extjs.gxt.ui.client.widget.form.FieldSet) BorderLayout(com.extjs.gxt.ui.client.widget.layout.BorderLayout) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) GwtConfigParameter(org.eclipse.kapua.app.console.shared.model.GwtConfigParameter) Margins(com.extjs.gxt.ui.client.util.Margins)

Example 3 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project kapua by eclipse.

the class PackageInstallDialog method createTabItems.

@Override
public void createTabItems() {
    // Deployment package info tab content
    {
        FormData formData = new FormData("-15");
        FormLayout formLayout = new FormLayout();
        formLayout.setLabelWidth(FORM_LABEL_WIDTH);
        packageInfoForm = new FormPanel();
        packageInfoForm.setFrame(false);
        packageInfoForm.setHeaderVisible(false);
        packageInfoForm.setBodyBorder(false);
        packageInfoForm.setBorders(false);
        packageInfoForm.setLayout(formLayout);
        dpInfoText = new Text();
        dpInfoText.setText(MSGS.packageInstallDpInfo());
        dpInfoText.setStyleAttribute("margin-bottom", "10px");
        packageInfoForm.add(dpInfoText);
        dpURIField = new TextField<String>();
        dpURIField.setName("dpUri");
        dpURIField.setAllowBlank(false);
        dpURIField.setFieldLabel("* " + MSGS.packageInstallDpTabUri());
        packageInfoForm.add(dpURIField, formData);
        dpNameField = new TextField<String>();
        dpNameField.setName("dpName");
        dpNameField.setAllowBlank(false);
        dpNameField.setFieldLabel("* " + MSGS.packageInstallDpTabName());
        packageInfoForm.add(dpNameField, formData);
        dpVersionField = new TextField<String>();
        dpVersionField.setName("dpVersion");
        dpVersionField.setAllowBlank(false);
        dpVersionField.setFieldLabel("* " + MSGS.packageInstallDpTabVersion());
        packageInfoForm.add(dpVersionField, formData);
    }
    // Operation options tab content
    {
        FormData formData = new FormData("-10");
        FormLayout formLayout = new FormLayout();
        formLayout.setLabelWidth(FORM_LABEL_WIDTH);
        operationOptionsForm = new FormPanel();
        operationOptionsForm.setFrame(false);
        operationOptionsForm.setHeaderVisible(false);
        operationOptionsForm.setBodyBorder(false);
        operationOptionsForm.setBorders(false);
        operationOptionsForm.setLayout(formLayout);
        operationInfoText = new Text();
        operationInfoText.setText(MSGS.packageInstallOperationInfo());
        operationInfoText.setStyleAttribute("margin-bottom", "5px");
        operationOptionsForm.add(operationInfoText);
        operationRebootField = new CheckBox();
        operationRebootField.setName("reboot");
        operationRebootField.setFieldLabel(MSGS.packageInstallOperationTabReboot());
        operationRebootField.setBoxLabel("");
        operationRebootField.addListener(Events.Change, new Listener<BaseEvent>() {

            @Override
            public void handleEvent(BaseEvent be) {
                if (operationRebootField.getValue()) {
                    operationRebootDelayField.enable();
                } else {
                    operationRebootDelayField.disable();
                }
            }
        });
        operationOptionsForm.add(operationRebootField, formData);
        operationRebootDelayField = new NumberField();
        operationRebootDelayField.setName("installRebootDelay");
        operationRebootDelayField.setFieldLabel(MSGS.packageInstallOperationTabRebootDelay());
        operationRebootDelayField.setEmptyText("0");
        operationRebootDelayField.setAllowDecimals(false);
        operationRebootDelayField.setAllowNegative(false);
        operationOptionsForm.add(operationRebootDelayField, formData);
    }
    // 
    // Tabs setup
    packageInfoTab = new TabItem(MSGS.packageInstallDpTabTitle());
    packageInfoTab.setBorders(false);
    packageInfoTab.setLayout(new FormLayout());
    packageInfoTab.add(packageInfoForm);
    m_tabsPanel.add(packageInfoTab);
    operationOptionsTab = new TabItem(MSGS.packageInstallOperationTabTitle());
    operationOptionsTab.setBorders(false);
    operationOptionsTab.setLayout(new FormLayout());
    operationOptionsTab.add(operationOptionsForm);
    m_tabsPanel.add(operationOptionsTab);
}
Also used : FormData(com.extjs.gxt.ui.client.widget.layout.FormData) FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) TabItem(com.extjs.gxt.ui.client.widget.TabItem) Listener(com.extjs.gxt.ui.client.event.Listener) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) CheckBox(com.extjs.gxt.ui.client.widget.form.CheckBox) TextField(com.extjs.gxt.ui.client.widget.form.TextField) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) Text(com.extjs.gxt.ui.client.widget.Text) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField)

Example 4 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project kapua by eclipse.

the class PackageUninstallDialog method createBody.

@Override
public void createBody() {
    FormData formData = new FormData("-10");
    FormLayout formLayout = new FormLayout();
    formLayout.setLabelWidth(FORM_LABEL_WIDTH);
    operationOptionsForm = new FormPanel();
    operationOptionsForm.setFrame(false);
    operationOptionsForm.setHeaderVisible(false);
    operationOptionsForm.setBodyBorder(false);
    operationOptionsForm.setBorders(false);
    operationOptionsForm.setLayout(formLayout);
    operationReboot = new CheckBox();
    operationReboot.setName("operationReboot");
    operationReboot.setFieldLabel(MSGS.deviceUnistallAsyncUninstallReboot());
    operationReboot.setBoxLabel("");
    operationReboot.setValue(false);
    operationOptionsForm.add(operationReboot, formData);
    operationReboot.addListener(Events.Change, new Listener<BaseEvent>() {

        @Override
        public void handleEvent(BaseEvent be) {
            if (operationReboot.getValue()) {
                operationRebootDelay.enable();
            } else {
                operationRebootDelay.disable();
            }
        }
    });
    operationRebootDelay = new NumberField();
    operationRebootDelay.setName("operationRebootDelay");
    operationRebootDelay.setFieldLabel(MSGS.deviceUnistallAsyncUninstallRebootDelay());
    operationRebootDelay.setEmptyText("0");
    operationRebootDelay.setAllowDecimals(false);
    operationRebootDelay.setAllowNegative(false);
    operationRebootDelay.disable();
    operationOptionsForm.add(operationRebootDelay, formData);
    m_bodyPanel.add(operationOptionsForm);
}
Also used : FormData(com.extjs.gxt.ui.client.widget.layout.FormData) FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) CheckBox(com.extjs.gxt.ui.client.widget.form.CheckBox) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField)

Example 5 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project kapua by eclipse.

the class ActionDialog method onRender.

@Override
protected void onRender(Element parent, int pos) {
    super.onRender(parent, pos);
    FormLayout formLayout = new FormLayout();
    formLayout.setLabelWidth(FORM_LABEL_WIDTH);
    m_formPanel = new FormPanel();
    m_formPanel.setPadding(0);
    m_formPanel.setFrame(false);
    m_formPanel.setHeaderVisible(false);
    m_formPanel.setBodyBorder(false);
    m_formPanel.setBorders(false);
    m_formPanel.setLayout(formLayout);
    m_formPanel.setEncoding(Encoding.MULTIPART);
    m_formPanel.setMethod(Method.POST);
    addListeners();
    add(m_formPanel);
    // 
    // Buttons setup
    createButtons();
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel)

Aggregations

FormLayout (com.extjs.gxt.ui.client.widget.layout.FormLayout)61 FieldSet (com.extjs.gxt.ui.client.widget.form.FieldSet)37 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)29 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)26 Button (com.extjs.gxt.ui.client.widget.button.Button)24 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)19 FlowLayout (com.extjs.gxt.ui.client.widget.layout.FlowLayout)18 SelectionListener (com.extjs.gxt.ui.client.event.SelectionListener)15 GPSecureStringTextField (org.geosdi.geoplatform.gui.configuration.GPSecureStringTextField)15 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)12 BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)11 LabelField (com.extjs.gxt.ui.client.widget.form.LabelField)10 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)9 CheckBox (com.extjs.gxt.ui.client.widget.form.CheckBox)7 TextField (com.extjs.gxt.ui.client.widget.form.TextField)7 ComponentEvent (com.extjs.gxt.ui.client.event.ComponentEvent)6 Margins (com.extjs.gxt.ui.client.util.Margins)6 Label (com.extjs.gxt.ui.client.widget.Label)6 Radio (com.extjs.gxt.ui.client.widget.form.Radio)6 RadioGroup (com.extjs.gxt.ui.client.widget.form.RadioGroup)6