Search in sources :

Example 1 with ColumnLayout

use of com.extjs.gxt.ui.client.widget.layout.ColumnLayout in project kura by eclipse.

the class SslTab method initTabContent.

private void initTabContent() {
    LayoutContainer lcAction = new LayoutContainer();
    lcAction.setLayout(new BorderLayout());
    lcAction.setBorders(true);
    lcAction.setSize(475, -1);
    // 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.setId("config-panel-id");
        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<com.google.gwt.dom.client.Element> nl = m_actionFormPanel.getElement().getElementsByTagName("form");
                if (nl.getLength() > 0) {
                    com.google.gwt.dom.client.Element elemForm = nl.getItem(0);
                    elemForm.setAttribute("autocomplete", "off");
                }
            }
        });
        m_actionFormPanel.getElement().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);
    this.addListener(Events.Change, new Listener<BaseEvent>() {

        public void handleEvent(BaseEvent be) {
            m_apply.setEnabled(true);
            m_reset.setEnabled(true);
            m_dirty = true;
        }
    });
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(Constants.LABEL_WIDTH_CONFIG_FORM);
    m_actionFieldSet.setLayout(layout);
    loadData();
    // 
    // Initial description
    // 
    LayoutContainer description = new LayoutContainer();
    description.setBorders(false);
    description.setLayout(new ColumnLayout());
    Label descriptionLabel = new Label(MSGS.settingsSSLConfigurationDescription());
    description.add(descriptionLabel);
    description.setStyleAttribute("padding-bottom", "10px");
    m_actionFieldSet.add(description);
    // 
    // SSL protocol
    // 
    m_protocol = new TextField<String>();
    m_protocol.setName(MSGS.settingsSSLConfigurationProtocol());
    m_protocol.setPassword(false);
    m_protocol.setAllowBlank(false);
    m_protocol.setFieldLabel(MSGS.settingsSSLConfigurationProtocol());
    m_protocol.addPlugin(m_dirtyPlugin);
    m_protocol.addPlugin(m_infoPlugin);
    m_protocol.setData("text", MSGS.settingsSSLConfigurationProtocolDescr());
    m_actionFieldSet.add(m_protocol, formData);
    // 
    // SSL hostname verification
    // 
    m_trueRadio = new Radio();
    m_trueRadio.setBoxLabel(MSGS.trueLabel());
    m_trueRadio.setItemId("true");
    m_falseRadio = new Radio();
    m_falseRadio.setBoxLabel(MSGS.falseLabel());
    m_falseRadio.setValueAttribute("false");
    m_hostnameVerification = new RadioGroup();
    m_hostnameVerification.setName(MSGS.settingsSSLConfigurationHostnameVerification());
    m_hostnameVerification.setItemId(MSGS.settingsSSLConfigurationHostnameVerification());
    m_hostnameVerification.setFieldLabel(MSGS.settingsSSLConfigurationHostnameVerification());
    m_hostnameVerification.add(m_trueRadio);
    m_hostnameVerification.add(m_falseRadio);
    m_hostnameVerification.addPlugin(m_infoPlugin);
    m_hostnameVerification.addPlugin(m_dirtyPlugin);
    m_hostnameVerification.setData("text", MSGS.settingsSSLConfigurationHostnameVerificationDescr());
    m_actionFieldSet.add(m_hostnameVerification, formData);
    // 
    // SSL keystore
    // 
    m_keystorePath = new TextField<String>();
    m_keystorePath.setName(MSGS.settingsSSLConfigurationKeystorePath());
    m_keystorePath.setPassword(false);
    m_keystorePath.setAllowBlank(false);
    m_keystorePath.setFieldLabel(MSGS.settingsSSLConfigurationKeystorePath());
    m_keystorePath.addPlugin(m_dirtyPlugin);
    m_keystorePath.addPlugin(m_infoPlugin);
    m_keystorePath.setData("text", MSGS.settingsSSLConfigurationKeystorePathDescr());
    m_actionFieldSet.add(m_keystorePath, formData);
    // 
    // SSL keystore password
    // 
    m_keystorePassword = new TextField<String>();
    m_keystorePassword.setName(MSGS.settingsSSLConfigurationKeystorePassword());
    m_keystorePassword.setPassword(true);
    m_keystorePassword.setAllowBlank(false);
    m_keystorePassword.setFieldLabel(MSGS.settingsSSLConfigurationKeystorePassword());
    m_keystorePassword.addPlugin(m_dirtyPlugin);
    m_keystorePassword.addPlugin(m_infoPlugin);
    m_keystorePassword.setData("text", MSGS.settingsSSLConfigurationKeystorePasswordDescr());
    m_actionFieldSet.add(m_keystorePassword, formData);
    // 
    // SSL cipher suites
    // 
    m_cipherSuites = new TextField<String>();
    m_cipherSuites.setName(MSGS.settingsSSLConfigurationCipherSuites());
    m_cipherSuites.setPassword(false);
    m_cipherSuites.setAllowBlank(true);
    m_cipherSuites.setFieldLabel(MSGS.settingsSSLConfigurationCipherSuites());
    m_cipherSuites.addPlugin(m_dirtyPlugin);
    m_cipherSuites.addPlugin(m_infoPlugin);
    m_cipherSuites.setData("text", MSGS.settingsSSLConfigurationCipherSuitesDescr());
    m_actionFieldSet.add(m_cipherSuites, formData);
    if (!UserAgentUtils.isIE()) {
        m_actionFormPanel.add(m_actionFieldSet, formData);
        lcAction.add(m_actionFormPanel, centerData);
    } else {
        lcAction.add(m_actionFieldSet, centerData);
    }
    m_tabContent = lcAction;
}
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) RadioGroup(com.extjs.gxt.ui.client.widget.form.RadioGroup) BorderLayoutData(com.extjs.gxt.ui.client.widget.layout.BorderLayoutData) NodeList(com.google.gwt.dom.client.NodeList) Element(com.google.gwt.user.client.Element) Label(com.google.gwt.user.client.ui.Label) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) Radio(com.extjs.gxt.ui.client.widget.form.Radio) 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) ColumnLayout(com.extjs.gxt.ui.client.widget.layout.ColumnLayout) Margins(com.extjs.gxt.ui.client.util.Margins)

Example 2 with ColumnLayout

use of com.extjs.gxt.ui.client.widget.layout.ColumnLayout in project kura by eclipse.

the class ApplicationCertsTab method onRender.

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FitLayout());
    setId("device-command");
    FormData formData = new FormData("95% 40%");
    // initToolBar();
    // 
    // Command Form
    // 
    m_formPanel = new FormPanel();
    m_formPanel.setFrame(true);
    m_formPanel.setHeaderVisible(false);
    m_formPanel.setBorders(false);
    m_formPanel.setBodyBorder(false);
    m_formPanel.setAction(SERVLET_URL);
    m_formPanel.setEncoding(Encoding.MULTIPART);
    m_formPanel.setMethod(Method.POST);
    // m_formPanel.setHeight("100.0%");
    m_formPanel.setButtonAlign(HorizontalAlignment.RIGHT);
    m_buttonBar = m_formPanel.getButtonBar();
    initButtonBar();
    m_formPanel.addListener(Events.Submit, new Listener<FormEvent>() {

        public void handleEvent(FormEvent be) {
            gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

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

                @Override
                public void onSuccess(GwtXSRFToken token) {
                    gwtCertificatesService.storeApplicationPublicChain(token, m_publicCertificate.getValue(), m_storageAlias.getValue(), new AsyncCallback<Integer>() {

                        public void onFailure(Throwable caught) {
                            if (caught.getLocalizedMessage().equals(GwtKuraErrorCode.ILLEGAL_ARGUMENT.toString())) {
                                Info.display(MSGS.error(), "Error while storing the public keys in the key store");
                            } else {
                                Info.display(MSGS.error(), caught.getLocalizedMessage());
                            }
                            m_commandInput.unmask();
                        }

                        public void onSuccess(Integer certsStored) {
                            m_publicCertificate.clear();
                            m_storageAlias.clear();
                            Info.display(MSGS.info(), "Storage success. Stored " + certsStored + " public keys.");
                            m_commandInput.unmask();
                        }
                    });
                }
            });
        }
    });
    // 
    // Initial description
    // 
    LayoutContainer description = new LayoutContainer();
    description.setBorders(false);
    description.setLayout(new ColumnLayout());
    Label descriptionLabel = new Label(MSGS.settingsAddBundleCertsDescription());
    description.add(descriptionLabel);
    description.setStyleAttribute("padding-bottom", "10px");
    m_formPanel.add(description);
    // 
    // Storage alias
    // 
    m_storageAlias = new TextField<String>();
    m_storageAlias.setName(MSGS.settingsStorageAliasLabel());
    m_storageAlias.setPassword(false);
    m_storageAlias.setAllowBlank(false);
    m_storageAlias.setEmptyText("* " + MSGS.settingsStorageAliasLabel());
    m_storageAlias.setFieldLabel(MSGS.settingsStorageAliasLabel());
    m_formPanel.add(m_storageAlias, new FormData("95%"));
    // 
    // Public Certificate
    // 
    m_publicCertificate = new TextArea();
    m_publicCertificate.setBorders(false);
    m_publicCertificate.setReadOnly(false);
    m_publicCertificate.setEmptyText("* " + MSGS.settingsAddCertLabel());
    m_publicCertificate.setName(MSGS.settingsAddCertLabel());
    m_publicCertificate.setAllowBlank(false);
    m_publicCertificate.setFieldLabel(MSGS.settingsAddCertLabel());
    m_formPanel.add(m_publicCertificate, formData);
    m_commandInput = m_formPanel;
    // Main Panel
    ContentPanel deviceCommandPanel = new ContentPanel();
    deviceCommandPanel.setBorders(false);
    deviceCommandPanel.setBodyBorder(false);
    deviceCommandPanel.setHeaderVisible(false);
    deviceCommandPanel.setScrollMode(Scroll.AUTO);
    deviceCommandPanel.setLayout(new FitLayout());
    deviceCommandPanel.add(m_commandInput);
    add(deviceCommandPanel);
}
Also used : FormData(com.extjs.gxt.ui.client.widget.layout.FormData) TextArea(com.extjs.gxt.ui.client.widget.form.TextArea) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) Label(com.google.gwt.user.client.ui.Label) GwtXSRFToken(org.eclipse.kura.web.shared.model.GwtXSRFToken) ContentPanel(com.extjs.gxt.ui.client.widget.ContentPanel) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) FormEvent(com.extjs.gxt.ui.client.event.FormEvent) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) ColumnLayout(com.extjs.gxt.ui.client.widget.layout.ColumnLayout) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 3 with ColumnLayout

use of com.extjs.gxt.ui.client.widget.layout.ColumnLayout in project kura by eclipse.

the class DeviceCertsTab method onRender.

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FitLayout());
    setId("device-command");
    FormData formData = new FormData("95% 40%");
    // initToolBar();
    // 
    // Command Form
    // 
    m_formPanel = new FormPanel();
    m_formPanel.setFrame(true);
    m_formPanel.setHeaderVisible(false);
    m_formPanel.setBorders(false);
    m_formPanel.setBodyBorder(false);
    m_formPanel.setAction(SERVLET_URL);
    m_formPanel.setEncoding(Encoding.MULTIPART);
    m_formPanel.setMethod(Method.POST);
    // m_formPanel.setHeight("100.0%");
    m_formPanel.setButtonAlign(HorizontalAlignment.RIGHT);
    m_buttonBar = m_formPanel.getButtonBar();
    initButtonBar();
    m_formPanel.addListener(Events.Submit, new Listener<FormEvent>() {

        public void handleEvent(FormEvent be) {
            gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

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

                @Override
                public void onSuccess(GwtXSRFToken token) {
                    gwtCertificatesService.storePublicPrivateKeys(token, m_privateCertificate.getValue(), m_publicCertificate.getValue(), null, m_storageAlias.getValue(), new AsyncCallback<Integer>() {

                        public void onFailure(Throwable caught) {
                            if (caught.getLocalizedMessage().equals(GwtKuraErrorCode.ILLEGAL_ARGUMENT.toString())) {
                                Info.display(MSGS.error(), "Error while storing the private certificate in the key store");
                            } else {
                                Info.display(MSGS.error(), caught.getLocalizedMessage());
                            }
                            m_commandInput.unmask();
                        }

                        public void onSuccess(Integer certsStored) {
                            m_publicCertificate.clear();
                            m_privateCertificate.clear();
                            m_storageAlias.clear();
                            Info.display(MSGS.info(), "Storage success. Stored private and public certificates.");
                            m_commandInput.unmask();
                        }
                    });
                }
            });
        }
    });
    // 
    // Initial description
    // 
    LayoutContainer description = new LayoutContainer();
    description.setBorders(false);
    description.setLayout(new ColumnLayout());
    Label descriptionLabel = new Label(MSGS.settingsMAuthDescription1());
    Label descriptionLabel2 = new Label(MSGS.settingsMAuthDescription2());
    description.add(descriptionLabel);
    description.add(descriptionLabel2);
    description.setStyleAttribute("padding-bottom", "10px");
    m_formPanel.add(description);
    // 
    // 
    // 
    m_storageAlias = new TextField<String>();
    m_storageAlias.setName(MSGS.settingsStorageAliasLabel());
    m_storageAlias.setPassword(false);
    m_storageAlias.setAllowBlank(false);
    m_storageAlias.setEmptyText("* " + MSGS.settingsStorageAliasLabel());
    m_storageAlias.setFieldLabel(MSGS.settingsStorageAliasLabel());
    m_formPanel.add(m_storageAlias, new FormData("95%"));
    // 
    // Private Certificate
    // 
    m_privateCertificate = new TextArea();
    m_privateCertificate.setBorders(false);
    m_privateCertificate.setReadOnly(false);
    m_privateCertificate.setEmptyText("* " + MSGS.settingsPrivateCertLabel());
    m_privateCertificate.setName(MSGS.settingsPrivateCertLabel());
    m_privateCertificate.setAllowBlank(false);
    m_privateCertificate.setFieldLabel(MSGS.settingsPrivateCertLabel());
    m_formPanel.add(m_privateCertificate, formData);
    // 
    // Public Certificate
    // 
    m_publicCertificate = new TextArea();
    m_publicCertificate.setBorders(false);
    m_publicCertificate.setReadOnly(false);
    m_publicCertificate.setEmptyText("* " + MSGS.settingsPublicCertLabel());
    m_publicCertificate.setName(MSGS.settingsPublicCertLabel());
    m_publicCertificate.setAllowBlank(false);
    m_publicCertificate.setFieldLabel(MSGS.settingsPublicCertLabel());
    m_formPanel.add(m_publicCertificate, formData);
    m_commandInput = m_formPanel;
    // Main Panel
    ContentPanel deviceCommandPanel = new ContentPanel();
    deviceCommandPanel.setBorders(false);
    deviceCommandPanel.setBodyBorder(false);
    deviceCommandPanel.setHeaderVisible(false);
    deviceCommandPanel.setScrollMode(Scroll.AUTO);
    deviceCommandPanel.setLayout(new FitLayout());
    deviceCommandPanel.add(m_commandInput);
    add(deviceCommandPanel);
}
Also used : FormData(com.extjs.gxt.ui.client.widget.layout.FormData) TextArea(com.extjs.gxt.ui.client.widget.form.TextArea) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) Label(com.google.gwt.user.client.ui.Label) GwtXSRFToken(org.eclipse.kura.web.shared.model.GwtXSRFToken) ContentPanel(com.extjs.gxt.ui.client.widget.ContentPanel) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) FormEvent(com.extjs.gxt.ui.client.event.FormEvent) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) ColumnLayout(com.extjs.gxt.ui.client.widget.layout.ColumnLayout) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 4 with ColumnLayout

use of com.extjs.gxt.ui.client.widget.layout.ColumnLayout in project kura by eclipse.

the class SecurityTab method onRender.

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    // setLayout(new FitLayout());
    setId("device-command");
    ClickHandler clickHandler1 = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

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

                @Override
                public void onSuccess(GwtXSRFToken token) {
                    gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

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

                        @Override
                        public void onSuccess(GwtXSRFToken token) {
                            AsyncCallback<Void> callback = new AsyncCallback<Void>() {

                                public void onFailure(Throwable caught) {
                                    Info.display(MSGS.error(), "Error reloading security policy fingerprint!");
                                }

                                public void onSuccess(Void result) {
                                    Info.display(MSGS.info(), "Fingerprint successfully reloaded!");
                                }
                            };
                            gwtSecurityService.reloadSecurityPolicyFingerprint(token, callback);
                        }
                    });
                }
            });
        }
    };
    ClickHandler clickHandler2 = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

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

                @Override
                public void onSuccess(GwtXSRFToken token) {
                    gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

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

                        @Override
                        public void onSuccess(GwtXSRFToken token) {
                            AsyncCallback<Void> callback = new AsyncCallback<Void>() {

                                public void onFailure(Throwable caught) {
                                    Info.display(MSGS.error(), "Error reloading command line fingerprint!");
                                }

                                public void onSuccess(Void result) {
                                    Info.display(MSGS.info(), "Fingerprint successfully reloaded!");
                                }
                            };
                            gwtSecurityService.reloadCommandLineFingerprint(token, callback);
                        }
                    });
                }
            });
        }
    };
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.setSpacing(5);
    vPanel.setWidth("100%");
    LayoutContainer description = new LayoutContainer();
    description.setBorders(false);
    description.setLayout(new ColumnLayout());
    Label descriptionLabel = new Label(MSGS.settingsSecurityDescription());
    description.add(descriptionLabel);
    description.setStyleAttribute("padding-bottom", "10px");
    vPanel.add(description);
    VerticalPanel buttonsVPanel = new VerticalPanel();
    buttonsVPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    buttonsVPanel.setWidth("100%");
    buttonsVPanel.setHeight("100%");
    buttonsVPanel.setSpacing(5);
    Button securityPolicyButton = new Button(MSGS.settingsSecurityReloadPolicy());
    securityPolicyButton.addDomHandler(clickHandler1, ClickEvent.getType());
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
    // Add a title
    layout.setHTML(0, 0, MSGS.settingsSecurityReloadPolicyTitle());
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    // Add description and reload button
    layout.setHTML(1, 0, MSGS.settingsSecurityReloadPolicyDescription());
    layout.setWidget(2, 0, securityPolicyButton);
    cellFormatter.setColSpan(2, 0, 2);
    cellFormatter.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER);
    // Wrap the content in a DecoratorPanel
    DecoratorPanel decPanel = new DecoratorPanel();
    decPanel.setWidget(layout);
    decPanel.setWidth("100%");
    decPanel.setHeight("100%");
    buttonsVPanel.add(decPanel);
    // Button to reload start script fingerprint
    Button startScriptReloadButton = new Button(MSGS.settingsReloadStartupFingerprint());
    startScriptReloadButton.addDomHandler(clickHandler2, ClickEvent.getType());
    FlexTable startScriptLayout = new FlexTable();
    startScriptLayout.setCellSpacing(6);
    FlexCellFormatter startScriptCellFormatter = startScriptLayout.getFlexCellFormatter();
    // Add a title
    startScriptLayout.setHTML(0, 0, MSGS.settingsReloadStartupFingerprintTitle());
    startScriptCellFormatter.setColSpan(0, 0, 2);
    startScriptCellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    // Add description and reload button
    startScriptLayout.setHTML(1, 0, MSGS.settingsReloadStartupFingerprintDescription());
    startScriptLayout.setWidget(2, 0, startScriptReloadButton);
    startScriptCellFormatter.setColSpan(2, 0, 2);
    startScriptCellFormatter.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER);
    // Wrap the content in a DecoratorPanel
    DecoratorPanel startScriptDecPanel = new DecoratorPanel();
    startScriptDecPanel.setWidth("100%");
    startScriptDecPanel.setHeight("100%");
    startScriptDecPanel.setWidget(startScriptLayout);
    buttonsVPanel.add(startScriptDecPanel);
    vPanel.add(buttonsVPanel);
    vPanel.ensureDebugId("cwVerticalPanel");
    add(vPanel);
}
Also used : ClickEvent(com.google.gwt.event.dom.client.ClickEvent) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) Label(com.google.gwt.user.client.ui.Label) FlexTable(com.google.gwt.user.client.ui.FlexTable) GwtXSRFToken(org.eclipse.kura.web.shared.model.GwtXSRFToken) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) Button(com.extjs.gxt.ui.client.widget.button.Button) ColumnLayout(com.extjs.gxt.ui.client.widget.layout.ColumnLayout) DecoratorPanel(com.google.gwt.user.client.ui.DecoratorPanel)

Example 5 with ColumnLayout

use of com.extjs.gxt.ui.client.widget.layout.ColumnLayout in project kura by eclipse.

the class ServerCertsTab method onRender.

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FitLayout());
    setId("device-command");
    FormData formData = new FormData("95% 40%");
    // initToolBar();
    // 
    // Command Form
    // 
    m_formPanel = new FormPanel();
    m_formPanel.setFrame(true);
    m_formPanel.setHeaderVisible(false);
    m_formPanel.setBorders(false);
    m_formPanel.setBodyBorder(false);
    m_formPanel.setAction(SERVLET_URL);
    m_formPanel.setEncoding(Encoding.MULTIPART);
    m_formPanel.setMethod(Method.POST);
    // m_formPanel.setHeight("100.0%");
    m_formPanel.setButtonAlign(HorizontalAlignment.RIGHT);
    m_buttonBar = m_formPanel.getButtonBar();
    initButtonBar();
    m_formPanel.addListener(Events.Submit, new Listener<FormEvent>() {

        public void handleEvent(FormEvent be) {
            gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {

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

                @Override
                public void onSuccess(GwtXSRFToken token) {
                    gwtCertificatesService.storeSSLPublicChain(token, m_publicCertificate.getValue(), m_storageAlias.getValue(), new AsyncCallback<Integer>() {

                        public void onFailure(Throwable caught) {
                            if (caught.getLocalizedMessage().equals(GwtKuraErrorCode.ILLEGAL_ARGUMENT.toString())) {
                                Info.display(MSGS.error(), "Error while storing the public keys in the key store");
                            } else {
                                Info.display(MSGS.error(), caught.getLocalizedMessage());
                            }
                            m_commandInput.unmask();
                        }

                        public void onSuccess(Integer certsStored) {
                            m_publicCertificate.clear();
                            m_storageAlias.clear();
                            Info.display(MSGS.info(), "Storage success. Stored " + certsStored + " public keys.");
                            m_commandInput.unmask();
                        }
                    });
                }
            });
        }
    });
    // 
    // Initial description
    // 
    LayoutContainer description = new LayoutContainer();
    description.setBorders(false);
    description.setLayout(new ColumnLayout());
    Label descriptionLabel = new Label(MSGS.settingsAddCertDescription1());
    Label descriptionLabel2 = new Label(MSGS.settingsAddCertDescription2());
    description.add(descriptionLabel);
    description.add(descriptionLabel2);
    description.setStyleAttribute("padding-bottom", "10px");
    m_formPanel.add(description);
    // 
    // Storage alias
    // 
    m_storageAlias = new TextField<String>();
    m_storageAlias.setName(MSGS.settingsStorageAliasLabel());
    m_storageAlias.setPassword(false);
    m_storageAlias.setAllowBlank(false);
    m_storageAlias.setEmptyText("* " + MSGS.settingsStorageAliasLabel());
    m_storageAlias.setFieldLabel(MSGS.settingsStorageAliasLabel());
    m_formPanel.add(m_storageAlias, new FormData("95%"));
    // 
    // Public Certificate
    // 
    m_publicCertificate = new TextArea();
    m_publicCertificate.setBorders(false);
    m_publicCertificate.setReadOnly(false);
    m_publicCertificate.setEmptyText("* " + MSGS.settingsPublicCertLabel());
    m_publicCertificate.setName(MSGS.settingsPublicCertLabel());
    m_publicCertificate.setAllowBlank(false);
    m_publicCertificate.setFieldLabel(MSGS.settingsPublicCertLabel());
    m_formPanel.add(m_publicCertificate, formData);
    m_commandInput = m_formPanel;
    // Main Panel
    ContentPanel deviceCommandPanel = new ContentPanel();
    deviceCommandPanel.setBorders(false);
    deviceCommandPanel.setBodyBorder(false);
    deviceCommandPanel.setHeaderVisible(false);
    deviceCommandPanel.setScrollMode(Scroll.AUTO);
    deviceCommandPanel.setLayout(new FitLayout());
    deviceCommandPanel.add(m_commandInput);
    add(deviceCommandPanel);
}
Also used : FormData(com.extjs.gxt.ui.client.widget.layout.FormData) TextArea(com.extjs.gxt.ui.client.widget.form.TextArea) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) Label(com.google.gwt.user.client.ui.Label) GwtXSRFToken(org.eclipse.kura.web.shared.model.GwtXSRFToken) ContentPanel(com.extjs.gxt.ui.client.widget.ContentPanel) FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) FormEvent(com.extjs.gxt.ui.client.event.FormEvent) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) ColumnLayout(com.extjs.gxt.ui.client.widget.layout.ColumnLayout) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Aggregations

ColumnLayout (com.extjs.gxt.ui.client.widget.layout.ColumnLayout)8 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)7 Label (com.google.gwt.user.client.ui.Label)5 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)4 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)4 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)4 GwtXSRFToken (org.eclipse.kura.web.shared.model.GwtXSRFToken)4 FormEvent (com.extjs.gxt.ui.client.event.FormEvent)3 ContentPanel (com.extjs.gxt.ui.client.widget.ContentPanel)3 Button (com.extjs.gxt.ui.client.widget.button.Button)3 TextArea (com.extjs.gxt.ui.client.widget.form.TextArea)3 ColumnData (com.extjs.gxt.ui.client.widget.layout.ColumnData)3 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)3 Label (com.extjs.gxt.ui.client.widget.Label)2 BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)1 Margins (com.extjs.gxt.ui.client.util.Margins)1 HorizontalPanel (com.extjs.gxt.ui.client.widget.HorizontalPanel)1 Slider (com.extjs.gxt.ui.client.widget.Slider)1 ToggleButton (com.extjs.gxt.ui.client.widget.button.ToggleButton)1 CheckBox (com.extjs.gxt.ui.client.widget.form.CheckBox)1