private void reset() { Log.debug("DhcpNatConfigTab: reset()"); m_modeCombo.setSimpleValue(MessageUtils.get(GwtNetRouterMode.netRouterOff.name())); m_modeCombo.setOriginalValue(m_modeCombo.getValue()); m_dhcpBeginAddressField.setValue(""); m_dhcpBeginAddressField.setOriginalValue(m_dhcpBeginAddressField.getValue()); m_dhcpEndAddressField.setValue(""); m_dhcpEndAddressField.setOriginalValue(m_dhcpEndAddressField.getValue()); m_dhcpSubnetMaskField.setValue(""); m_dhcpSubnetMaskField.setOriginalValue(m_dhcpSubnetMaskField.getValue()); m_dhcpLeaseDefaultField.setValue(0); m_dhcpLeaseDefaultField.setOriginalValue(m_dhcpLeaseDefaultField.getValue()); m_dhcpLeaseMaxField.setValue(0); m_dhcpLeaseMaxField.setOriginalValue(m_dhcpLeaseMaxField.getValue()); m_passDnsRadioTrue.setValue(false); m_passDnsRadioTrue.setOriginalValue(m_passDnsRadioTrue.getValue()); m_passDnsRadioFalse.setValue(true); m_passDnsRadioFalse.setOriginalValue(m_passDnsRadioFalse.getValue()); m_passDnsRadioGroup.setValue(m_passDnsRadioFalse); m_passDnsRadioGroup.setOriginalValue(m_passDnsRadioGroup.getValue()); update(); }
private boolean validateFields() { if (Utils.safeString(nameTextBox.getValue()).equals("")) { MessageBox.alert(textMessages.error(), textMessages.mustEnterName(), null); return false; } if (Utils.safeString(nameTextBox.getValue()).length() > Group.LENGTH_NAME) { MessageBox.alert(textMessages.error(), textMessages.tooLongName(), null); return false; } return true; }
private void doSave() { if (validateFields()) { user.setUsername(Utils.safeString(usernameTextBox.getValue())); user.setFullname(Utils.safeString(fullnameTextBox.getValue())); user.setEmail(Utils.safeString(emailTextBox.getValue())); user.setActiveFlag(enabledCheckBox.getValue()); user.updateAuthnPasswordValue(Utils.safeString(password1TextBox.getValue())); user.removeGroups(); for (GroupData groupData : toGroupStore.getModels()) { Group group = (Group) groupData.get(Constants.GROUP); user.addGroup(group); } final AsyncCallback<Void> callback = new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { WebPasswordSafe.handleServerFailure(caught); } @Override public void onSuccess(Void result) { Info.display(textMessages.status(), textMessages.userSaved()); hide(); } }; if (user.getId() == 0) { final AsyncCallback<Boolean> callbackCheck = new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { WebPasswordSafe.handleServerFailure(caught); } @Override public void onSuccess(Boolean result) { // true => username already taken, else go ahead and save if (result) { MessageBox.alert( textMessages.error(), textMessages.usernameAlreadyExists(), null); } else { UserService.Util.getInstance().addUser(user, callback); } } }; UserService.Util.getInstance().isUserTaken(user.getUsername(), callbackCheck); } else { UserService.Util.getInstance().updateUser(user, callback); } } }
public List<IntervalliCommesseModel> elaboraIntervalliC( FldsetIntervalliCommesse fldSetIntervalliC) { TextField<String> txtfldOreLavoro = new TextField<String>(); TextField<String> txtfldOreViaggio = new TextField<String>(); TextField<String> txtfldOreStrao = new TextField<String>(); Text txtDescrizione = new Text(); FormInserimentoIntervalloCommessa frm = new FormInserimentoIntervalloCommessa("2"); String numeroCommessa; String descrizione; IntervalliCommesseModel intervallo; List<IntervalliCommesseModel> intervalliC = new ArrayList<IntervalliCommesseModel>(); String frmItemId = new String(); int i; i = fldSetIntervalliC.getItemCount(); // numero di commesse registrate for (int j = 1; j < i; j++) { frmItemId = String.valueOf(j - 1); frm = (FormInserimentoIntervalloCommessa) fldSetIntervalliC.getItemByItemId(frmItemId); // txtfldNumCommessa=frm.txtfldNumeroCommessa; txtfldOreLavoro = frm.txtfldOreIntervallo; txtfldOreViaggio = frm.txtfldOreViaggio; txtfldOreStrao = frm.txtfldOreStrao; txtDescrizione = frm.txtDescrizione; descrizione = txtDescrizione.getText(); numeroCommessa = descrizione.substring(0, descrizione.indexOf(" ")); descrizione = descrizione.substring(descrizione.indexOf("(") + 1, descrizione.indexOf(")")); // TODO ore strao intervallo = new IntervalliCommesseModel( numeroCommessa, txtfldOreLavoro.getValue().toString(), txtfldOreViaggio.getValue().toString(), "0.00", "", "", descrizione, ""); intervalliC.add(intervallo); } return intervalliC; }
public final boolean save(XObject input) { if (input instanceof XGroup) { XGroup group = (XGroup) input; group.setName(name.getValue()); group.setDescription(description.getValue()); } return true; }
private void savePerson() { final PersonServiceAsync personService = Registry.get(ExploitDemoConstants.PERSON_SERVICE); final Person p = new Person(firstNameField.getValue(), lastNameField.getValue()); personService.savePerson( p, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.toString()); } @Override public void onSuccess(Void result) { setHeading("Editing: " + lastNameField.getValue()); } }); }
private boolean validateFields() { if (!(Utils.safeString(password2TextBox.getValue())) .equals(Utils.safeString(password1TextBox.getValue()))) { MessageBox.alert(textMessages.error(), textMessages.passwordsNotMatch(), null); return false; } if (Utils.safeString(password1TextBox.getValue()).length() > UserAuthnPassword.LENGTH_PASSWORD) { MessageBox.alert(textMessages.error(), textMessages.tooLongPassword(), null); return false; } if (Utils.safeString(usernameTextBox.getValue()).equals("")) { MessageBox.alert(textMessages.error(), textMessages.mustEnterUsername(), null); return false; } if (Utils.safeString(usernameTextBox.getValue()).length() > User.LENGTH_USERNAME) { MessageBox.alert(textMessages.error(), textMessages.tooLongUsername(), null); return false; } if (Utils.safeString(fullnameTextBox.getValue()).equals("")) { MessageBox.alert(textMessages.error(), textMessages.mustEnterFullName(), null); return false; } if (Utils.safeString(fullnameTextBox.getValue()).length() > User.LENGTH_FULLNAME) { MessageBox.alert(textMessages.error(), textMessages.tooLongFullName(), null); return false; } if (Utils.safeString(emailTextBox.getValue()).equals("")) { MessageBox.alert(textMessages.error(), textMessages.mustEnterEmail(), null); return false; } if (Utils.safeString(emailTextBox.getValue()).length() > User.LENGTH_EMAIL) { MessageBox.alert(textMessages.error(), textMessages.tooLongEmail(), null); return false; } if (!Utils.isValidEmail(Utils.safeString(emailTextBox.getValue()))) { MessageBox.alert(textMessages.error(), textMessages.invalidEmail(), null); return false; } return true; }
public void getUpdatedNetInterface(GwtNetInterfaceConfig updatedNetIf) { if (m_formPanel != null) { String modeValue = m_modeCombo.getValue().getValue(); for (GwtNetRouterMode mode : GwtNetRouterMode.values()) { Log.info("Possible Mode: " + mode.name() + " with util: " + MessageUtils.get(mode.name())); if (MessageUtils.get(mode.name()).equals(modeValue)) { updatedNetIf.setRouterMode(mode.name()); } } Log.info("Mode Value: " + modeValue); updatedNetIf.setRouterDhcpBeginAddress(m_dhcpBeginAddressField.getValue()); updatedNetIf.setRouterDhcpEndAddress(m_dhcpEndAddressField.getValue()); updatedNetIf.setRouterDhcpSubnetMask(m_dhcpSubnetMaskField.getValue()); if (m_dhcpLeaseDefaultField.getValue() != null) { updatedNetIf.setRouterDhcpDefaultLease(m_dhcpLeaseDefaultField.getValue().intValue()); } if (m_dhcpLeaseMaxField.getValue() != null) { updatedNetIf.setRouterDhcpMaxLease(m_dhcpLeaseMaxField.getValue().intValue()); } updatedNetIf.setRouterDnsPass(m_passDnsRadioTrue.getValue()); } }
public void save(final Feed feed) { feed.setTitle(tfTitle.getValue()); feed.setDescription(taDescription.getValue()); feed.setLink(tfLink.getValue()); final FeedServiceAsync feedService = Registry.get(RSSReaderConstants.FEED_SERVICE); feedService.saveFeed( feed, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Info.display("RSS Reader", "Failed to save feed: " + feed.getTitle()); } @Override public void onSuccess(Void result) { Info.display("RSS Reader", "Feed " + feed.getTitle() + " saved sucessfully"); final ListStore<BeanModel> feedStore = Registry.get(RSSReaderConstants.FEED_STORE); BeanModelFactory beanModelFactory = BeanModelLookup.get().getFactory(feed.getClass()); feedStore.add(beanModelFactory.createModel(feed)); } }); }
private void doSave() { if (validateFields()) { group.setName(Utils.safeString(nameTextBox.getValue())); group.removeUsers(); for (UserData userData : toUserStore.getModels()) { group.addUser((User) userData.get(Constants.USER)); } final AsyncCallback<Boolean> callbackCheck = new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { WebPasswordSafe.handleServerFailure(caught); } @Override public void onSuccess(Boolean result) { // true => group name already taken, else go ahead and save if (result) { MessageBox.alert(textMessages.error(), textMessages.groupNameAlreadyExists(), null); } else { AsyncCallback<Void> callback = new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { WebPasswordSafe.handleServerFailure(caught); } @Override public void onSuccess(Void result) { Info.display(textMessages.status(), textMessages.groupSaved()); hide(); } }; if (group.getId() == 0) { UserService.Util.getInstance().addGroup(group, callback); } else { UserService.Util.getInstance().updateGroup(group, callback); } } } }; UserService.Util.getInstance().isGroupTaken(group.getName(), group.getId(), callbackCheck); } }
public String getNickOrEmail() { return loginNickOrEmailField.getValue(); }
public String getLoginPassword() { return loginPassField.getValue(); }
private UserWeb copyUserFromGUI(UserWeb updateUser) { UserWeb user = copyUser(updateUser); // Name user.setUsername(userName.getValue()); user.setFirstName(firstName.getValue()); user.setLastName(lastName.getValue()); // password if (passwordNew.getValue() != null && passwordConfirm.getValue() != null) { user.setPassword(passwordNew.getValue()); user.setConfirmPassword(passwordConfirm.getValue()); } user.setPasswordHint(passwordHint.getValue()); // Address user.setAddress(address.getValue()); user.setCity(city.getValue()); if (state.getValue() != null) { user.setState(state.getValue().getAbbr()); } user.setPostalCode(zip.getValue()); Country countryValue = country.getValue(); if (countryValue != null) { user.setCountry(countryValue.getName()); } // Phone user.setPhoneNumber(phoneNumber.getValue()); // Other user.setEmail(email.getValue()); user.setWebsite(webSite.getValue()); return user; }
@Override public Object getValue() { return field.getValue(); }
private void update() { if (m_selectNetIfConfig != null) { Log.debug( "in update(): got new netIfConfig for DHCP server for " + m_selectNetIfConfig.getName() + ": " + "\n\t\trouter mode: " + m_selectNetIfConfig.getRouterMode() + "\n\t\trouter DHCP start address: " + m_selectNetIfConfig.getRouterDhcpBeginAddress() + "\n\t\trouter DHCP end address: " + m_selectNetIfConfig.getRouterDhcpEndAddress() + "\n\t\trouter default lease: " + Integer.toString(m_selectNetIfConfig.getRouterDhcpDefaultLease()) + "\n\t\trouter max lease: " + Integer.toString(m_selectNetIfConfig.getRouterDhcpMaxLease()) + "\n\t\trouter Pass DNS: " + Boolean.toString(m_selectNetIfConfig.getRouterDnsPass())); m_modeCombo.setSimpleValue(MessageUtils.get(m_selectNetIfConfig.getRouterMode())); m_modeCombo.setOriginalValue(m_modeCombo.getValue()); m_dhcpBeginAddressField.setValue(m_selectNetIfConfig.getRouterDhcpBeginAddress()); m_dhcpBeginAddressField.setOriginalValue(m_dhcpBeginAddressField.getValue()); m_dhcpEndAddressField.setValue(m_selectNetIfConfig.getRouterDhcpEndAddress()); m_dhcpEndAddressField.setOriginalValue(m_dhcpEndAddressField.getValue()); m_dhcpSubnetMaskField.setValue(m_selectNetIfConfig.getRouterDhcpSubnetMask()); m_dhcpSubnetMaskField.setOriginalValue(m_dhcpSubnetMaskField.getValue()); m_dhcpLeaseDefaultField.setValue(m_selectNetIfConfig.getRouterDhcpDefaultLease()); m_dhcpLeaseDefaultField.setOriginalValue(m_dhcpLeaseDefaultField.getValue()); m_dhcpLeaseMaxField.setValue(m_selectNetIfConfig.getRouterDhcpMaxLease()); m_dhcpLeaseMaxField.setOriginalValue(m_dhcpLeaseMaxField.getValue()); if (m_selectNetIfConfig.getRouterDnsPass()) { m_passDnsRadioTrue.setValue(true); m_passDnsRadioTrue.setOriginalValue(m_passDnsRadioTrue.getValue()); m_passDnsRadioFalse.setValue(false); m_passDnsRadioFalse.setOriginalValue(m_passDnsRadioFalse.getValue()); m_passDnsRadioGroup.setOriginalValue(m_passDnsRadioTrue); m_passDnsRadioGroup.setValue(m_passDnsRadioGroup.getValue()); } else { m_passDnsRadioTrue.setValue(false); m_passDnsRadioTrue.setOriginalValue(m_passDnsRadioTrue.getValue()); m_passDnsRadioFalse.setValue(true); m_passDnsRadioFalse.setOriginalValue(m_passDnsRadioFalse.getValue()); m_passDnsRadioGroup.setOriginalValue(m_passDnsRadioFalse); m_passDnsRadioGroup.setValue(m_passDnsRadioGroup.getValue()); } } else { Log.debug("selected Network Interface Config is null"); } for (Field<?> field : m_formPanel.getFields()) { FormUtils.removeDirtyFieldIcon(field); } refreshForm(); }
@Override public boolean isActivatable() { return field.getValue() != null && field.getValue().length() > 0; }
/** * Gets the text field value. * * @return the text field value */ public String getTextFieldValue() { return textField.getValue(); }
@Override public void handleEvent(BaseEvent be) { // TODO Auto-generated method stub if (be.getType().equals(Events.Select)) { // 会员充值 if (be.getSource().equals(addfinace)) { AddFinace_acc addfinace_acc = new AddFinace_acc(); addfinace_acc.setIsnew(0); addfinace_acc.showDialog(); } if (be.getSource().equals(d.getButtonById(Dialog.NO))) { close(); } else if (be.getSource().equals(d.getButtonById(Dialog.YES))) { passwordc_t.clearInvalid(); String passwordc = (passwordc_t.getValue() == null ? "" : passwordc_t.getValue()); String password = (password_t.getValue() == null ? "" : password_t.getValue()); if ((!passwordc.equals(password))) { passwordc_t.markInvalid("两次录入密码不一致"); MessageBox.alert("提示", "两次密码录入不一致", null); return; } if (w.isValid()) { CommandSyncContainer list = new CommandSyncContainer(); CommandSyncsql commandsql = new CommandSyncsql(); // 保存 commandsql.getV().addAll(store._trySave(0)); // 更新ccode /** 不得已才如此操作,因为ccode的ccode字段是与其他操作管理的字段,和ccodepanel里的做法一直, 默认与icode同值 */ GWT.log( "update ccode set ccode =icode where s_cardno='" + cardno_t.getValue() + "' and cname='" + cname_t.getValue() + "'", null); commandsql .getV() .add( "update ccode set ccode =icode where s_cardno='" + cardno_t.getValue() + "' and cname='" + cname_t.getValue() + "'"); list.add(commandsql); final com.base.myproject.client.tools.GreetingServiceAsync greetingService = GWT.create(com.base.myproject.client.tools.GreetingService.class); greetingService.SendCommandSync( list, new AsyncCallback<CommandSyncReturnObject>() { public void onFailure(Throwable caught) { Window.alert("网络连接不稳定,请稍后重试!"); } public void onSuccess(CommandSyncReturnObject cyro) { System.out.println("成功:" + cyro.getMessage() + cyro.isB() + cyro.getRetrunstr()); if (cyro.isB()) { Info.display("", "保存成功", ""); addfinace.setEnabled(true); // close(); } else { MessageBox.alert("错误", "保存错误!" + cyro.getMessage(), null); } } }); // store.trySave(0); d.getButtonById(Dialog.YES).setEnabled(false); } else MessageBox.alert("禁止", "请检查录入是否正确!", null); } } else if (be.getType().equals(Events.Change)) { if (be.getSource().equals(cardno_t)) { final com.base.myproject.client.tools.GreetingServiceAsync greetingService = GWT.create(com.base.myproject.client.tools.GreetingService.class); greetingService.getDataSet( "select count(*) as c from ccode where s_cardno='" + cardno_t.getValue() + "'", new AsyncCallback<DataSet>() { @Override public void onFailure(Throwable caught) {} @Override public void onSuccess(DataSet result) { if (Integer.parseInt(result.getValue(0, "c")) > 0) { Validator v = new Validator() { @Override public String validate(Field<?> field, String value) { return "已经存在相同卡号的用户"; } }; cardno_t.setValidator(v); } else { cardno_t.setValidator(null); } cardno_t.validate(); } }); } else if (be.getSource().equals(cname_t)) { final com.base.myproject.client.tools.GreetingServiceAsync greetingService = GWT.create(com.base.myproject.client.tools.GreetingService.class); greetingService.getDataSet( "select count(*) as c from ccode where cname='" + cname_t.getValue() + "'", new AsyncCallback<DataSet>() { @Override public void onFailure(Throwable caught) {} @Override public void onSuccess(DataSet result) { if (Integer.parseInt(result.getValue(0, "c")) > 0) { Validator v = new Validator() { @Override public String validate(Field<?> field, String value) { return "已经存在相同名字的用户"; } }; cname_t.setValidator(v); } else { cname_t.setValidator(null); } cname_t.validate(); } }); } // else if (name.equals("s_cardno")) { // ccode_t.setFireChangeEventOnSetValue(true); // ccode_t.setValue(icode_t.getValue()); // ccode_t.setFireChangeEventOnSetValue(false); // } } }