Search in sources :

Example 21 with FillToolItem

use of com.extjs.gxt.ui.client.widget.toolbar.FillToolItem in project kura by eclipse.

the class PackageInstallDialog method createButtons.

@Override
protected void createButtons() {
    super.createButtons();
    m_status = new Status();
    m_status.setBusy(MSGS.waitMsg());
    m_status.hide();
    m_status.setAutoWidth(true);
    getButtonBar().add(m_status);
    getButtonBar().add(new FillToolItem());
    m_submitButton = new Button(MSGS.submitButton());
    m_submitButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            submit();
        }
    });
    m_cancelButton = new Button(MSGS.cancelButton());
    m_cancelButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            hide();
        }
    });
    addButton(m_cancelButton);
    addButton(m_submitButton);
}
Also used : Status(com.extjs.gxt.ui.client.widget.Status) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) FillToolItem(com.extjs.gxt.ui.client.widget.toolbar.FillToolItem)

Example 22 with FillToolItem

use of com.extjs.gxt.ui.client.widget.toolbar.FillToolItem in project kapua by eclipse.

the class UserForm method onRender.

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    FormData formData = new FormData("0");
    // Create separate tabs
    m_tabsPanel = new TabPanel();
    m_tabsPanel.setPlain(true);
    m_tabsPanel.setBorders(false);
    m_tabsPanel.setBodyBorder(false);
    m_formPanel = new FormPanel();
    m_formPanel.setFrame(false);
    m_formPanel.setBorders(false);
    m_formPanel.setBodyBorder(false);
    m_formPanel.setHeaderVisible(false);
    m_formPanel.setLayout(new FitLayout());
    m_formPanel.setPadding(0);
    m_formPanel.add(m_tabsPanel);
    // 
    // User info tab
    // 
    FieldSet infoFieldSet = new FieldSet();
    infoFieldSet.setHeading(MSGS.userFormInfo());
    infoFieldSet.setBorders(true);
    infoFieldSet.setStyleAttribute("margin", "0px 10px 0px 10px");
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(Constants.LABEL_WIDTH_FORM);
    infoFieldSet.setLayout(layout);
    username = new TextField<String>();
    username.setAllowBlank(false);
    username.setName("userName");
    username.setFieldLabel("* " + MSGS.userFormName());
    username.setValidator(new TextFieldValidator(username, FieldType.NAME));
    infoFieldSet.add(username, formData);
    password = new TextField<String>();
    password.setAllowBlank(false);
    password.setName("password");
    password.setFieldLabel("* " + MSGS.userFormPassword());
    password.setValidator(new PasswordFieldValidator(password));
    password.setPassword(true);
    infoFieldSet.add(password, formData);
    confirmPassword = new TextField<String>();
    confirmPassword.setAllowBlank(false);
    confirmPassword.setName("confirmPassword");
    confirmPassword.setFieldLabel("* " + MSGS.userFormConfirmPassword());
    confirmPassword.setValidator(new ConfirmPasswordFieldValidator(confirmPassword, password));
    confirmPassword.setPassword(true);
    infoFieldSet.add(confirmPassword, formData);
    LabelField tooltip = new LabelField();
    tooltip.setValue(MSGS.userFormPasswordTooltip());
    tooltip.setStyleAttribute("margin-top", "-5px");
    tooltip.setStyleAttribute("color", "gray");
    tooltip.setStyleAttribute("font-size", "10px");
    infoFieldSet.add(tooltip, formData);
    displayName = new TextField<String>();
    displayName.setName("displayName");
    displayName.setFieldLabel(MSGS.userFormDisplayName());
    infoFieldSet.add(displayName, formData);
    email = new TextField<String>();
    email.setName("userEmail");
    email.setFieldLabel(MSGS.userFormEmail());
    email.setValidator(new TextFieldValidator(email, FieldType.EMAIL));
    infoFieldSet.add(email, formData);
    phoneNumber = new TextField<String>();
    phoneNumber.setName("phoneNumber");
    phoneNumber.setFieldLabel(MSGS.userFormPhoneNumber());
    infoFieldSet.add(phoneNumber, formData);
    optlock = new NumberField();
    optlock.setName("optlock");
    optlock.setEditable(false);
    optlock.setVisible(false);
    infoFieldSet.add(optlock, formData);
    // status field set
    FormLayout userLayout = new FormLayout();
    userLayout.setLabelWidth(Constants.LABEL_WIDTH_FORM);
    statusFieldSet = new FieldSet();
    statusFieldSet.setBorders(true);
    statusFieldSet.setStyleAttribute("margin", "5px 10px 0px 10px");
    statusFieldSet.setHeading(MSGS.userFormStatus());
    statusFieldSet.setLayout(userLayout);
    statusCombo = new SimpleComboBox<String>();
    statusCombo.setName("comboStatus");
    statusCombo.setFieldLabel(MSGS.userFormStatus());
    statusCombo.setLabelSeparator(":");
    statusCombo.setEditable(false);
    statusCombo.setTypeAhead(true);
    statusCombo.setTriggerAction(TriggerAction.ALL);
    // show account status combo box
    for (GwtUserStatus status : GwtUserStatus.values()) {
        statusCombo.add(MessageUtils.get(status.name()));
    }
    statusCombo.setSimpleValue(MessageUtils.get(GwtUserStatus.ENABLED.name()));
    statusFieldSet.add(statusCombo, formData);
    m_tabUserInfo = new TabItem(MSGS.userFormInformation());
    m_tabUserInfo.setBorders(false);
    m_tabUserInfo.setStyleAttribute("background-color", "#E8E8E8");
    m_tabUserInfo.setScrollMode(Scroll.AUTOY);
    m_tabUserInfo.add(infoFieldSet);
    m_tabUserInfo.add(statusFieldSet);
    m_tabsPanel.add(m_tabUserInfo);
    // button bar
    m_status = new Status();
    m_status.setBusy(MSGS.waitMsg());
    m_status.hide();
    m_status.setAutoWidth(true);
    submitButton = new Button(MSGS.submitButton(), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            if (!m_formPanel.isValid()) {
                return;
            }
            // Hold the dialog until the action comes back
            m_status.show();
            m_formPanel.getButtonBar().disable();
            submitAccount();
        }
    });
    Button cancelButton = new Button(MSGS.cancelButton(), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            hide();
        }
    });
    m_formPanel.getButtonBar().add(m_status);
    m_formPanel.getButtonBar().add(new FillToolItem());
    m_formPanel.setButtonAlign(HorizontalAlignment.CENTER);
    m_formPanel.addButton(submitButton);
    m_formPanel.addButton(cancelButton);
    loadUser();
    add(m_formPanel);
    setEditability();
}
Also used : FormData(com.extjs.gxt.ui.client.widget.layout.FormData) TabPanel(com.extjs.gxt.ui.client.widget.TabPanel) FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) GwtUserStatus(org.eclipse.kapua.app.console.shared.model.GwtUser.GwtUserStatus) Status(com.extjs.gxt.ui.client.widget.Status) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField) TabItem(com.extjs.gxt.ui.client.widget.TabItem) FieldSet(com.extjs.gxt.ui.client.widget.form.FieldSet) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) ConfirmPasswordFieldValidator(org.eclipse.kapua.app.console.client.util.ConfirmPasswordFieldValidator) TextFieldValidator(org.eclipse.kapua.app.console.client.util.TextFieldValidator) GwtUserStatus(org.eclipse.kapua.app.console.shared.model.GwtUser.GwtUserStatus) ConfirmPasswordFieldValidator(org.eclipse.kapua.app.console.client.util.ConfirmPasswordFieldValidator) PasswordFieldValidator(org.eclipse.kapua.app.console.client.util.PasswordFieldValidator) LabelField(com.extjs.gxt.ui.client.widget.form.LabelField) FillToolItem(com.extjs.gxt.ui.client.widget.toolbar.FillToolItem) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener)

Example 23 with FillToolItem

use of com.extjs.gxt.ui.client.widget.toolbar.FillToolItem in project kapua by eclipse.

the class FileUploadDialog method createButtons.

@Override
protected void createButtons() {
    super.createButtons();
    m_status = new Status();
    m_status.setBusy(MSGS.waitMsg());
    m_status.hide();
    m_status.setAutoWidth(true);
    getButtonBar().add(m_status);
    getButtonBar().add(new FillToolItem());
    m_submitButton = new Button(MSGS.uploadButton());
    m_submitButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            submit();
        }
    });
    m_cancelButton = new Button(MSGS.cancelButton());
    m_cancelButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            hide();
        }
    });
    addButton(m_cancelButton);
    addButton(m_submitButton);
}
Also used : Status(com.extjs.gxt.ui.client.widget.Status) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) FillToolItem(com.extjs.gxt.ui.client.widget.toolbar.FillToolItem)

Example 24 with FillToolItem

use of com.extjs.gxt.ui.client.widget.toolbar.FillToolItem in project kapua by eclipse.

the class SSLFileUploadDialog method createButtons.

@Override
protected void createButtons() {
    super.createButtons();
    m_status = new Status();
    m_status.setBusy(MSGS.waitMsg());
    m_status.hide();
    m_status.setAutoWidth(true);
    getButtonBar().add(m_status);
    getButtonBar().add(new FillToolItem());
    m_submitButton = new Button(MSGS.uploadButton());
    m_submitButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            submit();
        }
    });
    m_cancelButton = new Button(MSGS.cancelButton());
    m_cancelButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            HiddenField<Boolean> success = new HiddenField<Boolean>();
            success.setName("success");
            success.setValue(false);
            m_hiddenFields.set(0, success);
            hide();
        }
    });
    addButton(m_cancelButton);
    addButton(m_submitButton);
}
Also used : Status(com.extjs.gxt.ui.client.widget.Status) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) HiddenField(com.extjs.gxt.ui.client.widget.form.HiddenField) FillToolItem(com.extjs.gxt.ui.client.widget.toolbar.FillToolItem)

Aggregations

FillToolItem (com.extjs.gxt.ui.client.widget.toolbar.FillToolItem)24 Button (com.extjs.gxt.ui.client.widget.button.Button)20 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)18 Status (com.extjs.gxt.ui.client.widget.Status)12 SelectionListener (com.extjs.gxt.ui.client.event.SelectionListener)9 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)8 FieldSet (com.extjs.gxt.ui.client.widget.form.FieldSet)7 ToolBar (com.extjs.gxt.ui.client.widget.toolbar.ToolBar)7 LabelField (com.extjs.gxt.ui.client.widget.form.LabelField)6 FlowLayout (com.extjs.gxt.ui.client.widget.layout.FlowLayout)6 FormLayout (com.extjs.gxt.ui.client.widget.layout.FormLayout)6 TextField (com.extjs.gxt.ui.client.widget.form.TextField)5 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)5 SeparatorToolItem (com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem)4 SplitButton (com.extjs.gxt.ui.client.widget.button.SplitButton)3 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)3 SimpleComboBox (com.extjs.gxt.ui.client.widget.form.SimpleComboBox)3 ModelData (com.extjs.gxt.ui.client.data.ModelData)2 ComponentEvent (com.extjs.gxt.ui.client.event.ComponentEvent)2 MenuEvent (com.extjs.gxt.ui.client.event.MenuEvent)2