use of org.eclipse.kura.web.shared.model.GwtXSRFToken in project kura by eclipse.
the class EntryClassUi method initServicesTree.
public void initServicesTree() {
// (Re)Fetch Available Services
this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
FailureHandler.handle(ex, EntryClassUi.class.getName());
}
@Override
public void onSuccess(GwtXSRFToken token) {
EntryClassUi.this.gwtComponentService.findServicesConfigurations(token, new AsyncCallback<List<GwtConfigComponent>>() {
@Override
public void onFailure(Throwable ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
FailureHandler.handle(ex, EntryClassUi.class.getName());
}
@Override
public void onSuccess(List<GwtConfigComponent> result) {
EntryClassUi.this.servicesMenu.clear();
for (GwtConfigComponent pair : result) {
EntryClassUi.this.servicesMenu.add(new ServicesAnchorListItem(pair, EntryClassUi.this.ui));
}
}
});
}
});
}
use of org.eclipse.kura.web.shared.model.GwtXSRFToken in project kura by eclipse.
the class FileUploadDialog method onRender.
@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
setLayout(new FormLayout());
setBodyBorder(false);
setModal(true);
setButtons("");
setScrollMode(Scroll.AUTO);
setHideOnButtonClick(false);
setSize(400, 125);
m_formPanel = new FormPanel();
m_formPanel.setFrame(false);
m_formPanel.setHeaderVisible(false);
m_formPanel.setBodyBorder(false);
m_formPanel.setAction(m_url);
m_formPanel.setEncoding(Encoding.MULTIPART);
m_formPanel.setMethod(Method.POST);
m_formPanel.setButtonAlign(HorizontalAlignment.CENTER);
m_formPanel.setLabelWidth(50);
m_formPanel.addListener(Events.Submit, new Listener<FormEvent>() {
public void handleEvent(FormEvent be) {
String htmlResponse = be.getResultHtml();
if (htmlResponse == null || htmlResponse.isEmpty()) {
MessageBox.info(MSGS.information(), MSGS.fileUploadSuccess(), null);
} else {
String errMsg = htmlResponse;
int startIdx = htmlResponse.indexOf("<pre>");
int endIndex = htmlResponse.indexOf("</pre>");
if (startIdx != -1 && endIndex != -1) {
errMsg = htmlResponse.substring(startIdx + 5, endIndex);
}
MessageBox.alert(MSGS.error(), MSGS.fileUploadFailure() + ": " + errMsg, null);
}
hide();
}
});
m_fileUploadField = new FileUploadField();
m_fileUploadField.setAllowBlank(false);
m_fileUploadField.setName("uploadedFile");
m_fileUploadField.setFieldLabel(MSGS.fileLabel());
m_formPanel.add(m_fileUploadField);
if (m_hiddenFields != null) {
for (HiddenField<?> hf : m_hiddenFields) {
m_formPanel.add(hf);
}
}
//
// xsrfToken Hidden field
//
gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
FailureHandler.handle(ex);
}
@Override
public void onSuccess(GwtXSRFToken token) {
xsrfTokenField.setValue(token.getToken());
}
});
xsrfTokenField = new HiddenField<String>();
xsrfTokenField.setId("xsrfToken");
xsrfTokenField.setName("xsrfToken");
xsrfTokenField.setValue("");
m_formPanel.add(xsrfTokenField);
//
add(m_formPanel);
}
use of org.eclipse.kura.web.shared.model.GwtXSRFToken in project kura by eclipse.
the class TabTcpIpUi method initForm.
// ---------------Private Methods------------
private void initForm() {
// Labels
this.labelStatus.setText(MSGS.netIPv4Status());
this.labelConfigure.setText(MSGS.netIPv4Configure());
this.labelIp.setText(MSGS.netIPv4Address());
this.labelSubnet.setText(MSGS.netIPv4SubnetMask());
this.labelGateway.setText(MSGS.netIPv4Gateway());
this.labelDns.setText(MSGS.netIPv4DNSServers());
this.labelSearch.setText(MSGS.netIPv4SearchDomains());
for (GwtNetIfConfigMode mode : GwtNetIfConfigMode.values()) {
this.configure.addItem(MessageUtils.get(mode.name()));
}
// Populate status list
if (this.selectedNetIfConfig != null && this.selectedNetIfConfig.getHwTypeEnum() == GwtNetIfType.MODEM) {
if (this.status != null) {
this.status.clear();
this.status.addItem(MessageUtils.get("netIPv4StatusDisabled"));
this.status.addItem(MessageUtils.get("netIPv4StatusEnabledWAN"));
}
} else {
if (this.status != null) {
this.status.clear();
this.status.addItem(MessageUtils.get("netIPv4StatusDisabled"));
this.status.addItem(MessageUtils.get("netIPv4StatusEnabledLAN"));
this.status.addItem(MessageUtils.get("netIPv4StatusEnabledWAN"));
}
}
// SetTooltips
// Status
this.status.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabTcpIpUi.this.status.isEnabled()) {
TabTcpIpUi.this.helpText.clear();
TabTcpIpUi.this.helpText.add(new Span(MSGS.netIPv4ModemToolTipStatus()));
}
}
});
this.status.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.status.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setDirty(true);
TabTcpIpUi.this.tabs.adjustInterfaceTabs();
refreshForm();
resetValidations();
// changed to WAN
if (isWanEnabled()) {
EntryClassUi.showWaitModal();
TabTcpIpUi.this.gwtNetworkService.findNetInterfaceConfigurations(new AsyncCallback<List<GwtNetInterfaceConfig>>() {
@Override
public void onFailure(Throwable caught) {
EntryClassUi.hideWaitModal();
FailureHandler.handle(caught);
}
@Override
public void onSuccess(List<GwtNetInterfaceConfig> result) {
EntryClassUi.hideWaitModal();
for (GwtNetInterfaceConfig config : result) {
if (config.getStatusEnum().equals(GwtNetIfStatus.netIPv4StatusEnabledWAN) && !config.getName().equals(TabTcpIpUi.this.selectedNetIfConfig.getName())) {
logger.log(Level.SEVERE, "Error: Status Invalid");
TabTcpIpUi.this.wanModal.show();
break;
}
}
}
});
}
}
});
// Configure
this.configure.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabTcpIpUi.this.configure.isEnabled()) {
TabTcpIpUi.this.helpText.clear();
TabTcpIpUi.this.helpText.add(new Span(MSGS.netIPv4ToolTipConfigure()));
}
}
});
this.configure.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.configure.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setDirty(true);
TabTcpIpUi.this.tabs.adjustInterfaceTabs();
refreshForm();
resetValidations();
}
});
// Initial view of configure
if (this.configure.getSelectedItemText().equalsIgnoreCase(VMSGS.netIPv4ConfigModeDHCP())) {
// Using DHCP selected
this.ip.setEnabled(false);
this.subnet.setEnabled(false);
this.gateway.setEnabled(false);
this.renew.setEnabled(true);
} else if (this.configure.getSelectedItemText().equalsIgnoreCase(VMSGS.netIPv4ConfigModeManual())) {
// Manually selected
this.ip.setEnabled(true);
this.subnet.setEnabled(true);
this.gateway.setEnabled(true);
this.renew.setEnabled(false);
}
// IP Address
this.ip.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabTcpIpUi.this.ip.isEnabled()) {
TabTcpIpUi.this.helpText.clear();
TabTcpIpUi.this.helpText.add(new Span(MSGS.netIPv4ToolTipAddress()));
}
}
});
this.ip.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.ip.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
setDirty(true);
if (!TabTcpIpUi.this.ip.getText().trim().matches(FieldType.IPv4_ADDRESS.getRegex()) || !(TabTcpIpUi.this.ip.getText().trim().length() > 0)) {
TabTcpIpUi.this.groupIp.setValidationState(ValidationState.ERROR);
TabTcpIpUi.this.helpIp.setText(MSGS.netIPv4InvalidAddress());
} else {
TabTcpIpUi.this.groupIp.setValidationState(ValidationState.NONE);
TabTcpIpUi.this.helpIp.setText("");
}
}
});
// Subnet Mask
this.subnet.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabTcpIpUi.this.subnet.isEnabled()) {
TabTcpIpUi.this.helpText.clear();
TabTcpIpUi.this.helpText.add(new Span(MSGS.netIPv4ToolTipSubnetMask()));
}
}
});
this.subnet.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.subnet.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setDirty(true);
if (!TabTcpIpUi.this.subnet.getText().trim().matches(FieldType.IPv4_ADDRESS.getRegex()) && TabTcpIpUi.this.subnet.getText().trim().length() > 0) {
TabTcpIpUi.this.groupSubnet.setValidationState(ValidationState.ERROR);
TabTcpIpUi.this.helpSubnet.setText(MSGS.netIPv4InvalidAddress());
} else {
TabTcpIpUi.this.groupSubnet.setValidationState(ValidationState.NONE);
TabTcpIpUi.this.helpSubnet.setText("");
}
}
});
// Gateway
this.gateway.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabTcpIpUi.this.gateway.isEnabled()) {
TabTcpIpUi.this.helpText.clear();
TabTcpIpUi.this.helpText.add(new Span(MSGS.netIPv4ToolTipGateway()));
}
}
});
this.gateway.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.gateway.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setDirty(true);
if (!TabTcpIpUi.this.gateway.getText().trim().matches(FieldType.IPv4_ADDRESS.getRegex()) && TabTcpIpUi.this.gateway.getText().trim().length() > 0) {
TabTcpIpUi.this.groupGateway.setValidationState(ValidationState.ERROR);
TabTcpIpUi.this.helpGateway.setText(MSGS.netIPv4InvalidAddress());
} else {
TabTcpIpUi.this.groupGateway.setValidationState(ValidationState.NONE);
TabTcpIpUi.this.helpGateway.setText("");
}
}
});
// DNS Servers
this.dns.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabTcpIpUi.this.dns.isEnabled()) {
TabTcpIpUi.this.helpText.clear();
TabTcpIpUi.this.helpText.add(new Span(MSGS.netIPv4ToolTipDns()));
}
}
});
this.dns.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.dns.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setDirty(true);
if (TabTcpIpUi.this.dns.getText().trim().length() == 0) {
TabTcpIpUi.this.groupDns.setValidationState(ValidationState.NONE);
TabTcpIpUi.this.helpDns.setText("");
return;
}
String regex = "[\\s,;\\n\\t]+";
String[] aDnsServers = TabTcpIpUi.this.dns.getText().trim().split(regex);
boolean validDnsList = true;
for (String dnsEntry : aDnsServers) {
if ((dnsEntry.length() > 0) && !dnsEntry.matches(FieldType.IPv4_ADDRESS.getRegex())) {
validDnsList = false;
break;
}
}
if (!validDnsList) {
TabTcpIpUi.this.groupDns.setValidationState(ValidationState.ERROR);
TabTcpIpUi.this.helpDns.setText(MSGS.netIPv4InvalidAddress());
} else {
TabTcpIpUi.this.groupDns.setValidationState(ValidationState.NONE);
TabTcpIpUi.this.helpDns.setText("");
}
/*
if (!TabTcpIpUi.this.dns.getText().trim().matches(FieldType.IPv4_ADDRESS.getRegex())
&& TabTcpIpUi.this.dns.getText().trim().length() > 0) {
TabTcpIpUi.this.groupDns.setValidationState(ValidationState.ERROR);
TabTcpIpUi.this.helpDns.setText(MSGS.netIPv4InvalidAddress());
} else {
TabTcpIpUi.this.groupDns.setValidationState(ValidationState.NONE);
TabTcpIpUi.this.helpDns.setText("");
}
*/
}
});
// Renew DHCP Lease
this.renew.setText(MSGS.netIPv4RenewDHCPLease());
this.renew.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
EntryClassUi.showWaitModal();
TabTcpIpUi.this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
EntryClassUi.hideWaitModal();
FailureHandler.handle(ex);
}
@Override
public void onSuccess(GwtXSRFToken token) {
TabTcpIpUi.this.gwtNetworkService.renewDhcpLease(token, TabTcpIpUi.this.selectedNetIfConfig.getName(), new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable ex) {
EntryClassUi.hideWaitModal();
FailureHandler.handle(ex);
}
@Override
public void onSuccess(Void result) {
refresh();
EntryClassUi.hideWaitModal();
}
});
}
});
}
});
this.renew.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabTcpIpUi.this.renew.isEnabled()) {
TabTcpIpUi.this.helpText.clear();
TabTcpIpUi.this.helpText.add(new Span(MSGS.netIPv4ToolTipRenew()));
}
}
});
this.renew.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
}
use of org.eclipse.kura.web.shared.model.GwtXSRFToken in project kura by eclipse.
the class TabWirelessUi method initForm.
private void initForm() {
// Wireless Mode
this.labelWireless.setText(MSGS.netWifiWirelessMode());
this.wireless.addItem(MessageUtils.get("netWifiWirelessModeStation"));
this.wireless.addItem(MessageUtils.get("netWifiWirelessModeAccessPoint"));
this.wireless.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.wireless.getSelectedItemText().equals(MessageUtils.get("netWifiWirelessModeStation"))) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipWirelessModeStation()));
} else {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipWirelessModeAccessPoint()));
}
}
});
this.wireless.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.wireless.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
// String accessPointName= WIFI_MODE_ACCESS_POINT_MESSAGE;
// String stationModeName= WIFI_MODE_STATION_MESSAGE;
// if (tcpTab.getStatus().equals(IPV4_STATUS_WAN_MESSAGE) &&
// wireless.getSelectedItemText().equals(accessPointName)) {
// helpWireless.setText(MSGS.netWifiWirelessEnabledForWANError());
// groupWireless.setValidationState(ValidationState.ERROR);
// }else{
TabWirelessUi.this.helpWireless.setText("");
TabWirelessUi.this.groupWireless.setValidationState(ValidationState.NONE);
if (TabWirelessUi.this.wireless.getSelectedItemText().equals(WIFI_MODE_STATION_MESSAGE)) {
// Use Values from station config
TabWirelessUi.this.activeConfig = TabWirelessUi.this.selectedNetIfConfig.getStationWifiConfig();
} else {
// use values from access point config
TabWirelessUi.this.activeConfig = TabWirelessUi.this.selectedNetIfConfig.getAccessPointWifiConfig();
}
TabWirelessUi.this.netTabs.adjustInterfaceTabs();
setPasswordValidation();
update();
}
});
// SSID
this.labelSsid.setText(MSGS.netWifiNetworkName());
this.ssid.setMaxLength(MAX_SSID_LENGTH);
this.ssid.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.ssid.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipNetworkName()));
}
}
});
this.ssid.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.buttonSsid.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (!TabWirelessUi.this.ssidInit) {
initSsid();
TabWirelessUi.this.ssidDataProvider.getList().clear();
TabWirelessUi.this.searching.setVisible(true);
TabWirelessUi.this.noSsid.setVisible(false);
TabWirelessUi.this.ssidGrid.setVisible(false);
TabWirelessUi.this.scanFail.setVisible(false);
}
initModal();
loadSsidData();
}
});
// Radio Mode
this.labelRadio.setText(MSGS.netWifiRadioMode());
this.radio.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.radio.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipRadioMode()));
}
}
});
this.radio.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
for (GwtWifiRadioMode mode : GwtWifiRadioMode.values()) {
if (mode != GwtWifiRadioMode.netWifiRadioModeA) {
// We don't support 802.11a yet
this.radio.addItem(MessageUtils.get(mode.name()));
}
}
// Wireless Security
this.labelSecurity.setText(MSGS.netWifiWirelessSecurity());
this.security.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.security.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipSecurity()));
}
}
});
this.security.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
for (GwtWifiSecurity mode : GwtWifiSecurity.values()) {
this.security.addItem(MessageUtils.get(mode.name()));
}
this.security.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setPasswordValidation();
refreshForm();
checkPassword();
}
});
// Password
this.labelPassword.setText(MSGS.netWifiWirelessPassword());
this.password.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.password.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipPassword()));
}
}
});
this.password.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.buttonPassword.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
EntryClassUi.showWaitModal();
TabWirelessUi.this.buttonPassword.setEnabled(false);
final GwtWifiConfig gwtWifiConfig = getGwtWifiConfig();
TabWirelessUi.this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
FailureHandler.handle(ex);
}
@Override
public void onSuccess(GwtXSRFToken token) {
TabWirelessUi.this.gwtNetworkService.verifyWifiCredentials(token, TabWirelessUi.this.selectedNetIfConfig.getName(), gwtWifiConfig, new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
FailureHandler.handle(caught);
EntryClassUi.hideWaitModal();
TabWirelessUi.this.buttonPassword.setEnabled(true);
showPasswordVerificationStatus(MSGS.netWifiPasswordVerificationFailed());
}
@Override
public void onSuccess(Boolean result) {
if (!result.booleanValue()) {
showPasswordVerificationStatus(MSGS.netWifiPasswordVerificationFailed());
} else {
showPasswordVerificationStatus(MSGS.netWifiPasswordVerificationSuccess());
}
EntryClassUi.hideWaitModal();
TabWirelessUi.this.buttonPassword.setEnabled(true);
}
});
}
});
}
});
this.password.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {
if (TabWirelessUi.this.groupVerify.isVisible() && !TabWirelessUi.this.verify.getText().equals(TabWirelessUi.this.password.getText())) {
TabWirelessUi.this.groupVerify.setValidationState(ValidationState.ERROR);
} else {
TabWirelessUi.this.groupVerify.setValidationState(ValidationState.NONE);
}
}
});
this.password.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
refreshForm();
checkPassword();
}
});
// Verify Password
this.labelVerify.setText(MSGS.netWifiWirelessVerifyPassword());
this.verify.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.verify.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipPassword()));
}
}
});
this.verify.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.verify.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (TabWirelessUi.this.password != null && !TabWirelessUi.this.verify.getText().equals(TabWirelessUi.this.password.getText())) {
TabWirelessUi.this.helpVerify.setText(MSGS.netWifiWirelessPasswordDoesNotMatch());
TabWirelessUi.this.groupVerify.setValidationState(ValidationState.ERROR);
} else {
TabWirelessUi.this.helpVerify.setText("");
TabWirelessUi.this.groupVerify.setValidationState(ValidationState.NONE);
}
}
});
// Pairwise ciphers
this.labelPairwise.setText(MSGS.netWifiWirelessPairwiseCiphers());
this.pairwise.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.pairwise.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipPairwiseCiphers()));
}
}
});
this.pairwise.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
for (GwtWifiCiphers ciphers : GwtWifiCiphers.values()) {
this.pairwise.addItem(MessageUtils.get(ciphers.name()));
}
this.pairwise.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
refreshForm();
}
});
// Groupwise Ciphers
this.labelGroup.setText(MSGS.netWifiWirelessGroupCiphers());
this.group.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.group.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiWirelessGroupCiphers()));
}
}
});
this.group.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
for (GwtWifiCiphers ciphers : GwtWifiCiphers.values()) {
this.group.addItem(MessageUtils.get(ciphers.name()));
}
this.group.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
refreshForm();
}
});
// Bgscan module
this.labelBgscan.setText(MSGS.netWifiWirelessBgscanModule());
this.bgscan.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.bgscan.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipBgScan()));
}
}
});
this.bgscan.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
for (GwtWifiBgscanModule module : GwtWifiBgscanModule.values()) {
this.bgscan.addItem(MessageUtils.get(module.name()));
}
this.bgscan.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
refreshForm();
}
});
// BgScan RSSI threshold
this.labelRssi.setText(MSGS.netWifiWirelessBgscanSignalStrengthThreshold());
// TODO: DW - RSSI slider
/*
* rssi.addSlideStartHandler(new SlideStartHandler<Double>() {
*
* @Override
* public void onSlideStart(SlideStartEvent<Double> event) {
* if (rssi.isEnabled()) {
* helpText.clear();
* helpText.add(new Span(MSGS.netWifiToolTipBgScanStrength()));
* }
* }
* });
* rssi.addSlideStopHandler(new SlideStopHandler<Double>() {
*
* @Override
* public void onSlideStop(SlideStopEvent<Double> event) {
* resetHelp();
* }
* });
*/
// Bgscan short Interval
this.labelShortI.setText(MSGS.netWifiWirelessBgscanShortInterval());
this.shortI.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.shortI.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipBgScanShortInterval()));
}
}
});
this.shortI.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.shortI.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (TabWirelessUi.this.shortI.getText().trim().contains(".") || TabWirelessUi.this.shortI.getText().trim().contains("-") || !TabWirelessUi.this.shortI.getText().trim().matches("[0-9]+")) {
TabWirelessUi.this.groupShortI.setValidationState(ValidationState.ERROR);
} else {
TabWirelessUi.this.groupShortI.setValidationState(ValidationState.NONE);
}
}
});
// Bgscan long interval
this.labelLongI.setText(MSGS.netWifiWirelessBgscanLongInterval());
this.longI.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.longI.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipBgScanLongInterval()));
}
}
});
this.longI.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.longI.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (TabWirelessUi.this.longI.getText().trim().contains(".") || TabWirelessUi.this.longI.getText().trim().contains("-") || !TabWirelessUi.this.longI.getText().trim().matches("[0-9]+")) {
TabWirelessUi.this.groupLongI.setValidationState(ValidationState.ERROR);
} else {
TabWirelessUi.this.groupLongI.setValidationState(ValidationState.NONE);
}
}
});
// Ping Access Point ----
this.labelPing.setText(MSGS.netWifiWirelessPingAccessPoint());
this.radio1.setText(MSGS.trueLabel());
this.radio1.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.radio1.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipPingAccessPoint()));
}
}
});
this.radio1.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.radio2.setText(MSGS.falseLabel());
this.radio2.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.radio2.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipPingAccessPoint()));
}
}
});
this.radio2.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
// Ignore Broadcast SSID
this.labelIgnore.setText(MSGS.netWifiWirelessIgnoreSSID());
this.radio3.setText(MSGS.trueLabel());
this.radio3.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.radio3.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipIgnoreSSID()));
}
}
});
this.radio3.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
this.radio4.setText(MSGS.falseLabel());
this.radio4.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
if (TabWirelessUi.this.radio4.isEnabled()) {
TabWirelessUi.this.helpText.clear();
TabWirelessUi.this.helpText.add(new Span(MSGS.netWifiToolTipIgnoreSSID()));
}
}
});
this.radio4.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
resetHelp();
}
});
// Channel Grid
initGrid();
this.helpTitle.setText(MSGS.netHelpTitle());
}
use of org.eclipse.kura.web.shared.model.GwtXSRFToken in project kura by eclipse.
the class SecurityTabUi method initTab.
private void initTab() {
StringBuilder title = new StringBuilder();
title.append("<p>");
title.append(MSGS.settingsSecurityDescription());
title.append("</p>");
this.description.add(new Span(title.toString()));
this.collapseOneAnchor.setText(MSGS.settingsSecurityReloadPolicyTitle());
this.collapseTwoAnchor.setText(MSGS.settingsReloadStartupFingerprintTitle());
this.securityPolicyLabel.setText(MSGS.settingsSecurityReloadPolicyDescription());
this.commandLineLabel.setText(MSGS.settingsReloadStartupFingerprintDescription());
this.reloadPolicyFingerprint.setText(MSGS.settingsSecurityReloadPolicy());
this.reloadPolicyFingerprint.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
EntryClassUi.showWaitModal();
SecurityTabUi.this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
FailureHandler.handle(ex);
EntryClassUi.hideWaitModal();
}
@Override
public void onSuccess(GwtXSRFToken token) {
SecurityTabUi.this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
FailureHandler.handle(ex);
EntryClassUi.hideWaitModal();
}
@Override
public void onSuccess(GwtXSRFToken token) {
AsyncCallback<Void> callback = new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
FailureHandler.handle(caught);
EntryClassUi.hideWaitModal();
}
@Override
public void onSuccess(Void result) {
EntryClassUi.hideWaitModal();
}
};
SecurityTabUi.this.gwtSecurityService.reloadSecurityPolicyFingerprint(token, callback);
}
});
}
});
}
});
this.reloadCommandLineFingerprint.setText(MSGS.settingsSecurityReloadPolicy());
this.reloadCommandLineFingerprint.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
EntryClassUi.showWaitModal();
SecurityTabUi.this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
FailureHandler.handle(ex);
EntryClassUi.hideWaitModal();
}
@Override
public void onSuccess(GwtXSRFToken token) {
SecurityTabUi.this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() {
@Override
public void onFailure(Throwable ex) {
FailureHandler.handle(ex);
EntryClassUi.hideWaitModal();
}
@Override
public void onSuccess(GwtXSRFToken token) {
AsyncCallback<Void> callback = new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
FailureHandler.handle(caught);
EntryClassUi.hideWaitModal();
}
@Override
public void onSuccess(Void result) {
EntryClassUi.hideWaitModal();
}
};
SecurityTabUi.this.gwtSecurityService.reloadCommandLineFingerprint(token, callback);
}
});
}
});
}
});
}
Aggregations