use of com.google.gwt.event.dom.client.BlurHandler in project kura by eclipse.
the class NatTabUi method setModalFieldsHandlers.
private void setModalFieldsHandlers() {
// Set up validation
this.input.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!NatTabUi.this.input.getText().trim().matches(FieldType.ALPHANUMERIC.getRegex()) || NatTabUi.this.input.getText().trim().isEmpty()) {
NatTabUi.this.groupInput.setValidationState(ValidationState.ERROR);
} else {
NatTabUi.this.groupInput.setValidationState(ValidationState.NONE);
}
}
});
this.output.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!NatTabUi.this.output.getText().trim().matches(FieldType.ALPHANUMERIC.getRegex()) || NatTabUi.this.output.getText().trim().isEmpty()) {
NatTabUi.this.groupOutput.setValidationState(ValidationState.ERROR);
} else {
NatTabUi.this.groupOutput.setValidationState(ValidationState.NONE);
}
}
});
this.source.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!NatTabUi.this.source.getText().trim().isEmpty() && !NatTabUi.this.source.getText().trim().matches(FieldType.NETWORK.getRegex())) {
NatTabUi.this.groupSource.setValidationState(ValidationState.ERROR);
} else {
NatTabUi.this.groupSource.setValidationState(ValidationState.NONE);
}
}
});
this.destination.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!NatTabUi.this.destination.getText().trim().isEmpty() && !NatTabUi.this.destination.getText().trim().matches(FieldType.NETWORK.getRegex())) {
NatTabUi.this.groupDestination.setValidationState(ValidationState.ERROR);
} else {
NatTabUi.this.groupDestination.setValidationState(ValidationState.NONE);
}
}
});
}
use of com.google.gwt.event.dom.client.BlurHandler in project kura by eclipse.
the class OpenPortsTabUi method setModalFieldsHandlers.
private void setModalFieldsHandlers() {
this.permittedI.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (!OpenPortsTabUi.this.permittedI.getText().trim().isEmpty()) {
OpenPortsTabUi.this.unpermittedI.clear();
OpenPortsTabUi.this.unpermittedI.setEnabled(false);
} else {
OpenPortsTabUi.this.unpermittedI.setEnabled(true);
}
}
});
this.unpermittedI.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (!OpenPortsTabUi.this.unpermittedI.getText().trim().isEmpty()) {
OpenPortsTabUi.this.permittedI.clear();
OpenPortsTabUi.this.permittedI.setEnabled(false);
} else {
OpenPortsTabUi.this.permittedI.setEnabled(true);
}
}
});
// set up validation
// groupPort, groupPermittedNw,groupPermittedI,grourUnpermittedI,groupPermittedMac,groupSource;
this.port.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!OpenPortsTabUi.this.port.getText().trim().matches(FieldType.PORT_RANGE.getRegex()) && OpenPortsTabUi.this.port.getText().trim().length() != 0 || OpenPortsTabUi.this.port.getText() == null || "".equals(OpenPortsTabUi.this.port.getText().trim())) {
OpenPortsTabUi.this.groupPort.setValidationState(ValidationState.ERROR);
} else {
OpenPortsTabUi.this.groupPort.setValidationState(ValidationState.NONE);
}
}
});
this.permittedNw.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!OpenPortsTabUi.this.permittedNw.getText().trim().matches(FieldType.NETWORK.getRegex()) && OpenPortsTabUi.this.permittedNw.getText().trim().length() > 0) {
OpenPortsTabUi.this.groupPermittedNw.setValidationState(ValidationState.ERROR);
} else {
OpenPortsTabUi.this.groupPermittedNw.setValidationState(ValidationState.NONE);
}
}
});
this.permittedI.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!OpenPortsTabUi.this.permittedI.getText().trim().matches(FieldType.ALPHANUMERIC.getRegex()) && OpenPortsTabUi.this.permittedI.getText().trim().length() > 0) {
OpenPortsTabUi.this.groupPermittedI.setValidationState(ValidationState.ERROR);
} else {
OpenPortsTabUi.this.groupPermittedI.setValidationState(ValidationState.NONE);
}
}
});
this.unpermittedI.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!OpenPortsTabUi.this.unpermittedI.getText().trim().matches(FieldType.ALPHANUMERIC.getRegex()) && OpenPortsTabUi.this.unpermittedI.getText().trim().length() > 0) {
OpenPortsTabUi.this.groupUnpermittedI.setValidationState(ValidationState.ERROR);
} else {
OpenPortsTabUi.this.groupPermittedI.setValidationState(ValidationState.NONE);
}
}
});
this.permittedMac.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!OpenPortsTabUi.this.permittedMac.getText().trim().matches(FieldType.MAC_ADDRESS.getRegex()) && OpenPortsTabUi.this.permittedMac.getText().trim().length() > 0) {
OpenPortsTabUi.this.groupPermittedMac.setValidationState(ValidationState.ERROR);
} else {
OpenPortsTabUi.this.groupPermittedMac.setValidationState(ValidationState.NONE);
}
}
});
this.source.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!OpenPortsTabUi.this.source.getText().trim().matches(FieldType.PORT_RANGE.getRegex()) && OpenPortsTabUi.this.source.getText().trim().length() > 0) {
OpenPortsTabUi.this.groupSource.setValidationState(ValidationState.ERROR);
} else {
OpenPortsTabUi.this.groupSource.setValidationState(ValidationState.NONE);
}
}
});
}
use of com.google.gwt.event.dom.client.BlurHandler in project kura by eclipse.
the class PortForwardingTabUi method setModalFieldsHandlers.
private void setModalFieldsHandlers() {
// Set validations
this.input.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (PortForwardingTabUi.this.input.getText().trim().isEmpty() || !PortForwardingTabUi.this.input.getText().trim().matches(FieldType.ALPHANUMERIC.getRegex())) {
PortForwardingTabUi.this.groupInput.setValidationState(ValidationState.ERROR);
} else {
PortForwardingTabUi.this.groupInput.setValidationState(ValidationState.NONE);
}
}
});
this.output.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (PortForwardingTabUi.this.output.getText().trim().isEmpty() || !PortForwardingTabUi.this.output.getText().trim().matches(FieldType.ALPHANUMERIC.getRegex())) {
PortForwardingTabUi.this.groupOutput.setValidationState(ValidationState.ERROR);
} else {
PortForwardingTabUi.this.groupOutput.setValidationState(ValidationState.NONE);
}
}
});
this.lan.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (PortForwardingTabUi.this.lan.getText().trim().isEmpty() || !PortForwardingTabUi.this.lan.getText().trim().matches(FieldType.IPv4_ADDRESS.getRegex())) {
PortForwardingTabUi.this.groupLan.setValidationState(ValidationState.ERROR);
} else {
PortForwardingTabUi.this.groupLan.setValidationState(ValidationState.NONE);
}
}
});
this.internal.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (PortForwardingTabUi.this.internal.getText().trim().isEmpty() || !PortForwardingTabUi.this.internal.getText().trim().matches(FieldType.NUMERIC.getRegex())) {
PortForwardingTabUi.this.groupInternal.setValidationState(ValidationState.ERROR);
} else {
PortForwardingTabUi.this.groupInternal.setValidationState(ValidationState.NONE);
}
}
});
this.external.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (PortForwardingTabUi.this.external.getText().trim().isEmpty() || !PortForwardingTabUi.this.external.getText().trim().matches(FieldType.NUMERIC.getRegex())) {
PortForwardingTabUi.this.groupExternal.setValidationState(ValidationState.ERROR);
} else {
PortForwardingTabUi.this.groupExternal.setValidationState(ValidationState.NONE);
}
}
});
this.permittedNw.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!PortForwardingTabUi.this.permittedNw.getText().trim().isEmpty() && !PortForwardingTabUi.this.permittedNw.getText().trim().matches(FieldType.NETWORK.getRegex())) {
PortForwardingTabUi.this.groupPermittedNw.setValidationState(ValidationState.ERROR);
} else {
PortForwardingTabUi.this.groupPermittedNw.setValidationState(ValidationState.NONE);
}
}
});
this.permittedMac.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!PortForwardingTabUi.this.permittedMac.getText().trim().isEmpty() && !PortForwardingTabUi.this.permittedMac.getText().trim().matches(FieldType.MAC_ADDRESS.getRegex())) {
PortForwardingTabUi.this.groupPermittedMac.setValidationState(ValidationState.ERROR);
} else {
PortForwardingTabUi.this.groupPermittedMac.setValidationState(ValidationState.NONE);
}
}
});
this.source.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (!PortForwardingTabUi.this.source.getText().trim().isEmpty() && !PortForwardingTabUi.this.source.getText().trim().matches(FieldType.PORT_RANGE.getRegex())) {
PortForwardingTabUi.this.groupSource.setValidationState(ValidationState.ERROR);
} else {
PortForwardingTabUi.this.groupSource.setValidationState(ValidationState.NONE);
}
}
});
}
use of com.google.gwt.event.dom.client.BlurHandler in project platform by lsfusion.
the class MenuBar method init.
private void init(boolean vertical, AbstractImagePrototype subMenuIcon) {
this.subMenuIcon = subMenuIcon;
Element table = DOM.createTable();
// override default border-spacing: 2px
table.getStyle().setProperty("borderSpacing", "0px");
body = DOM.createTBody();
DOM.appendChild(table, body);
if (!vertical) {
Element tr = DOM.createTR();
DOM.appendChild(body, tr);
}
this.vertical = vertical;
Element outer = FocusPanel.impl.createFocusable();
DOM.appendChild(outer, table);
setElement(outer);
Roles.getMenubarRole().set(getElement());
// todo: replaced ONCLICK to ONMOUSEDOWN
sinkEvents(Event.ONMOUSEDOWN | Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONFOCUS | Event.ONKEYDOWN);
setStyleName(STYLENAME_DEFAULT);
if (vertical) {
addStyleDependentName("vertical");
} else {
addStyleDependentName("horizontal");
}
// Hide focus outline in Mozilla/Webkit
getElement().getStyle().setProperty("outline", "0px");
// Hide focus outline in IE 6/7
getElement().setAttribute("hideFocus", "true");
// Deselect items when blurring without a child menu.
addDomHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
if (shownChildMenu == null) {
selectItem(null);
}
}
}, BlurEvent.getType());
}
Aggregations