use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project geo-platform by geosdi.
the class SimpleUrlTextFields method setWidgetProperties.
protected final void setWidgetProperties() {
super.setLayout(new FormLayout());
super.setWidth(240);
urlTextField.setFieldLabel(LayerModuleConstants.INSTANCE.urlLabelText());
layerTextField.setFieldLabel(LayerModuleConstants.INSTANCE.SimpleUrlTextFields_layerNameText());
urlTextField.sinkEvents(Event.ONPASTE);
layerTextField.sinkEvents(Event.ONPASTE);
KeyListener keyListener = new KeyListener() {
@Override
public void componentKeyUp(ComponentEvent event) {
if ((urlTextField.getValue() == null) && (event.getKeyCode() == KeyCodes.KEY_BACKSPACE) || (event.getKeyCode() == KeyCodes.KEY_DELETE)) {
resetFields();
}
}
@Override
public void componentKeyPress(ComponentEvent event) {
if ((event.getKeyCode() == KeyCodes.KEY_ENTER) && checkUrl().isEmpty()) {
wmsGetMapDispatcher.verifyUrl(true, buildGetMapURL());
} else {
fireDelayed();
}
}
};
urlTextField.addKeyListener(keyListener);
layerTextField.addKeyListener(keyListener);
super.add(urlTextField, new FormData("100%"));
super.add(layerTextField, new FormData("100%"));
}
use of com.extjs.gxt.ui.client.widget.layout.FormLayout 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") + " " + versionInfo + " -> " + 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);
}
use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project kura by eclipse.
the class PortForwardForm method onRender.
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setId("firewall-port-forwarding-form");
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.firewallPortForwardFormInformation());
FormLayout layoutAccount = new FormLayout();
layoutAccount.setLabelWidth(LABEL_WIDTH_FORM);
fieldSet.setLayout(layoutAccount);
//
// in-bound interface
//
final LabelField inboundInterfaceLabel = new LabelField();
inboundInterfaceLabel.setName("inboundInterfaceLabel");
inboundInterfaceLabel.setFieldLabel(MSGS.firewallPortForwardFormInboundInterface());
inboundInterfaceLabel.setLabelSeparator(":");
fieldSet.add(inboundInterfaceLabel, formData);
final TextField<String> inboundInterfaceField = new TextField<String>();
inboundInterfaceField.setAllowBlank(false);
inboundInterfaceField.setName("interfaceName");
inboundInterfaceField.setFieldLabel(MSGS.firewallPortForwardFormInboundInterface());
inboundInterfaceField.setToolTip(MSGS.firewallPortForwardFormInboundInterfaceToolTip());
inboundInterfaceField.setValidator(new TextFieldValidator(inboundInterfaceField, FieldType.ALPHANUMERIC));
fieldSet.add(inboundInterfaceField, formData);
//
// out-bound interface
//
final LabelField outboundInterfaceLabel = new LabelField();
outboundInterfaceLabel.setName("inboundInterfaceLabel");
outboundInterfaceLabel.setFieldLabel(MSGS.firewallPortForwardFormOutboundInterface());
outboundInterfaceLabel.setLabelSeparator(":");
fieldSet.add(outboundInterfaceLabel, formData);
final TextField<String> outboundInterfaceField = new TextField<String>();
outboundInterfaceField.setAllowBlank(false);
outboundInterfaceField.setName("interfaceName");
outboundInterfaceField.setFieldLabel(MSGS.firewallPortForwardFormOutboundInterface());
outboundInterfaceField.setToolTip(MSGS.firewallPortForwardFormOutboundInterfaceToolTip());
outboundInterfaceField.setValidator(new TextFieldValidator(outboundInterfaceField, FieldType.ALPHANUMERIC));
fieldSet.add(outboundInterfaceField, formData);
//
// address
//
final LabelField addressLabel = new LabelField();
addressLabel.setName("addressLabel");
addressLabel.setFieldLabel(MSGS.firewallPortForwardFormAddress());
addressLabel.setLabelSeparator(":");
fieldSet.add(addressLabel, formData);
final TextField<String> addressField = new TextField<String>();
addressField.setAllowBlank(false);
addressField.setName("address");
addressField.setFieldLabel(MSGS.firewallPortForwardFormAddress());
addressField.setToolTip(MSGS.firewallPortForwardFormLanAddressToolTip());
addressField.setValidator(new TextFieldValidator(addressField, FieldType.IPv4_ADDRESS));
fieldSet.add(addressField, formData);
//
// protocol
//
final LabelField protocolLabel = new LabelField();
protocolLabel.setName("protocolLabel");
protocolLabel.setFieldLabel(MSGS.firewallPortForwardFormProtocol());
protocolLabel.setLabelSeparator(":");
fieldSet.add(protocolLabel, formData);
final SimpleComboBox<String> protocolCombo = new SimpleComboBox<String>();
protocolCombo.setName("protocolCombo");
protocolCombo.setFieldLabel(MSGS.firewallPortForwardFormProtocol());
protocolCombo.setEditable(false);
protocolCombo.setTypeAhead(true);
protocolCombo.setTriggerAction(TriggerAction.ALL);
protocolCombo.setToolTip(MSGS.firewallPortForwardFormProtocolToolTip());
for (GwtNetProtocol protocol : GwtNetProtocol.values()) {
protocolCombo.add(protocol.name());
}
protocolCombo.setSimpleValue(GwtNetProtocol.tcp.name());
fieldSet.add(protocolCombo, formData);
//
// in port number
//
final LabelField inPortLabel = new LabelField();
inPortLabel.setName("inPortLabel");
inPortLabel.setFieldLabel(MSGS.firewallPortForwardFormInPort());
inPortLabel.setLabelSeparator(":");
fieldSet.add(inPortLabel, formData);
final TextField<String> inPortField = new TextField<String>();
inPortField.setAllowBlank(false);
inPortField.setName("inPort");
inPortField.setFieldLabel(MSGS.firewallPortForwardFormInPort());
inPortField.setToolTip(MSGS.firewallPortForwardFormExternalPortToolTip());
inPortField.setValidator(new TextFieldValidator(inPortField, FieldType.NUMERIC));
fieldSet.add(inPortField, formData);
//
// out port number
//
final LabelField outPortLabel = new LabelField();
outPortLabel.setName("outPortLabel");
outPortLabel.setFieldLabel(MSGS.firewallPortForwardFormOutPort());
outPortLabel.setLabelSeparator(":");
fieldSet.add(outPortLabel, formData);
final TextField<String> outPortField = new TextField<String>();
outPortField.setAllowBlank(false);
outPortField.setName("outPort");
outPortField.setFieldLabel(MSGS.firewallPortForwardFormOutPort());
outPortField.setToolTip(MSGS.firewallPortForwardFormInternalPortToolTip());
outPortField.setValidator(new TextFieldValidator(outPortField, FieldType.NUMERIC));
fieldSet.add(outPortField, formData);
//
// masquerade
//
final LabelField masqueradeLabel = new LabelField();
masqueradeLabel.setName("masqueradeLabel");
masqueradeLabel.setFieldLabel(MSGS.firewallNatFormMasquerade());
masqueradeLabel.setLabelSeparator(":");
fieldSet.add(masqueradeLabel, formData);
final SimpleComboBox<String> masqueradeCombo = new SimpleComboBox<String>();
masqueradeCombo.setName("masqueradeCombo");
masqueradeCombo.setFieldLabel(MSGS.firewallNatFormMasquerade());
masqueradeCombo.setEditable(false);
masqueradeCombo.setTypeAhead(true);
masqueradeCombo.setTriggerAction(TriggerAction.ALL);
masqueradeCombo.setToolTip(MSGS.firewallPortForwardFormMasqueradingToolTip());
for (GwtFirewallNatMasquerade masquerade : GwtFirewallNatMasquerade.values()) {
masqueradeCombo.add(masquerade.name());
}
masqueradeCombo.setSimpleValue(GwtFirewallNatMasquerade.no.name());
fieldSet.add(masqueradeCombo, formData);
//
// permitted network
//
final LabelField permittedNetworkLabel = new LabelField();
permittedNetworkLabel.setName("permittedNetworkLabel");
permittedNetworkLabel.setFieldLabel(MSGS.firewallPortForwardFormPermittedNetwork());
permittedNetworkLabel.setLabelSeparator(":");
fieldSet.add(permittedNetworkLabel, formData);
final TextField<String> permittedNetworkField = new TextField<String>();
permittedNetworkField.setAllowBlank(true);
permittedNetworkField.setName("permittedNetwork");
permittedNetworkField.setFieldLabel(MSGS.firewallPortForwardFormPermittedNetwork());
permittedNetworkField.setToolTip(MSGS.firewallPortForwardFormPermittedNetworkToolTip());
permittedNetworkField.setValidator(new TextFieldValidator(permittedNetworkField, FieldType.NETWORK));
fieldSet.add(permittedNetworkField, formData);
//
// permitted MAC
//
final LabelField permittedMacLabel = new LabelField();
permittedMacLabel.setName("permittedMacLabel");
permittedMacLabel.setFieldLabel(MSGS.firewallPortForwardFormPermittedMac());
permittedMacLabel.setLabelSeparator(":");
fieldSet.add(permittedMacLabel, formData);
final TextField<String> permittedMacField = new TextField<String>();
permittedMacField.setAllowBlank(true);
permittedMacField.setName("permittedMac");
permittedMacField.setFieldLabel(MSGS.firewallPortForwardFormPermittedMac());
permittedMacField.setToolTip(MSGS.firewallPortForwardFormPermittedMacAddressToolTip());
permittedMacField.setValidator(new TextFieldValidator(permittedMacField, FieldType.MAC_ADDRESS));
fieldSet.add(permittedMacField, formData);
//
// source port range
//
final LabelField sourcePortRangeLabel = new LabelField();
sourcePortRangeLabel.setName("sourcePortRangeLabel");
sourcePortRangeLabel.setFieldLabel(MSGS.firewallPortForwardFormSourcePortRange());
sourcePortRangeLabel.setLabelSeparator(":");
fieldSet.add(sourcePortRangeLabel, formData);
final TextField<String> sourcePortRangeField = new TextField<String>();
sourcePortRangeField.setAllowBlank(true);
sourcePortRangeField.setName("sourcePortRange");
sourcePortRangeField.setFieldLabel(MSGS.firewallPortForwardFormSourcePortRange());
sourcePortRangeField.setToolTip(MSGS.firewallPortForwardFormSourcePortRangeToolTip());
sourcePortRangeField.setValidator(new TextFieldValidator(sourcePortRangeField, FieldType.PORT_RANGE));
fieldSet.add(sourcePortRangeField, formData);
// add the fieldSet to the panel
m_formPanel.add(fieldSet);
// disable the labels
inboundInterfaceLabel.setVisible(false);
outboundInterfaceLabel.setVisible(false);
addressLabel.setVisible(false);
protocolLabel.setVisible(false);
inPortLabel.setVisible(false);
outPortLabel.setVisible(false);
masqueradeLabel.setVisible(false);
permittedNetworkLabel.setVisible(false);
permittedMacLabel.setVisible(false);
sourcePortRangeLabel.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;
}
}
// we need to add a new row to the open ports table
if (m_existingEntry == null) {
// create a new entry
m_newEntry = new GwtFirewallPortForwardEntry();
m_newEntry.setInboundInterface(inboundInterfaceField.getValue());
m_newEntry.setOutboundInterface(outboundInterfaceField.getValue());
m_newEntry.setAddress(addressField.getValue());
m_newEntry.setProtocol(protocolCombo.getValue().getValue());
m_newEntry.setInPort(Integer.parseInt(inPortField.getValue()));
m_newEntry.setOutPort(Integer.parseInt(outPortField.getValue()));
m_newEntry.setMasquerade(masqueradeCombo.getValue().getValue());
m_newEntry.setPermittedNetwork(permittedNetworkField.getValue());
m_newEntry.setPermittedMAC(permittedMacField.getValue());
m_newEntry.setSourcePortRange(sourcePortRangeField.getValue());
if (m_newEntry.getPermittedMAC() != null) {
MessageBox.alert(MSGS.firewallPortForwardFormNotification(), MSGS.firewallPortForwardFormNotificationMacFiltering(), null);
}
} else {
// update the current entry
m_existingEntry = new GwtFirewallPortForwardEntry();
m_existingEntry.setInboundInterface(inboundInterfaceField.getValue());
m_existingEntry.setOutboundInterface(outboundInterfaceField.getValue());
m_existingEntry.setAddress(addressField.getValue());
m_existingEntry.setProtocol(protocolCombo.getValue().getValue());
m_existingEntry.setInPort(Integer.parseInt(inPortField.getValue()));
m_existingEntry.setOutPort(Integer.parseInt(outPortField.getValue()));
m_existingEntry.setMasquerade(masqueradeCombo.getValue().getValue());
m_existingEntry.setPermittedNetwork(permittedNetworkField.getValue());
m_existingEntry.setPermittedMAC(permittedMacField.getValue());
m_existingEntry.setSourcePortRange(sourcePortRangeField.getValue());
if (m_existingEntry.getPermittedMAC() != null) {
MessageBox.alert(MSGS.firewallPortForwardFormNotification(), MSGS.firewallPortForwardFormNotificationMacFiltering(), null);
}
}
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_existingEntry != null) {
inboundInterfaceLabel.setValue(m_existingEntry.getInboundInterface());
inboundInterfaceField.setValue(m_existingEntry.getInboundInterface());
inboundInterfaceField.setOriginalValue(m_existingEntry.getInboundInterface());
outboundInterfaceLabel.setValue(m_existingEntry.getOutboundInterface());
outboundInterfaceField.setValue(m_existingEntry.getOutboundInterface());
outboundInterfaceField.setOriginalValue(m_existingEntry.getOutboundInterface());
addressLabel.setValue(m_existingEntry.getAddress());
addressField.setValue(m_existingEntry.getAddress());
addressField.setOriginalValue(m_existingEntry.getAddress());
protocolLabel.setValue(m_existingEntry.getProtocol());
protocolCombo.setSimpleValue(m_existingEntry.getProtocol());
inPortLabel.setValue(m_existingEntry.getInPort());
inPortField.setValue(m_existingEntry.getInPort().toString());
inPortField.setOriginalValue(m_existingEntry.getInPort().toString());
outPortField.setValue(m_existingEntry.getOutPort().toString());
outPortField.setOriginalValue(m_existingEntry.getOutPort().toString());
masqueradeCombo.setSimpleValue(m_existingEntry.getMasquerade());
permittedNetworkField.setValue(m_existingEntry.getPermittedNetwork());
permittedNetworkField.setOriginalValue(m_existingEntry.getPermittedNetwork());
permittedMacField.setValue(m_existingEntry.getPermittedMAC());
permittedMacField.setOriginalValue(m_existingEntry.getPermittedMAC());
sourcePortRangeField.setValue(m_existingEntry.getSourcePortRange());
sourcePortRangeField.setOriginalValue(m_existingEntry.getSourcePortRange());
}
add(m_formPanel);
}
use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project kura by eclipse.
the class DhcpNatConfigTab method onRender.
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setLayout(new FitLayout());
setId("network-dhcp-nat");
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");
FieldSet fieldSet = new FieldSet();
FormLayout layoutAccount = new FormLayout();
layoutAccount.setLabelWidth(Constants.LABEL_WIDTH_FORM);
fieldSet.setLayout(layoutAccount);
fieldSet.setBorders(false);
//
// Tool Tip Box
//
toolTipField.setText(defaultToolTip);
fieldSet.add(toolTipField);
//
// Router Mode
//
m_modeCombo = new SimpleComboBox<String>();
m_modeCombo.setName("comboMode");
m_modeCombo.setFieldLabel(MSGS.netRouterMode());
m_modeCombo.setEditable(false);
m_modeCombo.setTypeAhead(true);
m_modeCombo.setTriggerAction(TriggerAction.ALL);
for (GwtNetRouterMode mode : GwtNetRouterMode.values()) {
m_modeCombo.add(MessageUtils.get(mode.name()));
}
m_modeCombo.setSimpleValue(MessageUtils.get(GwtNetRouterMode.netRouterDchpNat.name()));
m_modeCombo.setValidator(new Validator() {
public String validate(Field<?> field, String value) {
if (m_tcpIpConfigTab.isDhcp() && !value.equals(MessageUtils.get(GwtNetRouterMode.netRouterOff.toString()))) {
return MSGS.netRouterConfiguredForDhcpError();
}
return null;
}
});
m_modeCombo.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
refreshForm();
}
});
m_modeCombo.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipMode()));
m_modeCombo.addStyleName("kura-combobox");
m_modeCombo.addPlugin(m_dirtyPlugin);
fieldSet.add(m_modeCombo, formData);
//
// DHCP Beginning Address
//
m_dhcpBeginAddressField = new TextField<String>();
m_dhcpBeginAddressField.setAllowBlank(true);
m_dhcpBeginAddressField.setName("dhcpBeginAddress");
m_dhcpBeginAddressField.setFieldLabel(MSGS.netRouterDhcpBeginningAddress());
m_dhcpBeginAddressField.setRegex(IPV4_REGEX);
m_dhcpBeginAddressField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
m_dhcpBeginAddressField.addPlugin(m_dirtyPlugin);
m_dhcpBeginAddressField.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
m_dhcpBeginAddressField.addStyleName("kura-textfield");
m_dhcpBeginAddressField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpBeginAddr()));
fieldSet.add(m_dhcpBeginAddressField, formData);
//
// DHCP Ending Address
//
m_dhcpEndAddressField = new TextField<String>();
m_dhcpEndAddressField.setAllowBlank(true);
m_dhcpEndAddressField.setName("dhcpEndAddress");
m_dhcpEndAddressField.setFieldLabel(MSGS.netRouterDhcpEndingAddress());
m_dhcpEndAddressField.setRegex(IPV4_REGEX);
m_dhcpEndAddressField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
m_dhcpEndAddressField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpEndAddr()));
m_dhcpEndAddressField.addStyleName("kura-textfield");
;
m_dhcpEndAddressField.addPlugin(m_dirtyPlugin);
fieldSet.add(m_dhcpEndAddressField, formData);
//
// DHCP Subnet Mask
//
m_dhcpSubnetMaskField = new TextField<String>();
m_dhcpSubnetMaskField.setAllowBlank(true);
m_dhcpSubnetMaskField.setName("dhcpSubnetMask");
m_dhcpSubnetMaskField.setFieldLabel(MSGS.netRouterDhcpSubnetMask());
m_dhcpSubnetMaskField.setRegex(IPV4_REGEX);
m_dhcpSubnetMaskField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpSubnet()));
m_dhcpSubnetMaskField.getMessages().setRegexText(MSGS.netIPv4InvalidAddress());
m_dhcpSubnetMaskField.addStyleName("kura-textfield");
m_dhcpSubnetMaskField.addPlugin(m_dirtyPlugin);
fieldSet.add(m_dhcpSubnetMaskField, formData);
//
// DHCP Default Lease
//
m_dhcpLeaseDefaultField = new NumberField();
m_dhcpLeaseDefaultField.setPropertyEditorType(Integer.class);
m_dhcpLeaseDefaultField.setAllowDecimals(false);
m_dhcpLeaseDefaultField.setAllowNegative(false);
m_dhcpLeaseDefaultField.setMaxValue(Integer.MAX_VALUE);
m_dhcpLeaseDefaultField.setAllowBlank(true);
m_dhcpLeaseDefaultField.setName("dhcpDefaultLease");
m_dhcpLeaseDefaultField.setFieldLabel(MSGS.netRouterDhcpDefaultLease());
m_dhcpLeaseDefaultField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpDefaultLeaseTime()));
m_dhcpLeaseDefaultField.addPlugin(m_dirtyPlugin);
fieldSet.add(m_dhcpLeaseDefaultField, formData);
//
// DHCP Max Lease
//
m_dhcpLeaseMaxField = new NumberField();
m_dhcpLeaseMaxField.setPropertyEditorType(Integer.class);
m_dhcpLeaseMaxField.setAllowDecimals(false);
m_dhcpLeaseMaxField.setAllowNegative(false);
m_dhcpLeaseMaxField.setMaxValue(Integer.MAX_VALUE);
m_dhcpLeaseMaxField.setAllowBlank(true);
m_dhcpLeaseMaxField.setName("dhcpMaxLease");
m_dhcpLeaseMaxField.setFieldLabel(MSGS.netRouterDhcpMaxLease());
m_dhcpLeaseMaxField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipDhcpMaxLeaseTime()));
m_dhcpLeaseMaxField.addPlugin(m_dirtyPlugin);
fieldSet.add(m_dhcpLeaseMaxField, formData);
//
// Pass DNS
//
m_passDnsRadioTrue = new Radio();
m_passDnsRadioTrue.setBoxLabel(MSGS.trueLabel());
m_passDnsRadioTrue.setItemId("true");
m_passDnsRadioFalse = new Radio();
m_passDnsRadioFalse.setBoxLabel(MSGS.falseLabel());
m_passDnsRadioFalse.setItemId("false");
m_passDnsRadioGroup = new RadioGroup();
m_passDnsRadioGroup.setName("dhcpPassDns");
m_passDnsRadioGroup.setFieldLabel(MSGS.netRouterPassDns());
m_passDnsRadioGroup.add(m_passDnsRadioTrue);
m_passDnsRadioGroup.add(m_passDnsRadioFalse);
m_passDnsRadioGroup.addPlugin(m_dirtyPlugin);
m_passDnsRadioGroup.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netRouterToolTipPassDns()));
fieldSet.add(m_passDnsRadioGroup, formData);
m_formPanel.add(fieldSet);
add(m_formPanel);
setScrollMode(Scroll.AUTO);
m_initialized = true;
}
use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project kura by eclipse.
the class ModemConfigTab method onRender.
protected void onRender(Element parent, int index) {
Log.debug("ModemConfigTab - onRender()");
super.onRender(parent, index);
setLayout(new FitLayout());
setId("network-modem");
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");
FieldSet fieldSet = new FieldSet();
FormLayout layoutAccount = new FormLayout();
layoutAccount.setLabelWidth(Constants.LABEL_WIDTH_FORM);
fieldSet.setLayout(layoutAccount);
fieldSet.setBorders(false);
//
// Tool Tip Box
//
toolTipField.setText(defaultToolTip);
fieldSet.add(toolTipField);
//
// Modem Model
//
m_modemModel = new LabelField();
m_modemModel.setName("modemModel");
m_modemModel.setFieldLabel(MSGS.netModemModel());
m_modemModel.addPlugin(m_dirtyPlugin);
m_modemModel.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
fieldSet.add(m_modemModel, formData);
//
// Network Technology
//
m_networkTechnologies = new LabelField();
m_networkTechnologies.setName("networkTechnologies");
m_networkTechnologies.setFieldLabel(MSGS.netModemNetworkTechnology());
m_networkTechnologies.addPlugin(m_dirtyPlugin);
fieldSet.add(m_networkTechnologies, formData);
/*
m_networkTechCombo = new SimpleComboBox<String>();
m_networkTechCombo.setName("networkTech");
m_networkTechCombo.setFieldLabel(MSGS.netModemNetworkTechnology());
m_networkTechCombo.setEditable(false);
m_networkTechCombo.setTypeAhead(true);
m_networkTechCombo.setTriggerAction(TriggerAction.ALL);
m_networkTechCombo.add(MSGS.unknown());
m_networkTechCombo.setSimpleValue(MSGS.unknown());
m_networkTechCombo.addSelectionChangedListener( new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
refreshForm();
}
});
m_networkTechCombo.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipNetworkTechnology()));
m_networkTechCombo.addStyleName("kura-combobox");
m_networkTechCombo.addPlugin(m_dirtyPlugin);
fieldSet.add(m_networkTechCombo, formData);
*/
//
// Service Type
//
m_connectionType = new LabelField();
m_connectionType.setName("serviceType");
m_connectionType.setFieldLabel(MSGS.netModemConnectionType());
m_connectionType.addPlugin(m_dirtyPlugin);
fieldSet.add(m_connectionType, formData);
//
// Modem Identifier
//
m_modemIdField = new TextField<String>();
m_modemIdField.setAllowBlank(true);
m_modemIdField.setName("modemId");
m_modemIdField.setFieldLabel(MSGS.netModemIdentifier());
m_modemIdField.addPlugin(m_dirtyPlugin);
m_modemIdField.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
m_modemIdField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipModemIndentifier()));
m_modemIdField.addStyleName("kura-textfield");
fieldSet.add(m_modemIdField, formData);
//
// Interface number
//
m_ifaceNumField = new NumberField();
m_ifaceNumField.setAllowBlank(false);
m_ifaceNumField.setName("ifaceNum");
m_ifaceNumField.setFieldLabel(MSGS.netModemInterfaceNum());
m_ifaceNumField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipModemInterfaceNumber()));
m_ifaceNumField.addPlugin(m_dirtyPlugin);
m_ifaceNumField.setValidator(new Validator() {
public String validate(Field<?> field, String value) {
int val = Integer.parseInt(value);
if (val < 0) {
return MSGS.netModemInvalidInterfaceNum();
}
return null;
}
});
fieldSet.add(m_ifaceNumField, formData);
//
// Dial String
//
m_dialStringField = new TextField<String>();
m_dialStringField.setName("dialString");
m_dialStringField.setFieldLabel(MSGS.netModemDialString());
String dialString = "";
String model = "";
if (m_selectNetIfConfig != null) {
model = m_selectNetIfConfig.getModel();
if (model != null && model.length() > 0) {
if (model.contains("HE910")) {
dialString = defaultDialString.get("HE910");
} else if (model.contains("DE910")) {
dialString = defaultDialString.get("DE910");
} else {
dialString = "";
}
}
}
if (dialString.equals("")) {
m_dialStringField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipDialStringDefault()));
} else {
m_dialStringField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipDialString(dialString)));
}
m_dialStringField.addStyleName("kura-textfield");
m_dialStringField.setAllowBlank(false);
m_dialStringField.addPlugin(m_dirtyPlugin);
fieldSet.add(m_dialStringField, formData);
//
// APN
//
m_apnField = new TextField<String>();
m_apnField.setName("apn");
m_apnField.setFieldLabel(MSGS.netModemAPN());
m_apnField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipApn()));
m_apnField.addStyleName("kura-textfield");
if (m_selectNetIfConfig != null) {
for (String techType : m_selectNetIfConfig.getNetworkTechnology()) {
if (techType.equals("HSPA") || techType.equals("HSDPA") || techType.equals("UMTS") || techType.equals("GSM_GPRS")) {
m_apnField.setAllowBlank(false);
break;
}
}
}
m_apnField.addPlugin(m_dirtyPlugin);
fieldSet.add(m_apnField, formData);
//
// Auth Type
//
m_authTypeCombo = new SimpleComboBox<String>();
m_authTypeCombo.setName("authTypeCombo");
m_authTypeCombo.setFieldLabel(MSGS.netModemAuthType());
m_authTypeCombo.setEditable(false);
m_authTypeCombo.setTypeAhead(true);
m_authTypeCombo.setTriggerAction(TriggerAction.ALL);
for (GwtModemAuthType auth : GwtModemAuthType.values()) {
m_authTypeCombo.add(MessageUtils.get(auth.name()));
}
m_authTypeCombo.setSimpleValue(MessageUtils.get(GwtModemAuthType.netModemAuthNONE.name()));
m_authTypeCombo.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
refreshForm();
}
});
m_authTypeCombo.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipAuthentication()));
m_authTypeCombo.addStyleName("kura-combobox");
m_authTypeCombo.addPlugin(m_dirtyPlugin);
m_authTypeCombo.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
fieldSet.add(m_authTypeCombo, formData);
//
// Username
//
m_usernameField = new TextField<String>();
m_usernameField.setAllowBlank(true);
m_usernameField.setName("username");
m_usernameField.setFieldLabel(MSGS.netModemUsername());
m_usernameField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipUsername()));
m_usernameField.addStyleName("kura-textfield");
m_usernameField.addPlugin(m_dirtyPlugin);
fieldSet.add(m_usernameField, formData);
//
// Password
//
m_passwordField = new TextField<String>();
m_passwordField.setAllowBlank(true);
m_passwordField.setPassword(true);
m_passwordField.setName("password");
m_passwordField.setFieldLabel(MSGS.netModemPassword());
m_passwordField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipPassword()));
m_passwordField.addStyleName("kura-textfield");
m_passwordField.addPlugin(m_dirtyPlugin);
fieldSet.add(m_passwordField, formData);
// reset timeout
m_resetTimeoutField = new NumberField();
m_resetTimeoutField.setAllowBlank(false);
m_resetTimeoutField.setName("resetTimeout");
m_resetTimeoutField.setFieldLabel(MSGS.netModemResetTimeout());
m_resetTimeoutField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipResetTimeout()));
m_resetTimeoutField.addPlugin(m_dirtyPlugin);
m_resetTimeoutField.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
m_resetTimeoutField.setValidator(new Validator() {
public String validate(Field<?> field, String value) {
int val = Integer.parseInt(value);
if ((val < 0) || (val == 1)) {
return MSGS.netModemInvalidResetTimeout();
}
return null;
}
});
fieldSet.add(m_resetTimeoutField, formData);
m_persistRadioTrue = new Radio();
m_persistRadioTrue.setBoxLabel(MSGS.trueLabel());
m_persistRadioTrue.setItemId("true");
m_persistRadioTrue.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipPersist()));
m_persistRadioFalse = new Radio();
m_persistRadioFalse.setBoxLabel(MSGS.falseLabel());
m_persistRadioFalse.setItemId("false");
m_persistRadioFalse.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipPersist()));
m_persistRadioGroup = new RadioGroup();
m_persistRadioGroup.setName("modemPersist");
m_persistRadioGroup.setFieldLabel(MSGS.netModemPersist());
m_persistRadioGroup.add(m_persistRadioTrue);
m_persistRadioGroup.add(m_persistRadioFalse);
m_persistRadioGroup.addPlugin(m_dirtyPlugin);
m_persistRadioGroup.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
fieldSet.add(m_persistRadioGroup, formData);
// maxfail
m_maxFailField = new NumberField();
m_maxFailField.setAllowBlank(false);
m_maxFailField.setName("modemMaxFail");
m_maxFailField.setFieldLabel(MSGS.netModemMaxFail());
m_maxFailField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipMaxFail()));
m_maxFailField.addPlugin(m_dirtyPlugin);
m_maxFailField.setValidator(new Validator() {
public String validate(Field<?> field, String value) {
int val = Integer.parseInt(value);
if (val <= 0) {
return MSGS.netModemInvalidMaxFail();
}
return null;
}
});
fieldSet.add(m_maxFailField, formData);
// idle
m_idleField = new NumberField();
m_idleField.setAllowBlank(false);
m_idleField.setName("modemIdle");
m_idleField.setFieldLabel(MSGS.netModemIdle());
m_idleField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipIdle()));
m_idleField.addPlugin(m_dirtyPlugin);
m_idleField.setValidator(new Validator() {
public String validate(Field<?> field, String value) {
int val = Integer.parseInt(value);
if (val < 0) {
return MSGS.netModemInvalidIdle();
}
return null;
}
});
fieldSet.add(m_idleField, formData);
// active-filter
m_activeFilterField = new TextField<String>();
m_activeFilterField.setAllowBlank(true);
m_activeFilterField.setName("active-filter");
m_activeFilterField.setFieldLabel(MSGS.netModemActiveFilter());
m_activeFilterField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipActiveFilter()));
m_activeFilterField.addStyleName("esf-textfield");
m_activeFilterField.addPlugin(m_dirtyPlugin);
fieldSet.add(m_activeFilterField, formData);
//
// LCP Echo Interval
//
m_lcpEchoIntervalField = new NumberField();
m_lcpEchoIntervalField.setAllowBlank(false);
m_lcpEchoIntervalField.setName("lcpEchoInterval");
m_lcpEchoIntervalField.setFieldLabel(MSGS.netModemLcpEchoInterval());
m_lcpEchoIntervalField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipLcpEchoInterval()));
m_lcpEchoIntervalField.addPlugin(m_dirtyPlugin);
m_lcpEchoIntervalField.setStyleAttribute("margin-top", Constants.LABEL_MARGIN_TOP_SEPARATOR);
m_lcpEchoIntervalField.setValidator(new Validator() {
public String validate(Field<?> field, String value) {
int val = Integer.parseInt(value);
if (val < 0) {
return MSGS.netModemInvalidLcpEchoInterval();
}
return null;
}
});
fieldSet.add(m_lcpEchoIntervalField, formData);
//
// LCP Echo Interval
//
m_lcpEchoFailureField = new NumberField();
m_lcpEchoFailureField.setAllowBlank(false);
m_lcpEchoFailureField.setName("lcpEchoFailure");
m_lcpEchoFailureField.setFieldLabel(MSGS.netModemLcpEchoFailure());
m_lcpEchoFailureField.addListener(Events.OnMouseOver, new MouseOverListener(MSGS.netModemToolTipLcpEchoFailure()));
m_lcpEchoFailureField.addPlugin(m_dirtyPlugin);
m_lcpEchoFailureField.setValidator(new Validator() {
public String validate(Field<?> field, String value) {
int val = Integer.parseInt(value);
if (val < 0) {
return MSGS.netModemInvalidLcpEchoFailure();
}
return null;
}
});
fieldSet.add(m_lcpEchoFailureField, formData);
m_formPanel.add(fieldSet);
m_formPanel.setScrollMode(Scroll.AUTO);
add(m_formPanel);
setScrollMode(Scroll.AUTOX);
m_initialized = true;
}
Aggregations