Search in sources :

Example 1 with SimpleComboBox

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

the class DeviceFilterPanel method onRender.

protected void onRender(final Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FitLayout());
    ContentPanel formPanel = new ContentPanel();
    formPanel.setScrollMode(Scroll.AUTOY);
    formPanel.setBorders(false);
    formPanel.setHeaderVisible(false);
    formPanel.setLayout(new RowLayout(Orientation.VERTICAL));
    formPanel.setBodyStyle("background-color:#F0F0F0");
    // 
    // Top explanation
    final Text infoLabel = new Text(MSGS.deviceFilteringPanelInfo());
    infoLabel.setWidth(WIDTH + 5);
    infoLabel.setStyleAttribute("margin", "5px");
    formPanel.add(infoLabel);
    // 
    // ClientId
    final Label clientIdLabel = new Label(MSGS.deviceFilteringPanelClientId());
    clientIdLabel.setWidth(WIDTH);
    clientIdLabel.setStyleAttribute("margin", "5px");
    formPanel.add(clientIdLabel);
    final TextField<String> clientIdField = new TextField<String>();
    clientIdField.setName("clientId");
    clientIdField.setWidth(WIDTH);
    clientIdField.setStyleAttribute("margin-top", "0px");
    clientIdField.setStyleAttribute("margin-left", "5px");
    clientIdField.setStyleAttribute("margin-right", "5px");
    clientIdField.setStyleAttribute("margin-bottom", "10px");
    formPanel.add(clientIdField);
    // 
    // DisplayName
    final Label displayNameLabel = new Label(MSGS.deviceFilteringPanelDisplayName());
    displayNameLabel.setWidth(WIDTH);
    displayNameLabel.setStyleAttribute("margin", "5px");
    formPanel.add(displayNameLabel);
    final TextField<String> displayNameField = new TextField<String>();
    displayNameField.setName("displayName");
    displayNameField.setWidth(WIDTH);
    displayNameField.setStyleAttribute("margin-top", "0px");
    displayNameField.setStyleAttribute("margin-left", "5px");
    displayNameField.setStyleAttribute("margin-right", "5px");
    displayNameField.setStyleAttribute("margin-bottom", "10px");
    formPanel.add(displayNameField);
    // 
    // Serial Number
    final Label serialNumberLabel = new Label(MSGS.deviceFilteringPanelSerialNumber());
    serialNumberLabel.setWidth(WIDTH);
    serialNumberLabel.setStyleAttribute("margin", "5px");
    formPanel.add(serialNumberLabel);
    final TextField<String> serialNumberField = new TextField<String>();
    serialNumberField.setName("serialNumber");
    serialNumberField.setWidth(WIDTH);
    serialNumberField.setStyleAttribute("margin-top", "0px");
    serialNumberField.setStyleAttribute("margin-left", "5px");
    serialNumberField.setStyleAttribute("margin-right", "5px");
    serialNumberField.setStyleAttribute("margin-bottom", "10px");
    formPanel.add(serialNumberField);
    // 
    // Status
    final Label statusLabel = new Label(MSGS.deviceFilteringPanelStatus());
    statusLabel.setWidth(WIDTH);
    statusLabel.setStyleAttribute("margin", "5px");
    formPanel.add(statusLabel);
    final SimpleComboBox<GwtDeviceQueryPredicates.GwtDeviceStatus> statusCombo = new SimpleComboBox<GwtDeviceQueryPredicates.GwtDeviceStatus>();
    statusCombo.setName("status");
    statusCombo.setWidth(WIDTH);
    statusCombo.setStyleAttribute("margin-top", "0px");
    statusCombo.setStyleAttribute("margin-left", "5px");
    statusCombo.setStyleAttribute("margin-right", "5px");
    statusCombo.setStyleAttribute("margin-bottom", "10px");
    statusCombo.setEmptyText(MSGS.deviceFilteringPanelStatusEmptyText());
    statusCombo.add(GwtDeviceQueryPredicates.GwtDeviceStatus.ANY);
    statusCombo.add(GwtDeviceQueryPredicates.GwtDeviceStatus.ENABLED);
    statusCombo.add(GwtDeviceQueryPredicates.GwtDeviceStatus.DISABLED);
    statusCombo.setEditable(false);
    statusCombo.setTriggerAction(TriggerAction.ALL);
    statusCombo.setSimpleValue(GwtDeviceQueryPredicates.GwtDeviceStatus.ANY);
    formPanel.add(statusCombo);
    // 
    // Connection Status
    final Label connectionStatusLabel = new Label(MSGS.deviceFilteringPanelConnectionStatus());
    connectionStatusLabel.setWidth(WIDTH);
    connectionStatusLabel.setStyleAttribute("margin", "5px");
    formPanel.add(connectionStatusLabel);
    final SimpleComboBox<GwtDeviceQueryPredicates.GwtDeviceConnectionStatus> connectionStatusCombo = new SimpleComboBox<GwtDeviceQueryPredicates.GwtDeviceConnectionStatus>();
    connectionStatusCombo.setName("status");
    connectionStatusCombo.setWidth(WIDTH);
    connectionStatusCombo.setStyleAttribute("margin-top", "0px");
    connectionStatusCombo.setStyleAttribute("margin-left", "5px");
    connectionStatusCombo.setStyleAttribute("margin-right", "5px");
    connectionStatusCombo.setStyleAttribute("margin-bottom", "10px");
    connectionStatusCombo.setEmptyText(MSGS.deviceFilteringPanelConnectionStatusEmptyText());
    connectionStatusCombo.add(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.ANY);
    connectionStatusCombo.add(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.CONNECTED);
    connectionStatusCombo.add(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.MISSING);
    connectionStatusCombo.add(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.DISCONNECTED);
    connectionStatusCombo.setEditable(false);
    connectionStatusCombo.setTriggerAction(TriggerAction.ALL);
    connectionStatusCombo.setSimpleValue(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.ANY);
    formPanel.add(connectionStatusCombo);
    // 
    // Esf Version
    final Label esfVersionLabel = new Label(MSGS.deviceFilteringPanelESFVersion());
    esfVersionLabel.setWidth(WIDTH);
    esfVersionLabel.setStyleAttribute("margin", "5px");
    formPanel.add(esfVersionLabel);
    final TextField<String> esfVersionField = new TextField<String>();
    esfVersionField.setName("esfVersion");
    esfVersionField.setWidth(WIDTH);
    esfVersionField.setStyleAttribute("margin-top", "0px");
    esfVersionField.setStyleAttribute("margin-left", "5px");
    esfVersionField.setStyleAttribute("margin-right", "5px");
    esfVersionField.setStyleAttribute("margin-bottom", "10px");
    formPanel.add(esfVersionField);
    // 
    // Application Identifiers
    final Label applicationIdentifiersLabel = new Label(MSGS.deviceFilteringPanelApplications());
    applicationIdentifiersLabel.setWidth(WIDTH);
    applicationIdentifiersLabel.setStyleAttribute("margin", "5px");
    formPanel.add(applicationIdentifiersLabel);
    final TextField<String> applicationIdentifiersField = new TextField<String>();
    applicationIdentifiersField.setName("applicationIdentifiers");
    applicationIdentifiersField.setWidth(WIDTH);
    applicationIdentifiersField.setStyleAttribute("margin-top", "0px");
    applicationIdentifiersField.setStyleAttribute("margin-left", "5px");
    applicationIdentifiersField.setStyleAttribute("margin-right", "5px");
    applicationIdentifiersField.setStyleAttribute("margin-bottom", "10px");
    formPanel.add(applicationIdentifiersField);
    // 
    // Custom Attribute 1
    final Label customAttribute1Label = new Label(MSGS.deviceFilteringPanelCustomAttribute1());
    customAttribute1Label.setWidth(WIDTH);
    customAttribute1Label.setStyleAttribute("margin", "5px");
    formPanel.add(customAttribute1Label);
    final TextField<String> customAttribute1Field = new TextField<String>();
    customAttribute1Field.setName("customAttribute1");
    customAttribute1Field.setWidth(WIDTH);
    customAttribute1Field.setStyleAttribute("margin-top", "0px");
    customAttribute1Field.setStyleAttribute("margin-left", "5px");
    customAttribute1Field.setStyleAttribute("margin-right", "5px");
    customAttribute1Field.setStyleAttribute("margin-bottom", "10px");
    formPanel.add(customAttribute1Field);
    // 
    // Custom Attribute 2
    final Label customAttribute2Label = new Label(MSGS.deviceFilteringPanelCustomAttribute2());
    customAttribute2Label.setWidth(WIDTH);
    customAttribute2Label.setStyleAttribute("margin", "5px");
    formPanel.add(customAttribute2Label);
    final TextField<String> customAttribute2Field = new TextField<String>();
    customAttribute2Field.setName("customAttribute1");
    customAttribute2Field.setWidth(WIDTH);
    customAttribute2Field.setStyleAttribute("margin-top", "0px");
    customAttribute2Field.setStyleAttribute("margin-left", "5px");
    customAttribute2Field.setStyleAttribute("margin-right", "5px");
    customAttribute2Field.setStyleAttribute("margin-bottom", "5px");
    formPanel.add(customAttribute2Field);
    // 
    // Buttons
    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setBorders(false);
    buttonPanel.setStyleAttribute("background-color", "#F0F0F0");
    buttonPanel.setStyleAttribute("margin-left", "5px");
    buttonPanel.setStyleAttribute("margin-top", "5px");
    buttonPanel.setHorizontalAlign(HorizontalAlignment.RIGHT);
    buttonPanel.setHeight(50);
    final Button searchButton = new Button(MSGS.deviceFilteringPanelSearch());
    searchButton.setStyleAttribute("margin-left", "5px");
    searchButton.addListener(Events.OnClick, new Listener<BaseEvent>() {

        @Override
        public void handleEvent(BaseEvent be) {
            GwtDeviceQueryPredicates predicates = new GwtDeviceQueryPredicates();
            if (clientIdField.getValue() != null && !clientIdField.getValue().trim().isEmpty()) {
                predicates.setClientId(unescapeValue(clientIdField.getValue()));
            }
            if (displayNameField.getValue() != null && !displayNameField.getValue().trim().isEmpty()) {
                predicates.setDisplayName(unescapeValue(displayNameField.getValue()));
            }
            if (serialNumberField.getValue() != null && !serialNumberField.getValue().trim().isEmpty()) {
                predicates.setSerialNumber(unescapeValue(serialNumberField.getValue()));
            }
            if (!statusCombo.getValue().getValue().equals(GwtDeviceQueryPredicates.GwtDeviceStatus.ANY)) {
                predicates.setDeviceStatus(statusCombo.getValue().getValue().name());
            }
            if (!connectionStatusCombo.getValue().getValue().equals(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.ANY)) {
                predicates.setDeviceConnectionStatus(connectionStatusCombo.getValue().getValue().name());
            }
            if (esfVersionField.getValue() != null && !esfVersionField.getValue().trim().isEmpty()) {
                predicates.setEsfVersion(unescapeValue(esfVersionField.getValue()));
            }
            if (applicationIdentifiersField.getValue() != null && !applicationIdentifiersField.getValue().trim().isEmpty()) {
                predicates.setApplicationIdentifiers(unescapeValue(applicationIdentifiersField.getValue()));
            }
            if (customAttribute1Field.getValue() != null && !customAttribute1Field.getValue().trim().isEmpty()) {
                predicates.setCustomAttribute1(unescapeValue(customAttribute1Field.getValue()));
            }
            if (customAttribute2Field.getValue() != null && !customAttribute2Field.getValue().trim().isEmpty()) {
                predicates.setCustomAttribute2(unescapeValue(customAttribute2Field.getValue()));
            }
            m_deviceTable.refreshAll(predicates);
        }
    });
    final Button resetButton = new Button(MSGS.deviceFilteringPanelReset());
    resetButton.addListener(Events.OnClick, new Listener<BaseEvent>() {

        @Override
        public void handleEvent(BaseEvent be) {
            clientIdField.setValue("");
            displayNameField.setValue("");
            serialNumberField.setValue("");
            statusCombo.setSimpleValue(GwtDeviceQueryPredicates.GwtDeviceStatus.ANY);
            connectionStatusCombo.setSimpleValue(GwtDeviceQueryPredicates.GwtDeviceConnectionStatus.ANY);
            esfVersionField.setValue("");
            applicationIdentifiersField.setValue("");
            customAttribute1Field.setValue("");
            customAttribute2Field.setValue("");
            m_deviceTable.refreshAll(new GwtDeviceQueryPredicates());
        }
    });
    buttonPanel.add(resetButton);
    buttonPanel.add(searchButton);
    formPanel.add(buttonPanel);
    add(formPanel);
}
Also used : SimpleComboBox(com.extjs.gxt.ui.client.widget.form.SimpleComboBox) Label(com.extjs.gxt.ui.client.widget.Label) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) Text(com.extjs.gxt.ui.client.widget.Text) ContentPanel(com.extjs.gxt.ui.client.widget.ContentPanel) Button(com.extjs.gxt.ui.client.widget.button.Button) GwtDeviceQueryPredicates(org.eclipse.kapua.app.console.shared.model.GwtDeviceQueryPredicates) RowLayout(com.extjs.gxt.ui.client.widget.layout.RowLayout) HorizontalPanel(com.extjs.gxt.ui.client.widget.HorizontalPanel) TextField(com.extjs.gxt.ui.client.widget.form.TextField) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 2 with SimpleComboBox

use of com.extjs.gxt.ui.client.widget.form.SimpleComboBox 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 3 with SimpleComboBox

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

the class MatchComboFieldProvider method get.

@Override
public SimpleComboBox<String> get() {
    SimpleComboBox<String> matchComboField = new SimpleComboBox<String>() {

        @Override
        protected void onSelect(SimpleComboValue<String> model, int index) {
            super.onSelect(model, index);
        }
    };
    matchComboField.setToolTip(new ToolTipConfig("Match selection", "Change feature selection"));
    matchComboField.setEditable(Boolean.FALSE);
    matchComboField.setTypeAhead(Boolean.TRUE);
    matchComboField.setTriggerAction(ComboBox.TriggerAction.ALL);
    matchComboField.add(LogicOperatorType.ALL.name());
    matchComboField.add(LogicOperatorType.ANY.name());
    matchComboField.add(LogicOperatorType.NONE.name());
    matchComboField.setSimpleValue(LogicOperatorType.ALL.name());
    return matchComboField;
}
Also used : SimpleComboBox(com.extjs.gxt.ui.client.widget.form.SimpleComboBox) SimpleComboValue(com.extjs.gxt.ui.client.widget.form.SimpleComboValue) ToolTipConfig(com.extjs.gxt.ui.client.widget.tips.ToolTipConfig)

Example 4 with SimpleComboBox

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

the class ManageRolesWidget method prepareColumnModel.

private ColumnModel prepareColumnModel() {
    List<ColumnConfig> configs = Lists.<ColumnConfig>newArrayList();
    ColumnConfig iconColumn = new ColumnConfig();
    iconColumn.setId("icon");
    iconColumn.setHeaderHtml(UserModuleConstants.INSTANCE.ManageRolesWidget_iconText());
    iconColumn.setWidth(35);
    iconColumn.setFixed(true);
    iconColumn.setResizable(false);
    iconColumn.setSortable(false);
    iconColumn.setRenderer(new GPGridCellRenderer<GuiComponentDetail>() {

        @Override
        public Object render(GuiComponentDetail model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<GuiComponentDetail> store, Grid<GuiComponentDetail> grid) {
            Button button = new Button();
            button.setIcon(model.getImage());
            button.setAutoWidth(true);
            return button;
        }
    });
    configs.add(iconColumn);
    ColumnConfig idColumn = new ColumnConfig();
    idColumn.setId(GuiComponentDetailKeyValue.COMPONENT_ID.toString());
    idColumn.setHeaderHtml(UserModuleConstants.INSTANCE.ManageRolesWidget_componentIDText());
    idColumn.setFixed(true);
    configs.add(idColumn);
    final SimpleComboBox<GuiPermission> permissionComboBox = new SimpleComboBox<GuiPermission>();
    permissionComboBox.setEditable(false);
    permissionComboBox.setTriggerAction(ComboBox.TriggerAction.ALL);
    permissionComboBox.add(Arrays.asList(GuiPermission.values()));
    CellEditor comboEditor = new CellEditor(permissionComboBox) {

        @Override
        public Object preProcessValue(Object value) {
            if (value == null) {
                return value;
            }
            return permissionComboBox.findModel((GuiPermission) value);
        }

        @Override
        public Object postProcessValue(Object value) {
            if (value == null) {
                return value;
            }
            return ((SimpleComboValue<GuiPermission>) value).getValue();
        }
    };
    GridCellRenderer<GuiComponentDetail> rendererPermission = new GridCellRenderer<GuiComponentDetail>() {

        @Override
        public Object render(GuiComponentDetail model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<GuiComponentDetail> store, Grid<GuiComponentDetail> grid) {
            GuiPermission permission = model.getPermission();
            return "<span style='color:" + permission.toStringColor() + "'>" + permission + "</span>";
        }
    };
    ColumnConfig permissionColumn = new ColumnConfig();
    permissionColumn.setId(GuiComponentDetailKeyValue.PERMISSION.toString());
    permissionColumn.setHeaderHtml(UserModuleConstants.INSTANCE.ManageRolesWidget_permissionsText());
    permissionColumn.setWidth(150);
    permissionColumn.setFixed(true);
    permissionColumn.setEditor(comboEditor);
    permissionColumn.setRenderer(rendererPermission);
    configs.add(permissionColumn);
    return new ColumnModel(configs);
}
Also used : SimpleComboBox(com.extjs.gxt.ui.client.widget.form.SimpleComboBox) ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) GuiPermission(org.geosdi.geoplatform.gui.client.model.GuiPermission) CellEditor(com.extjs.gxt.ui.client.widget.grid.CellEditor) SimpleComboValue(com.extjs.gxt.ui.client.widget.form.SimpleComboValue) Grid(com.extjs.gxt.ui.client.widget.grid.Grid) EditorGrid(com.extjs.gxt.ui.client.widget.grid.EditorGrid) ColumnData(com.extjs.gxt.ui.client.widget.grid.ColumnData) ListStore(com.extjs.gxt.ui.client.store.ListStore) GuiComponentDetail(org.geosdi.geoplatform.gui.client.model.GuiComponentDetail) GridCellRenderer(com.extjs.gxt.ui.client.widget.grid.GridCellRenderer) GPGridCellRenderer(org.geosdi.geoplatform.gui.client.widget.grid.renderer.GPGridCellRenderer) SplitButton(com.extjs.gxt.ui.client.widget.button.SplitButton) Button(com.extjs.gxt.ui.client.widget.button.Button) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel)

Example 5 with SimpleComboBox

use of com.extjs.gxt.ui.client.widget.form.SimpleComboBox in project jahia by Jahia.

the class ReleaseModuleWindow method onRender.

@Override
protected void onRender(Element element, int index) {
    super.onRender(element, index);
    String versionInfo = JahiaGWTParameters.getSiteNode().get("j:versionInfo");
    setLayout(new FitLayout());
    setHeadingHtml(Messages.get("label.releaseWar") + "&nbsp;" + versionInfo + "&nbsp;->&nbsp;" + versionInfo.replace("-SNAPSHOT", ""));
    setModal(true);
    setWidth(500);
    setHeight(150);
    final List<Integer> versionNumbers = JahiaGWTParameters.getSiteNode().get("j:versionNumbers");
    final FormPanel formPanel = new FormPanel();
    formPanel.setHeaderVisible(false);
    formPanel.setLabelWidth(150);
    formPanel.setButtonAlign(HorizontalAlignment.CENTER);
    final SimpleComboBox<String> cbNextVersion = new SimpleComboBox<String>();
    cbNextVersion.setFieldLabel(Messages.get("label.nextVersion", "Next iteration version"));
    cbNextVersion.setTriggerAction(ComboBox.TriggerAction.ALL);
    cbNextVersion.setForceSelection(false);
    String minorVersion = generateVersionNumber(versionNumbers, 1);
    cbNextVersion.add(minorVersion);
    cbNextVersion.add(generateVersionNumber(versionNumbers, 0));
    cbNextVersion.setSimpleValue(minorVersion);
    formPanel.add(cbNextVersion);
    final FieldSet fs = new FieldSet();
    fs.setCheckboxToggle(true);
    final FormLayout fl = new FormLayout();
    fl.setLabelWidth(100);
    fl.setDefaultWidth(330);
    fs.setLayout(fl);
    final TextField<String> tfUsername = new TextField<String>();
    final TextField<String> tfPassword = new TextField<String>();
    tfUsername.setFieldLabel(Messages.get("label.username", "Username"));
    tfPassword.setFieldLabel(Messages.get("label.password", "Password"));
    tfPassword.setPassword(true);
    setHeight(300);
    if (releaseInfo.getForgeUrl() != null) {
        fs.setHeadingHtml(Messages.get("label.releaseModule.publishToModuleForge", "Publish to module Private App Store"));
        LabelField lbCatalogUrl = new LabelField();
        lbCatalogUrl.setToolTip(releaseInfo.getForgeUrl());
        lbCatalogUrl.setValue(releaseInfo.getForgeUrl());
        lbCatalogUrl.setFieldLabel(Messages.get("label.url", "URL") + ":");
        fs.add(lbCatalogUrl);
        tfUsername.setValue(ForgeLoginWindow.username);
        tfPassword.setValue(ForgeLoginWindow.password);
        formPanel.add(fs);
    } else if (releaseInfo.getRepositoryUrl() != null) {
        fs.setHeadingHtml(Messages.get("label.releaseModule.publishToMaven", "Publish to Maven distribution server"));
        if (releaseInfo.getRepositoryId() != null) {
            LabelField lbRepoId = new LabelField();
            lbRepoId.setValue(releaseInfo.getRepositoryId());
            lbRepoId.setFieldLabel(Messages.get("label.id", "ID") + ":");
            fs.add(lbRepoId);
        }
        LabelField lbRepoUrl = new LabelField();
        lbRepoUrl.setToolTip(releaseInfo.getRepositoryUrl());
        lbRepoUrl.setValue(releaseInfo.getRepositoryUrl());
        lbRepoUrl.setFieldLabel(Messages.get("label.url", "URL") + ":");
        fs.add(lbRepoUrl);
        formPanel.add(fs);
    }
    fs.add(tfUsername);
    fs.add(tfPassword);
    Button b = new Button(Messages.get("label.release", "Release"), new SelectionListener<ButtonEvent>() {

        public void componentSelected(ButtonEvent event) {
            String v = cbNextVersion.getRawValue();
            if (v == null || v.length() == 0 || !v.endsWith("-SNAPSHOT")) {
                cbNextVersion.markInvalid(Messages.get("label.snapshotRequired", "Working version number must end with -SNAPSHOT"));
                return;
            }
            releaseInfo.setNextVersion(cbNextVersion.getRawValue());
            releaseInfo.setPublishToForge(releaseInfo.getForgeUrl() != null && fs.isVisible() && fs.isExpanded());
            releaseInfo.setPublishToMaven(releaseInfo.getRepositoryUrl() != null && fs.isVisible() && fs.isExpanded());
            releaseInfo.setUsername(tfUsername.getValue());
            releaseInfo.setPassword(tfPassword.getValue());
            if (releaseInfo.isPublishToForge()) {
                ForgeLoginWindow.username = tfUsername.getValue();
                ForgeLoginWindow.password = tfPassword.getValue();
            }
            callback.handle(releaseInfo);
        }
    });
    b.addStyleName("button-release");
    formPanel.addButton(b);
    final Window w = this;
    b = new Button(Messages.get("label.cancel", "Cancel"), new SelectionListener<ButtonEvent>() {

        public void componentSelected(ButtonEvent event) {
            w.hide();
        }
    });
    b.addStyleName("button-cancel");
    formPanel.addButton(b);
    add(formPanel);
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) Window(com.extjs.gxt.ui.client.widget.Window) SimpleComboBox(com.extjs.gxt.ui.client.widget.form.SimpleComboBox) 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) LabelField(com.extjs.gxt.ui.client.widget.form.LabelField) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener)

Aggregations

SimpleComboBox (com.extjs.gxt.ui.client.widget.form.SimpleComboBox)7 Button (com.extjs.gxt.ui.client.widget.button.Button)6 TextField (com.extjs.gxt.ui.client.widget.form.TextField)5 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)4 SelectionListener (com.extjs.gxt.ui.client.event.SelectionListener)4 FieldSet (com.extjs.gxt.ui.client.widget.form.FieldSet)4 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)4 LabelField (com.extjs.gxt.ui.client.widget.form.LabelField)4 FormLayout (com.extjs.gxt.ui.client.widget.layout.FormLayout)4 Status (com.extjs.gxt.ui.client.widget.Status)3 FlowLayout (com.extjs.gxt.ui.client.widget.layout.FlowLayout)3 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)3 FillToolItem (com.extjs.gxt.ui.client.widget.toolbar.FillToolItem)3 TextFieldValidator (org.eclipse.kura.web.client.util.TextFieldValidator)3 SimpleComboValue (com.extjs.gxt.ui.client.widget.form.SimpleComboValue)2 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)2 GwtFirewallNatMasquerade (org.eclipse.kura.web.shared.model.GwtFirewallNatMasquerade)2 GwtNetProtocol (org.eclipse.kura.web.shared.model.GwtNetProtocol)2 BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)1 FieldEvent (com.extjs.gxt.ui.client.event.FieldEvent)1