use of com.extjs.gxt.ui.client.widget.form.AdapterField in project geo-platform by geosdi.
the class CQLFilterBasicTab method addCQLBasicRow.
private CQLFilterBasicRow addCQLBasicRow() {
CQLFilterBasicRow basicRow = new CQLFilterBasicRow(treePanel);
Button deleteRowButton = this.generateDeleteButton(basicRow);
basicRow.add(new AdapterField(deleteRowButton));
this.filterList.add(basicRow);
this.expressionsPanel.add(basicRow.getLogicalOperatorComboBox());
this.expressionsPanel.add(basicRow);
this.expressionsPanel.layout();
return basicRow;
}
use of com.extjs.gxt.ui.client.widget.form.AdapterField in project kura by eclipse.
the class TcpIpConfigTab method onRender.
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setLayout(new FitLayout());
setId("network-tcpip");
FormData formData = new FormData();
formData.setWidth(250);
m_formPanel = new FormPanel();
m_formPanel.setFrame(false);
m_formPanel.setBodyBorder(false);
m_formPanel.setHeaderVisible(false);
m_formPanel.setLayout(new FlowLayout());
m_formPanel.setStyleAttribute("min-width", "775px");
m_formPanel.setStyleAttribute("padding-left", "30px");
m_fieldSet = new FieldSet();
FormLayout layoutAccount = new FormLayout();
layoutAccount.setLabelWidth(Constants.LABEL_WIDTH_FORM);
m_fieldSet.setLayout(layoutAccount);
m_fieldSet.setBorders(false);
//
// Enabled
//
initializeStatusListStore();
//
// Tool Tip Box
//
toolTipField.setText(defaultToolTip);
m_fieldSet.add(toolTipField);
//
// Status Combo
//
m_statusCombo = new ComboBox<GwtNetIfStatusModel>();
m_statusCombo.setName("comboStatus");
m_statusCombo.setDisplayField(GwtNetIfStatusModel.NAME);
m_statusCombo.setFieldLabel(MSGS.netIPv4Status());
m_statusCombo.setEditable(false);
m_statusCombo.setStore(m_statusListStore);
m_statusCombo.setTemplate(getTemplate());
m_statusCombo.setTypeAhead(true);
m_statusCombo.setTriggerAction(TriggerAction.ALL);
m_statusCombo.setValue(m_statusListStore.findModel(GwtNetIfStatusModel.STATUS, GwtNetIfStatus.netIPv4StatusDisabled.name()));
m_statusCombo.addSelectionChangedListener(new SelectionChangedListener<GwtNetIfStatusModel>() {
@Override
public void selectionChanged(SelectionChangedEvent<GwtNetIfStatusModel> se) {
m_netInterfaceConfigTabs.adjustInterfaceTabs();
refreshForm();
// Check for other WAN interfaces if current interface is changed to WAN
if (isWanEnabled()) {
m_formPanel.mask(MSGS.waiting());
gwtNetworkService.findNetInterfaceConfigurations(new AsyncCallback<ListLoadResult<GwtNetInterfaceConfig>>() {
public void onFailure(Throwable caught) {
m_formPanel.unmask();
;
}
public void onSuccess(ListLoadResult<GwtNetInterfaceConfig> result) {
for (GwtNetInterfaceConfig config : result.getData()) {
if (config.getStatusEnum().equals(GwtNetIfStatus.netIPv4StatusEnabledWAN) && !config.getName().equals(m_selectNetIfConfig.getName())) {
m_statusCombo.fireEvent(Events.Invalid);
}
}
m_formPanel.unmask();
;
}
});
} else {
FormUtils.removeWarningFieldIcon(m_statusCombo);
}
}
});
m_statusCombo.addStyleName("kura-combobox");
m_statusCombo.addPlugin(m_dirtyPlugin);
m_statusCombo.addPlugin(m_warningPlugin);
m_fieldSet.add(m_statusCombo, formData);
//
// Configure IP
//
m_configureCombo = new SimpleComboBox<String>();
m_configureCombo.setName("comboConfigure");
m_configureCombo.setFieldLabel(MSGS.netIPv4Configure());
m_configureCombo.setEditable(false);
m_configureCombo.setTypeAhead(true);
m_configureCombo.setTriggerAction(TriggerAction.ALL);
m_configureCombo.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
// show account status combo box
for (GwtNetIfConfigMode mode : GwtNetIfConfigMode.values()) {
m_configureCombo.add(MessageUtils.get(mode.name()));
}
if ((m_selectNetIfConfig != null) && (m_selectNetIfConfig.getHwTypeEnum() == GwtNetIfType.MODEM)) {
m_statusListStore.remove(m_statusListStore.findModel(GwtNetIfStatusModel.STATUS, GwtNetIfStatus.netIPv4StatusEnabledLAN.name()));
}
m_configureCombo.setSimpleValue(MessageUtils.get(GwtNetIfConfigMode.netIPv4ConfigModeDHCP.name()));
m_configureCombo.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
m_netInterfaceConfigTabs.adjustInterfaceTabs();
refreshForm();
}
});
m_configureCombo.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netIPv4ToolTipConfigure()));
m_configureCombo.addStyleName("kura-combobox");
m_configureCombo.addPlugin(m_dirtyPlugin);
m_fieldSet.add(m_configureCombo, formData);
//
// IP Address
//
m_ipAddressField = new TextField<String>();
m_ipAddressField.setAllowBlank(true);
m_ipAddressField.setName("ipAddress");
m_ipAddressField.setFieldLabel(MSGS.netIPv4Address());
m_ipAddressField.setRegex(IPV4_REGEX);
m_ipAddressField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
m_ipAddressField.addPlugin(m_dirtyPlugin);
m_ipAddressField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netIPv4ToolTipAddress()));
m_ipAddressField.addStyleName("kura-textfield");
m_fieldSet.add(m_ipAddressField, formData);
//
// Subnet mask
//
m_subnetMaskField = new TextField<String>();
m_subnetMaskField.setAllowBlank(true);
m_subnetMaskField.setName("subnetMask");
m_subnetMaskField.setFieldLabel(MSGS.netIPv4SubnetMask());
m_subnetMaskField.setRegex(IPV4_REGEX);
m_subnetMaskField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
m_subnetMaskField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netIPv4ToolTipSubnetMask()));
m_subnetMaskField.addStyleName("kura-textfield");
m_subnetMaskField.addPlugin(m_dirtyPlugin);
m_fieldSet.add(m_subnetMaskField, formData);
//
// Gateway
//
m_gatewayField = new TextField<String>();
m_gatewayField.setAllowBlank(true);
m_gatewayField.setName("gateway");
m_gatewayField.setFieldLabel(MSGS.netIPv4Gateway());
m_gatewayField.setRegex(IPV4_REGEX);
m_gatewayField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
m_gatewayField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netIPv4ToolTipGateway()));
m_gatewayField.addStyleName("kura-textfield");
m_gatewayField.addPlugin(m_dirtyPlugin);
m_fieldSet.add(m_gatewayField, formData);
//
// Renew DHCP Lease
//
Button renewDHCP = new Button(MSGS.netIPv4RenewDHCPLease(), // no image
null, new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
FailureHandler.handle(ex);
}
@Override
public void onSuccess(GwtXSRFToken token) {
gwtNetworkService.renewDhcpLease(token, m_selectNetIfConfig.getName(), new AsyncCallback<Void>() {
public void onSuccess(Void result) {
update();
Log.debug("successfully renewed DHCP lease");
}
public void onFailure(Throwable caught) {
Log.debug("caught: " + caught.toString());
FailureHandler.handle(caught);
}
});
}
});
}
});
m_renewDHCPButton = new AdapterField(renewDHCP);
m_renewDHCPButton.setId("net-ipv4-renew-dhcp");
m_renewDHCPButton.setLabelSeparator("");
m_renewDHCPButton.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netIPv4ToolTipRenew()));
FormData formDataButton = new FormData();
formDataButton.setWidth(150);
m_renewDHCPButton.addPlugin(m_dirtyPlugin);
m_fieldSet.add(m_renewDHCPButton, formDataButton);
//
// DNS read-only (for DHCP)
//
m_dnsReadOnlyField = new TextArea();
m_dnsReadOnlyField.setAllowBlank(true);
m_dnsReadOnlyField.setName("dnsReadOnlyServers");
m_dnsReadOnlyField.setFieldLabel(MSGS.netIPv4DNSServers());
m_dnsReadOnlyField.setEnabled(false);
m_dnsReadOnlyField.setHeight("1.5em");
m_dnsReadOnlyField.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
m_dnsReadOnlyField.setStyleAttribute("margin-bottom", "0px");
m_dnsReadOnlyField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netIPv4ToolTipDns()));
m_fieldSet.add(m_dnsReadOnlyField, formData);
//
// DNS
//
m_dnsField = new TextArea();
m_dnsField.setAllowBlank(true);
m_dnsField.setName("dnsServers");
m_dnsField.setFieldLabel(MSGS.netIPv4DNSServers());
m_dnsField.setRegex("((" + IPV4_REGEX + ")[\\s,;\\n\\r\\t]*)+");
m_dnsField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
m_dnsField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netIPv4ToolTipDns()));
m_dnsField.addListener(Events.OnChange, new Listener<FieldEvent>() {
// Hide the DNS entry from the DHCP server if a custom DNS entry is added
public void handleEvent(FieldEvent be) {
TextArea t = (TextArea) be.getField();
if (t.getValue() == null || t.getValue().isEmpty()) {
showReadOnlyDns();
} else {
hideReadOnlyDns();
}
}
});
m_dnsField.addPlugin(m_dirtyPlugin);
m_fieldSet.add(m_dnsField, formData);
//
// Search Domains
//
m_domainsField = new TextArea();
m_domainsField.setAllowBlank(true);
m_domainsField.setName("searchDomains");
m_domainsField.setFieldLabel(MSGS.netIPv4SearchDomains());
m_domainsField.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
m_domainsField.addPlugin(m_dirtyPlugin);
m_fieldSet.add(m_domainsField, formData);
m_formPanel.add(m_fieldSet);
add(m_formPanel);
setScrollMode(Scroll.AUTO);
m_initialized = true;
}
Aggregations