本文整理汇总了Java中org.zkoss.zul.Textbox类的典型用法代码示例。如果您正苦于以下问题:Java Textbox类的具体用法?Java Textbox怎么用?Java Textbox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Textbox类属于org.zkoss.zul包,在下文中一共展示了Textbox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isDescriptionValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates description.
* @param description Textbox with the description to validate.
* @return true if description is valid, false otherwise.
*/
public static boolean isDescriptionValid(Textbox description) {
//If there are no previous errors
if (description.getErrorMessage() == null || description.getErrorMessage().isEmpty()) {
//Trim
description.setValue(description.getValue().trim());
//Check description length
if (description.getValue().length() > CommonConstants.MAX_DESCRIPTION_LENGTH) {
description.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_DESCRIPTION_LENGTH));
return false;
}
}
else
return false;
return true;
}
示例2: isVersionValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates version.
* @param version Textbox with the version to validate.
* @return true if version is valid, false otherwise.
*/
public static boolean isVersionValid(Textbox version) {
//If there are no previous errors
if (version.getErrorMessage() == null || version.getErrorMessage().isEmpty()) {
//Trim
version.setValue(version.getValue().trim());
//Check if user has entered a value
if (version.getValue().isEmpty()) {
version.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_VERSION_EMPTY));
return false;
}
//Check version length
if (version.getValue().length() > CommonConstants.MAX_VERSION_LENGTH) {
version.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_VERSION_LENGTH));
return false;
}
}
else
return false;
return true;
}
示例3: OKPostponeCustomerDialog
import org.zkoss.zul.Textbox; //导入依赖的package包/类
@Command
@NotifyChange(value = { "postponList", "customer", "btnsDisabled" })
public void OKPostponeCustomerDialog() {
final CmdParams params = new CmdParams();
params.userId = user.getUser().getId();
params.postponedPeriod = ((Combobox) postponeCustomerDialog.getFellow("timeBox")).getSelectedIndex() * 5;
params.comments = ((Textbox) postponeCustomerDialog.getFellow("tb_onHold")).getText();
Executer.getInstance().getTasks().get(Uses.TASK_CUSTOMER_TO_POSTPON).process(params, "", new byte[4]);
customer = null;
QUser quser = QUserList.getInstance().getById(params.userId);
quser.setCurrentService("");
setKeyRegim(KEYS_MAY_INVITE);
postpone_list.setModel(postpone_list.getModel());
postponeCustomerDialog.setVisible(false);
serveCustomerDialogWindow.setVisible(false);
((Textbox) postponeCustomerDialog.getFellow("tb_onHold")).setText("");
BindUtils.postNotifyChange(null, null, Form.this, "*");
}
示例4: isUsernameValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates username.
* @param username Textbox with the username to validate.
* @param authenticationHelper Helper to use authentication web services.
* @return true if username is valid, false otherwise.
*/
public static UserInfo isUsernameValid(Textbox username, AuthenticationHelper authenticationHelper) {
//If there are no previous errors
if (username.getErrorMessage() == null || username.getErrorMessage().isEmpty()) {
//Trim and lowercase
username.setValue(username.getValue().trim().toLowerCase());
//Check if user has entered a value
if (username.getValue().isEmpty()) {
username.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_USERNAME_EMPTY));
return null;
}
//Check dbName length
if (username.getValue().length() > CommonConstants.MAX_USERNAME_LENGTH) {
username.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_USERNAME_LENGTH));
return null;
}
//ASCII digits and non-digits
if (!Pattern.matches("[a-z]*", username.getValue())) {
username.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_USERNAME_CHARS));
return null;
}
//Check if the user exists
UserInfo info = authenticationHelper.getUserInfo(username.getValue());
if (info != null && info.getCcid() > 0) {
return info;
}
else {
username.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_USERNAME_NOT_FOUND));
return null;
}
}
else
return null;
}
示例5: isDbNameValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates DB name.
* @param dbName Textbox with the DB name to validate.
* @return true if DB name is valid, false otherwise.
*/
public static boolean isDbNameValid(Textbox dbName) {
//If there are no previous errors
if (dbName.getErrorMessage() == null || dbName.getErrorMessage().isEmpty()) {
//Trim and lowercase
dbName.setValue(dbName.getValue().trim().toLowerCase());
//Check if user has entered a value
if (dbName.getValue().isEmpty()) {
dbName.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_DB_NAME_EMPTY));
return false;
}
//Check dbName length
if (dbName.getValue().length() > CommonConstants.MAX_DB_NAME_LENGTH) {
dbName.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_DB_NAME_LENGTH));
return false;
}
//ASCII digits and non-digits
if (!Pattern.matches("[a-z][\\da-z_]*", dbName.getValue())) {
dbName.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_DB_NAME_CHARS));
return false;
}
}
else
return false;
return true;
}
示例6: isEGroupValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates e-Group name.
* @param eGroup Textbox with the e-group to validate.
* @param dbType type of the DB.
* @param helper helper to check the e-group is SECURITY_MAILING
* @return true if e-group name is valid, false otherwise.
*/
public static boolean isEGroupValid(Textbox eGroup, String dbType, EGroupHelper helper) {
//If there are no previous errors
if (eGroup.getErrorMessage() == null || eGroup.getErrorMessage().isEmpty()) {
//Trim and lowercase
eGroup.setValue(eGroup.getValue().trim().toLowerCase());
if (eGroup.getValue().length() > 0) {
//Check eGroup length
if (eGroup.getText().length() > CommonConstants.MAX_E_GROUP_LENGTH) {
eGroup.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_E_GROUP_LENGTH));
return false;
}
//Check if egroup name contains a dash
if (!eGroup.getValue().contains("-")) {
eGroup.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_E_GROUP_DASH));
return false;
}
//Only upppercase and lowercase ASCII letters, numbers, dashes, dots and underscores are allowed
if (!Pattern.matches("[\\da-z\\.\\-_]*", eGroup.getValue())) {
eGroup.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_E_GROUP_CHARS));
return false;
}
//Check if egroup is EGORUPS_ONLY
if (helper.isEgroupsOnly(eGroup.getValue())) {
eGroup.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_E_GROUP_EGROUPS_ONLY));
return false;
}
}
//If egroup is empty and the instance is Oracle 12c show error
else {
if (CommonConstants.DB_TYPE_ORACLE_12.equals(dbType)) {
eGroup.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_E_GROUP_ORA12));
return false;
}
}
}
else
return false;
return true;
}
示例7: isDbSizeValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates DB size.
* @param dbSize Textbox with the DB size to validate.
* @return true if DB size is valid, false otherwise.
*/
public static boolean isDbSizeValid(Textbox dbSize) {
//If there are no previous errors
if (dbSize.getErrorMessage() == null || dbSize.getErrorMessage().isEmpty()) {
//Trim
dbSize.setValue(dbSize.getValue().trim());
//Check if user has entered a value
if (dbSize.getValue().isEmpty()) {
dbSize.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_DB_SIZE_EMPTY));
return false;
}
try {
Integer size = Integer.valueOf(dbSize.getText());
//Check dbName length
if (size < 10 || size > CommonConstants.MAX_DB_SIZE) {
dbSize.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_DB_SIZE_RANGE));
return false;
}
} catch (NumberFormatException ex) {
dbSize.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_INTEGER_FORMAT));
return false;
}
}
else
return false;
return true;
}
示例8: isNOConnectionsValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates NO Connections.
* @param noConnections Textbox with the number of connections to validate.
* @return true if NO Connections is valid, false otherwise
*/
public static boolean isNOConnectionsValid(Textbox noConnections) {
//If there are no previous errors
if (noConnections.getErrorMessage() == null || noConnections.getErrorMessage().isEmpty()) {
//Trim
noConnections.setValue(noConnections.getValue().trim());
//Check only if user has entered a value
if (!noConnections.getValue().isEmpty()) {
try {
int noConn = Integer.valueOf(noConnections.getText()).intValue();
//Check dbName length
if (noConn <= 0 || noConn > CommonConstants.MAX_NO_CONNECTIONS) {
noConnections.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_NO_CONNECTIONS_RANGE));
return false;
}
} catch (NumberFormatException ex) {
noConnections.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_INTEGER_FORMAT));
return false;
}
}
}
else
return false;
return true;
}
示例9: isProjectValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates project
* @param project Textbox with the project to validate.
* @return true if project is valid, false otherwise
*/
public static boolean isProjectValid(Textbox project) {
//If there are no previous errors
if (project.getErrorMessage() == null || project.getErrorMessage().isEmpty()) {
//Trim
project.setValue(project.getValue().trim());
//Check project length
if (project.getValue().length() > CommonConstants.MAX_PROJECT_LENGTH) {
project.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_PROJECT_LENGTH));
return false;
}
}
else
return false;
return true;
}
示例10: isMasterValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates master.
* @param master Textbox with the master to validate.
* @param instanceDAO DAO to use in order to obtain the master with the given name.
* @return true if DB name is valid, false otherwise
*/
public static boolean isMasterValid(Textbox master, InstanceDAO instanceDAO) {
//If there are no previous errors
if (master.getErrorMessage() == null || master.getErrorMessage().isEmpty()) {
//Trim and lowercase
master.setValue(master.getValue().trim().toLowerCase());
//If it's empty return true
if (master.getValue() == null || master.getValue().isEmpty())
return true;
//Check dbName length
if (master.getValue().length() > CommonConstants.MAX_DB_NAME_LENGTH) {
master.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_DB_NAME_LENGTH));
return false;
}
//ASCII digits and non-digits
if (!Pattern.matches("[a-z][\\da-z_]*", master.getValue())) {
master.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_DB_NAME_CHARS));
return false;
}
Instance masterInstance = instanceDAO.selectByDbName(master.getValue(), null);
//Check that master exists
if (masterInstance == null) {
master.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_MASTER_DOES_NOT_EXIST));
return false;
}
}
else
return false;
return true;
}
示例11: isHostValid
import org.zkoss.zul.Textbox; //导入依赖的package包/类
/**
* Validates host
* @param host Textbox with the host to validate.
* @return true if shared instance is valid, false otherwise.
*/
public static boolean isHostValid(Textbox host) {
//If there are no previous errors
if (host.getErrorMessage() == null || host.getErrorMessage().isEmpty()) {
//Trim
host.setValue(host.getValue().trim());
//Check if user has entered a value
if (host.getValue().isEmpty()) {
host.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_HOST_EMPTY));
return false;
}
//Only upppercase and lowercase ASCII letters, numbers, dashes, dots and underscores are allowed
if (!Pattern.matches("[\\da-z\\.\\-_,]*", host.getValue())) {
host.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_HOST_CHARS));
return false;
}
//Check shared instance length
if (host.getValue().length() > CommonConstants.MAX_HOST_LENGTH) {
host.setErrorMessage(Labels.getLabel(CommonConstants.ERROR_HOST_LENGTH));
return false;
}
}
else
return false;
return true;
}
示例12: updateComments
import org.zkoss.zul.Textbox; //导入依赖的package包/类
@Command
public void updateComments() {
// Inheritance the comment from Serve-customer window to hold window
String tempComment = ((Textbox) serveCustomerDialogWindow.getFellow("editable_comments"))
.getText();
customer.setTempComments(tempComment);
// Set to User current Comments
// QUser quser = QUserList.getInstance().getById(user.getUser().getId());
// quser.setCurrentComments(tempComment);
QLog.l().logQUser().debug("\n\nPostponed!!:\n" + customer.getTempComments() + "\n\n\n");
}
示例13: ReturnedRedirect
import org.zkoss.zul.Textbox; //导入依赖的package包/类
@Command
public void ReturnedRedirect() {
final CmdParams params = new CmdParams();
params.userId = user.getUser().getId();
params.resultId = -1L;
params.priority = Uses.PRIORITY_NORMAL;
params.isMine = Boolean.FALSE;
params.welcomeTime = user.getCustomerWelcomeTime();
params.comments = ((Textbox) serveCustomerDialogWindow.getFellow("editable_comments"))
.getText();
customer = user.getUser().getCustomer();
params.serviceId = user.getUser().getCustomer().getService().getId();
customer.setTempComments(params.comments);
// Set to User current Comments
// QUser quser = QUserList.getInstance().getById(params.userId);
// quser.setCurrentComments(params.comments);
Executer.getInstance().getTasks().get(Uses.TASK_CUSTOMER_RETURN_QUEUE).process(params, "", new byte[4]);
customer = null;
setKeyRegim(KEYS_MAY_INVITE);
service_list.setModel(service_list.getModel());
refreshListServices();
service_list.invalidate();
serveCustomerDialogWindow.setVisible(false);
}
示例14: closePostponeCustomerDialog
import org.zkoss.zul.Textbox; //导入依赖的package包/类
@Command
public void closePostponeCustomerDialog() {
postponeCustomerDialog.setVisible(false);
((Textbox) postponeCustomerDialog.getFellow("tb_onHold")).setText("");
BindUtils.postNotifyChange(null, null, Form.this, "*");
serveCustomerDialogWindow.setVisible(false);
}
示例15: refreshAddWindow
import org.zkoss.zul.Textbox; //导入依赖的package包/类
public void refreshAddWindow() {
((Textbox) addTicketDailogWindow.getFellow("typeservices")).setText("");
((Textbox) addTicketDailogWindow.getFellow("reception_ticket_comments")).setText("");
((Textbox) addTicketDailogWindow.getFellow("general_ticket_comments")).setText("");
((Combobox) addTicketDailogWindow.getFellow("cboFmCompress")).setText("");
// Reset focus, if not reception.
if (!getCFMSType()) {
((Textbox) addTicketDailogWindow.getFellow("typeservices")).setFocus(true);
}
listServices = getAllListServices();
pickedMainService = null;
BindUtils.postNotifyChange(null, null, Form.this, "listServices");
}