Search in sources :

Example 6 with FillToolItem

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

the class OpenPortForm method onRender.

protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setId("firewall-open-port-form-wrapper");
    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());
    FieldSet fieldSet = new FieldSet();
    fieldSet.setHeading(MSGS.firewallOpenPortFormInformation());
    FormLayout layoutAccount = new FormLayout();
    layoutAccount.setLabelWidth(LABEL_WIDTH_FORM);
    fieldSet.setLayout(layoutAccount);
    // 
    // port (or range of ports) to be opened for inbound connections
    // 
    final LabelField portLabel = new LabelField();
    portLabel.setName("portLabel");
    portLabel.setFieldLabel(MSGS.firewallOpenPortFormPort());
    portLabel.setLabelSeparator(":");
    fieldSet.add(portLabel, formData);
    final TextField<String> portField = new TextField<String>();
    portField.setAllowBlank(false);
    portField.setName("port");
    portField.setFieldLabel(MSGS.firewallOpenPortFormPort());
    portField.setValidator(new TextFieldValidator(portField, FieldType.PORT_RANGE));
    portField.setToolTip(MSGS.firewallOpenPortFormPortToolTip());
    fieldSet.add(portField, formData);
    // 
    // protocol
    // 
    final LabelField protocolLabel = new LabelField();
    protocolLabel.setName("protocolLabel");
    protocolLabel.setFieldLabel(MSGS.firewallOpenPortFormProtocol());
    protocolLabel.setLabelSeparator(":");
    fieldSet.add(protocolLabel, formData);
    final SimpleComboBox<String> protocolCombo = new SimpleComboBox<String>();
    protocolCombo.setName("protocolCombo");
    protocolCombo.setFieldLabel(MSGS.firewallOpenPortFormProtocol());
    protocolCombo.setEditable(false);
    protocolCombo.setTypeAhead(true);
    protocolCombo.setTriggerAction(TriggerAction.ALL);
    for (GwtNetProtocol protocol : GwtNetProtocol.values()) {
        protocolCombo.add(protocol.name());
    }
    protocolCombo.setSimpleValue(GwtNetProtocol.tcp.name());
    protocolCombo.setToolTip(MSGS.firewallOpenPortFormProtocolToolTip());
    fieldSet.add(protocolCombo, formData);
    // 
    // permitted network
    // 
    final TextField<String> permittedNetworkField = new TextField<String>();
    permittedNetworkField.setAllowBlank(true);
    permittedNetworkField.setName("permittedNetwork");
    permittedNetworkField.setFieldLabel(MSGS.firewallOpenPortFormPermittedNetwork());
    permittedNetworkField.setValidator(new TextFieldValidator(permittedNetworkField, FieldType.NETWORK));
    permittedNetworkField.setToolTip(MSGS.firewallOpenPortFormPermittedNetworkToolTip());
    fieldSet.add(permittedNetworkField, formData);
    // 
    // permitted network interface
    // 
    m_permittedInterfaceName = new TextField<String>();
    m_permittedInterfaceName.setAllowBlank(true);
    m_permittedInterfaceName.setName("permittedInterfaceName");
    m_permittedInterfaceName.setFieldLabel(MSGS.firewallOpenPortFormPermittedInterfaceName());
    m_permittedInterfaceName.setValidator(new TextFieldValidator(m_permittedInterfaceName, FieldType.ALPHANUMERIC));
    m_permittedInterfaceName.setToolTip(MSGS.firewallOpenPortFormPermittedInterfaceToolTip());
    m_permittedInterfaceName.addListener(Events.Change, new Listener<FieldEvent>() {

        public void handleEvent(FieldEvent be) {
            if (be.getValue() != null) {
                m_unpermittedInterfaceName.disable();
            } else {
                m_unpermittedInterfaceName.enable();
            }
        }
    });
    fieldSet.add(m_permittedInterfaceName, formData);
    // 
    // unpermitted network interface
    // 
    m_unpermittedInterfaceName = new TextField<String>();
    m_unpermittedInterfaceName.setAllowBlank(true);
    m_unpermittedInterfaceName.setName("unpermittedInterfaceName");
    m_unpermittedInterfaceName.setFieldLabel(MSGS.firewallOpenPortFormUnpermittedInterfaceName());
    m_unpermittedInterfaceName.setValidator(new TextFieldValidator(m_unpermittedInterfaceName, FieldType.ALPHANUMERIC));
    m_unpermittedInterfaceName.setToolTip(MSGS.firewallOpenPortFormUnpermittedInterfaceToolTip());
    m_unpermittedInterfaceName.addListener(Events.Change, new Listener<FieldEvent>() {

        public void handleEvent(FieldEvent be) {
            if (be.getValue() != null) {
                m_permittedInterfaceName.disable();
            } else {
                m_permittedInterfaceName.enable();
            }
        }
    });
    fieldSet.add(m_unpermittedInterfaceName, formData);
    // 
    // permitted MAC
    // 
    final TextField<String> permittedMacField = new TextField<String>();
    permittedMacField.setAllowBlank(true);
    permittedMacField.setName("permittedMac");
    permittedMacField.setFieldLabel(MSGS.firewallOpenPortFormPermittedMac());
    permittedMacField.setValidator(new TextFieldValidator(permittedMacField, FieldType.MAC_ADDRESS));
    permittedMacField.setToolTip(MSGS.firewallOpenPortFormPermittedMacAddress());
    fieldSet.add(permittedMacField, formData);
    // 
    // source port range
    // 
    final TextField<String> sourcePortRangeField = new TextField<String>();
    sourcePortRangeField.setAllowBlank(true);
    sourcePortRangeField.setName("sourcePortRange");
    sourcePortRangeField.setFieldLabel(MSGS.firewallOpenPortFormSourcePortRange());
    sourcePortRangeField.setValidator(new TextFieldValidator(sourcePortRangeField, FieldType.PORT_RANGE));
    sourcePortRangeField.setToolTip(MSGS.firewallOpenPortFormSourcePortRangeToolTip());
    fieldSet.add(sourcePortRangeField, formData);
    // add the fieldSet to the panel
    m_formPanel.add(fieldSet);
    // disable the labels
    portLabel.setVisible(false);
    protocolLabel.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());
    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()) {
                    return;
                }
            }
            Log.debug("Open port fields are visible and valid...");
            // we need to add a new row to the open ports table
            if (m_existingOpenPortEntry == null) {
                // create a new entry
                m_newOpenPortEntry = new GwtFirewallOpenPortEntry();
                m_newOpenPortEntry.setPortRange(portField.getValue());
                m_newOpenPortEntry.setProtocol(protocolCombo.getValue().getValue());
                if (permittedNetworkField.getValue() != null) {
                    m_newOpenPortEntry.setPermittedNetwork(permittedNetworkField.getValue());
                } else {
                    m_newOpenPortEntry.setPermittedNetwork("0.0.0.0/0");
                }
                if (m_permittedInterfaceName.getValue() != null) {
                    m_newOpenPortEntry.setPermittedInterfaceName(m_permittedInterfaceName.getValue());
                }
                if (m_unpermittedInterfaceName.getValue() != null) {
                    m_newOpenPortEntry.setUnpermittedInterfaceName(m_unpermittedInterfaceName.getValue());
                }
                if (permittedMacField.getValue() != null) {
                    m_newOpenPortEntry.setPermittedMAC(permittedMacField.getValue());
                }
                if (sourcePortRangeField.getValue() != null) {
                    m_newOpenPortEntry.setSourcePortRange(sourcePortRangeField.getValue());
                }
            } else {
                // update the current entry
                m_existingOpenPortEntry = new GwtFirewallOpenPortEntry();
                m_existingOpenPortEntry.setPortRange(portField.getValue());
                m_existingOpenPortEntry.setProtocol(protocolCombo.getValue().getValue());
                if (permittedNetworkField.getValue() != null) {
                    m_existingOpenPortEntry.setPermittedNetwork(permittedNetworkField.getValue());
                } else {
                    m_existingOpenPortEntry.setPermittedNetwork("0.0.0.0/0");
                }
                if (m_permittedInterfaceName.getValue() != null) {
                    m_existingOpenPortEntry.setPermittedInterfaceName(m_permittedInterfaceName.getValue());
                }
                if (m_unpermittedInterfaceName.getValue() != null) {
                    m_existingOpenPortEntry.setUnpermittedInterfaceName(m_unpermittedInterfaceName.getValue());
                }
                if (permittedMacField.getValue() != null) {
                    m_existingOpenPortEntry.setPermittedMAC(permittedMacField.getValue());
                }
                if (sourcePortRangeField.getValue() != null) {
                    m_existingOpenPortEntry.setSourcePortRange(sourcePortRangeField.getValue());
                }
            }
            m_isCanceled = false;
            hide();
        }
    }));
    m_formPanel.addButton(new Button(MSGS.cancelButton(), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            m_isCanceled = true;
            hide();
        }
    }));
    m_formPanel.setButtonAlign(HorizontalAlignment.CENTER);
    // populate if necessary
    if (m_existingOpenPortEntry != null) {
        portLabel.setValue(m_existingOpenPortEntry.getPortRange());
        portField.setValue(m_existingOpenPortEntry.getPortRange());
        portField.setOriginalValue(m_existingOpenPortEntry.getPortRange());
        protocolLabel.setValue(m_existingOpenPortEntry.getProtocol());
        protocolCombo.setSimpleValue(m_existingOpenPortEntry.getProtocol());
        permittedNetworkField.setValue(m_existingOpenPortEntry.getPermittedNetwork());
        permittedNetworkField.setOriginalValue(m_existingOpenPortEntry.getPermittedNetwork());
        m_permittedInterfaceName.setValue(m_existingOpenPortEntry.getPermittedInterfaceName());
        m_permittedInterfaceName.setOriginalValue(m_existingOpenPortEntry.getPermittedInterfaceName());
        m_unpermittedInterfaceName.setValue(m_existingOpenPortEntry.getUnpermittedInterfaceName());
        m_unpermittedInterfaceName.setOriginalValue(m_existingOpenPortEntry.getUnpermittedInterfaceName());
        permittedMacField.setValue(m_existingOpenPortEntry.getPermittedMAC());
        permittedMacField.setOriginalValue(m_existingOpenPortEntry.getPermittedMAC());
        sourcePortRangeField.setValue(m_existingOpenPortEntry.getSourcePortRange());
        sourcePortRangeField.setOriginalValue(m_existingOpenPortEntry.getSourcePortRange());
    }
    add(m_formPanel);
}
Also used : 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) SimpleComboBox(com.extjs.gxt.ui.client.widget.form.SimpleComboBox) GwtFirewallOpenPortEntry(org.eclipse.kura.web.shared.model.GwtFirewallOpenPortEntry) FlowLayout(com.extjs.gxt.ui.client.widget.layout.FlowLayout) FieldEvent(com.extjs.gxt.ui.client.event.FieldEvent) GwtNetProtocol(org.eclipse.kura.web.shared.model.GwtNetProtocol) 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) TextField(com.extjs.gxt.ui.client.widget.form.TextField) TextFieldValidator(org.eclipse.kura.web.client.util.TextFieldValidator) LabelField(com.extjs.gxt.ui.client.widget.form.LabelField) FillToolItem(com.extjs.gxt.ui.client.widget.toolbar.FillToolItem) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener)

Example 7 with FillToolItem

use of com.extjs.gxt.ui.client.widget.toolbar.FillToolItem in project geo-platform by geosdi.

the class GotoXYWidget method addComponentToForm.

@Override
public void addComponentToForm() {
    super.setHeadingHtml(BasicWidgetConstants.INSTANCE.GotoXYWidget_headingText());
    fieldSet = new FieldSet();
    fieldSet.setHeadingHtml(BasicWidgetConstants.INSTANCE.GotoXYWidget_fieldSetHeadingText());
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(80);
    fieldSet.setLayout(layout);
    this.epsgPanel = new GPEPSGContentPanel(Boolean.FALSE);
    fieldSet.add(this.epsgPanel);
    this.xNumberField = new NumberField();
    this.xNumberField.setFieldLabel(BasicWidgetConstants.INSTANCE.GotoXYWidget_xFieldLabelText());
    fieldSet.add(this.xNumberField);
    this.yNumberField = new NumberField();
    this.yNumberField.setFieldLabel(BasicWidgetConstants.INSTANCE.GotoXYWidget_yFieldLabelText());
    fieldSet.add(this.yNumberField);
    this.getFormPanel().add(fieldSet);
    saveStatus = new SaveStatus();
    saveStatus.setAutoWidth(true);
    getFormPanel().setButtonAlign(HorizontalAlignment.LEFT);
    getFormPanel().getButtonBar().add(saveStatus);
    getFormPanel().getButtonBar().add(new FillToolItem());
    this.find = new Button(ButtonsConstants.INSTANCE.findText(), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            if (getFormPanel().isValid()) {
                execute();
            }
        }
    });
    getFormPanel().addButton(this.find);
    this.close = new Button(ButtonsConstants.INSTANCE.closeText(), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            GotoXYWidget.this.hide(GotoXYWidget.this.close);
        }
    });
    getFormPanel().addButton(this.close);
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) FieldSet(com.extjs.gxt.ui.client.widget.form.FieldSet) GPEPSGContentPanel(org.geosdi.geoplatform.gui.client.widget.map.GPEPSGContentPanel) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField) FillToolItem(com.extjs.gxt.ui.client.widget.toolbar.FillToolItem) SaveStatus(org.geosdi.geoplatform.gui.client.widget.SaveStatus) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener)

Example 8 with FillToolItem

use of com.extjs.gxt.ui.client.widget.toolbar.FillToolItem in project geo-platform by geosdi.

the class GeoPlatformLayoutManager method createCenter.

/**
 * Create Center Panel in Main UI
 */
private void createCenter() {
    center = new ContentPanel();
    center.setHeaderVisible(false);
    BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
    data.setMargins(new Margins(5, 5, 5, 5));
    center.setLayoutOnChange(true);
    center.addWidgetListener(new WidgetListener() {

        @Override
        public void widgetResized(ComponentEvent ce) {
            Dispatcher.forwardEvent(GeoPlatformEvents.UPDATE_CENTER);
            MapHandlerManager.fireEvent(new ScaleChangeEvent(XDOM.getViewportSize()));
        }
    });
    ToolBar toolBar = new ToolBar();
    statusMap = new Status();
    statusMap.setText(ApiModuleMessages.INSTANCE.GeoPlatformLayoutManager_wellcomeMessage(GWT.getModuleName()));
    statusMap.setWidth(150);
    toolBar.add(statusMap);
    toolBar.add(new FillToolItem());
    center.setBottomComponent(toolBar);
    viewport.add(center, data);
}
Also used : WidgetListener(com.extjs.gxt.ui.client.event.WidgetListener) Status(com.extjs.gxt.ui.client.widget.Status) BorderLayoutData(com.extjs.gxt.ui.client.widget.layout.BorderLayoutData) ToolBar(com.extjs.gxt.ui.client.widget.toolbar.ToolBar) Margins(com.extjs.gxt.ui.client.util.Margins) ScaleChangeEvent(org.geosdi.geoplatform.gui.configuration.map.puregwt.event.ScaleChangeEvent) ComponentEvent(com.extjs.gxt.ui.client.event.ComponentEvent) FillToolItem(com.extjs.gxt.ui.client.widget.toolbar.FillToolItem) ContentPanel(com.extjs.gxt.ui.client.widget.ContentPanel)

Example 9 with FillToolItem

use of com.extjs.gxt.ui.client.widget.toolbar.FillToolItem in project geo-platform by geosdi.

the class CatalogGridLayersWidget method initFormPanel.

private void initFormPanel() {
    this.formPanel = new FormPanel();
    this.formPanel.setHeaderVisible(false);
    this.formPanel.setFrame(true);
    this.formPanel.setLayout(new FlowLayout());
    this.formPanel.add(this.grid);
    StoreFilterField<L> filter = this.createFilter();
    filter.setToolTip(CatalogFinderConstants.INSTANCE.CatalogGridLayersWidget_filterTooltipText());
    filter.bind(super.store);
    this.formPanel.setButtonAlign(Style.HorizontalAlignment.LEFT);
    this.formPanel.getButtonBar().add(filter);
    this.formPanel.getButtonBar().add(new FillToolItem());
    this.done = new Button(ButtonsConstants.INSTANCE.doneText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.done()));
    this.done.addSelectionListener(new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            expander.executeActionRequest();
        }
    });
    this.done.disable();
    this.formPanel.getButtonBar().add(this.done);
}
Also used : FlowLayout(com.extjs.gxt.ui.client.widget.layout.FlowLayout) 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) FillToolItem(com.extjs.gxt.ui.client.widget.toolbar.FillToolItem)

Example 10 with FillToolItem

use of com.extjs.gxt.ui.client.widget.toolbar.FillToolItem in project geo-platform by geosdi.

the class FeatureWidget method createStatusBar.

private void createStatusBar() {
    super.setButtonAlign(Style.HorizontalAlignment.LEFT);
    super.getButtonBar().add(this.statusBar);
    super.getButtonBar().add(new FillToolItem());
    super.addButton(resetButton);
    super.addButton(saveButton);
    this.disableButtons();
    Button close = new Button(ButtonsConstants.INSTANCE.closeText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.cancel()), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            hide();
        }
    });
    close.setEnabled(super.isClosable());
    super.addButton(close);
}
Also used : SaveButton(org.geosdi.geoplatform.gui.client.config.annotation.SaveButton) ResetButton(org.geosdi.geoplatform.gui.client.config.annotation.ResetButton) 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)

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