Search in sources :

Example 16 with TabPanel

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

the class DeviceTabPackages method initPackagesTabs.

private void initPackagesTabs() {
    tabsPanel = new TabPanel();
    tabsPanel.setPlain(true);
    tabsPanel.setBorders(false);
    tabsPanel.setTabPosition(TabPosition.BOTTOM);
    // 
    // Packages installed tab
    installedPackageTab = new DeviceTabPackagesInstalled(this);
    installedPackageTab.setText(MSGS.deviceInstallTabInstalled());
    installedPackageTab.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.packageGreen16()));
    installedPackageTab.setBorders(false);
    installedPackageTab.setLayout(new FitLayout());
    installedPackageTab.addListener(Events.Select, new Listener<ComponentEvent>() {

        public void handleEvent(ComponentEvent be) {
            refresh();
        }
    });
    tabsPanel.add(installedPackageTab);
    // 
    // In progress packages install tab
    inProgressPackageTab = new DeviceTabPackagesInProgress(this);
    inProgressPackageTab.setText(MSGS.deviceInstallTabInProgress());
    inProgressPackageTab.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.packageGo16()));
    inProgressPackageTab.setBorders(false);
    inProgressPackageTab.setLayout(new FitLayout());
    inProgressPackageTab.addListener(Events.Select, new Listener<ComponentEvent>() {

        public void handleEvent(ComponentEvent be) {
            refresh();
        }
    });
    tabsPanel.add(inProgressPackageTab);
    add(tabsPanel);
}
Also used : TabPanel(com.extjs.gxt.ui.client.widget.TabPanel) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 17 with TabPanel

use of com.extjs.gxt.ui.client.widget.TabPanel 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)

Aggregations

TabPanel (com.extjs.gxt.ui.client.widget.TabPanel)17 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)13 TabItem (com.extjs.gxt.ui.client.widget.TabItem)12 ComponentEvent (com.extjs.gxt.ui.client.event.ComponentEvent)8 Margins (com.extjs.gxt.ui.client.util.Margins)3 TabPanelEvent (com.extjs.gxt.ui.client.event.TabPanelEvent)2 ContentPanel (com.extjs.gxt.ui.client.widget.ContentPanel)2 FieldSet (com.extjs.gxt.ui.client.widget.form.FieldSet)2 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)2 BorderLayoutData (com.extjs.gxt.ui.client.widget.layout.BorderLayoutData)2 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)2 FormLayout (com.extjs.gxt.ui.client.widget.layout.FormLayout)2 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)1 FormEvent (com.extjs.gxt.ui.client.event.FormEvent)1 SelectionListener (com.extjs.gxt.ui.client.event.SelectionListener)1 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)1 Status (com.extjs.gxt.ui.client.widget.Status)1 Button (com.extjs.gxt.ui.client.widget.button.Button)1 ButtonBar (com.extjs.gxt.ui.client.widget.button.ButtonBar)1 FileUploadField (com.extjs.gxt.ui.client.widget.form.FileUploadField)1