当前位置: 首页>>代码示例>>Java>>正文


Java Strings类代码示例

本文整理汇总了Java中org.apache.wicket.util.string.Strings的典型用法代码示例。如果您正苦于以下问题:Java Strings类的具体用法?Java Strings怎么用?Java Strings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Strings类属于org.apache.wicket.util.string包,在下文中一共展示了Strings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendOptionHtml

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
@Override
protected void appendOptionHtml(AppendingStringBuffer buffer, User choice, int index, String selected) {
	if (isNewGroup(choice)) {
		if (!isFirst(index)) {
			buffer.append("</optgroup>");
		}
		buffer.append("<optgroup label='");
		buffer.append(Strings.escapeMarkup(getGroupLabel(choice)));
		buffer.append("'>");
	}
	super.appendOptionHtml(buffer, choice, index, selected);
	if (isLast(index)) {
		buffer.append("</optgroup>");
	}
	last = choice;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:17,代码来源:UserSelect2DropDownChoice.java

示例2: checkRequired

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
/**
 * Code copied from FormComponent#checkRequired, which is unfortunately useless as long as FormComponent#required is false.
 */
protected boolean checkRequired(FormComponent<?> formComponent) {
	final String input = formComponent.getInput();

	// when null, check whether this is natural for that component, or
	// whether - as is the case with text fields - this can only happen
	// when the component was disabled
	if (input == null && !formComponent.isInputNullable() && !formComponent.isEnabledInHierarchy())
	{
		// this value must have come from a disabled field
		// do not perform validation
		return true;
	}

	// peform validation by looking whether the value is null or empty
	return !Strings.isEmpty(input);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:20,代码来源:OneRequiredFormValidator.java

示例3: appendOptionHtml

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
@Override
protected void appendOptionHtml(AppendingStringBuffer buffer, T choice, int index, String selected) {
	if (grouped) {
		if (last == null || isNewGroup(choice, last)) {
			if (!isFirst(index)) {
				buffer.append("</optgroup>");
			}
			buffer.append("<optgroup label='");
			buffer.append(Strings.escapeMarkup(getGroupLabel(choice)));
			buffer.append("'>");
		}
		super.appendOptionHtml(buffer, choice, index, selected);
		if (isLast(index)) {
			buffer.append("</optgroup>");
		}
		last = choice;
	} else {
		super.appendOptionHtml(buffer, choice, index, selected);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:21,代码来源:GenericSelect2GroupDropDownSingleChoice.java

示例4: appendOptionHtml

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
@Override
protected void appendOptionHtml(AppendingStringBuffer buffer, E choice, int index, String selected) {
	if (grouped) {
		if (last == null || isNewGroup(choice, last)) {
			if (!isFirst(index)) {
				buffer.append("</optgroup>");
			}
			buffer.append("<optgroup label='");
			buffer.append(Strings.escapeMarkup(getGroupLabel(choice)));
			buffer.append("'>");
		}
		super.appendOptionHtml(buffer, choice, index, selected);
		if (isLast(index)) {
			buffer.append("</optgroup>");
		}
		last = choice;
	} else {
		super.appendOptionHtml(buffer, choice, index, selected);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:21,代码来源:AbstractOptGroupDropDownChoice.java

示例5: getQuery

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
private static String getQuery(boolean isCount, String search, String orderBy, boolean asc) {
	StringBuilder hql = new StringBuilder("SELECT ");
	hql.append(isCount ? "COUNT(" : "").append("m").append(isCount ? ")" : "")
		.append(" FROM PrivateMessage m WHERE m.owner.id = :ownerId ")
		.append(" AND m.folderId = :folderId ");

	if (!Strings.isEmpty(search)) {
		hql.append(" AND ( ")
			.append("lower(m.subject) LIKE :search ")
			.append("OR lower(m.message) LIKE :search ")
			.append("OR lower(m.from.firstname) LIKE :search ")
			.append("OR lower(m.from.lastname) LIKE :search ")
			.append("OR lower(m.from.login) LIKE :search ")
			.append("OR lower(m.from.address.email) LIKE :search ")
			.append(" ) ");
	}

	if (!isCount && !Strings.isEmpty(orderBy)) {
		hql.append(" ORDER BY ").append(orderBy).append(asc ? " ASC" : " DESC");
	}
	return hql.toString();
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:23,代码来源:PrivateMessageDao.java

示例6: getContact

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
public User getContact(String email, String firstName, String lastName, Long langId, String tzId, User owner) {
	List<User> list = em.createNamedQuery("getContactByEmailAndUser", User.class)
			.setParameter("email", email).setParameter("type", User.Type.contact).setParameter("ownerId", owner.getId())
			.getResultList();
	if (list.isEmpty()) {
		User to = new User();
		to.setType(Type.contact);
		String login = owner.getId() + "_" + email; //UserId prefix is used to ensure unique login
		to.setLogin(login.length() < getMinLoginLength(cfgDao) ? UUID.randomUUID().toString() : login);
		to.setFirstname(firstName);
		to.setLastname(lastName);
		to.setLanguageId(null == langId || null == LabelDao.getLocale(langId) ? owner.getLanguageId() : langId.longValue());
		to.setOwnerId(owner.getId());
		to.setAddress(new Address());
		to.getAddress().setEmail(email);
		to.setTimeZoneId(Strings.isEmpty(tzId) ? owner.getTimeZoneId() : tzId);
		return to;
	}
	return list.get(0);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:21,代码来源:UserDao.java

示例7: getQuery

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
private <T> TypedQuery<T> getQuery(boolean isCount, String search, String order, Class<T> clazz) {
	StringBuilder sb = new StringBuilder("SELECT ");
	sb.append(isCount ? "COUNT(m)" : "m")
		.append(" FROM MailMessage m");
	if (!Strings.isEmpty(search)) {
		sb.append(" WHERE m.recipients LIKE :search OR m.subject LIKE :search OR m.body LIKE :search OR m.lastError LIKE :search");
	}
	if (!Strings.isEmpty(order)) {
		sb.append(" ORDER BY m.").append(order);
	}
	TypedQuery<T> q = em.createQuery(sb.toString(), clazz);
	if (!Strings.isEmpty(search)) {
		q.setParameter("search", String.format("%%%s%%", search));
	}
	return q;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:17,代码来源:MailMessageDao.java

示例8: init

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
private void init(String _name, String _ext, InputStream is) {
	if (Strings.isEmpty(_ext)) {
		int idx = _name.lastIndexOf('.');
		name = idx < 0 ? _name : _name.substring(0, idx);
		ext = getFileExt(_name);
	} else {
		name = _name;
		ext = _ext.toLowerCase();
	}
	Metadata md = new Metadata();
	md.add(RESOURCE_NAME_KEY, String.format(FILE_NAME_FMT, name, ext));
	try {
		mime = tika.getDetector().detect(is == null ? null : TikaInputStream.get(is), md);
	} catch (Throwable e) {
		mime = null;
		log.error("Unexpected exception while detecting mime type", e);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:19,代码来源:StoredFile.java

示例9: createOfficeManager

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
public static void createOfficeManager(String officePath, Consumer<OfficeManager> consumer) {
	OfficeManager manager = null;
	try {
		DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
		if (!Strings.isEmpty(officePath)) {
			configuration.setOfficeHome(officePath);
		}
		manager = configuration.buildOfficeManager();
		manager.start();
		if (consumer != null) {
			consumer.accept(manager);
		}
	} finally {
		if (manager != null) {
			manager.stop();
		}
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:19,代码来源:DocumentConverter.java

示例10: onOpen

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
@Override
protected void onOpen(IPartialPageRequestHandler handler) {
	ConfigurationDao cfgDao = getBean(ConfigurationDao.class);
	String baseURL = getBaseUrl();
	sendEmailAtRegister = cfgDao.getBool(CONFIG_EMAIL_AT_REGISTER, false);
	sendConfirmation = !Strings.isEmpty(baseURL) && cfgDao.getBool(CONFIG_EMAIL_VERIFICATION, false);
	String messageCode = "account.created";
	if (sendConfirmation && sendEmailAtRegister) {
		messageCode = "warn.notverified";
	} else if (sendConfirmation) {
		messageCode = "1591";
	}
	confirmRegistration.setModelObject(getString(messageCode));
	reset(handler);
	handler.add(form);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:17,代码来源:RegisterDialog.java

示例11: onValidate

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
@Override
protected void onValidate() {
	String p = current.getConvertedInput();
	if (!Strings.isEmpty(p) && !getBean(UserDao.class).verifyPassword(getUserId(), p)) {
		error(getString("231"));
		// add random timeout
		try {
			Thread.sleep(6 + (long)(10 * Math.random() * 1000));
		} catch (InterruptedException e) {
			log.error("Unexpected exception while sleeping", e);
		}
	}
	String p1 = pass.getConvertedInput();
	if (!Strings.isEmpty(p1) && !p1.equals(pass2.getConvertedInput())) {
		error(getString("232"));
	}
	super.onValidate();
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:19,代码来源:ChangePasswordDialog.java

示例12: process

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
boolean process(BooleanSupplier processAll, Predicate<Room> processRoom, Predicate<User> processUser) {
	try {
		final String scope = getScope();
		if (Strings.isEmpty(scope) || ID_ALL.equals(scope)) {
			return processAll.getAsBoolean();
		} else if (scope.startsWith(ID_ROOM_PREFIX)) {
			Room r = getBean(RoomDao.class).get(Long.parseLong(scope.substring(ID_ROOM_PREFIX.length())));
			if (r != null) {
				return processRoom.test(r);
			}
		} else if (scope.startsWith(ID_USER_PREFIX)) {
			User u = getBean(UserDao.class).get(Long.parseLong(scope.substring(ID_USER_PREFIX.length())));
			if (u != null) {
				return processUser.test(u);
			}
		}
	} catch (Exception e) {
		//no-op
	}
	return false;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:22,代码来源:ChatForm.java

示例13: respond

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
@Override
protected void respond(AjaxRequestTarget target) {
	try {
		String uid = getRequest().getRequestParameters().getParameterValue(PARAM_UID).toString();
		if (Strings.isEmpty(uid)) {
			return;
		}
		Client.Activity a = Client.Activity.valueOf(getRequest().getRequestParameters().getParameterValue(PARAM_ACTIVITY).toString());
		StringValue podStr = getRequest().getRequestParameters().getParameterValue(PARAM_POD);
		Pod pod = podStr.isEmpty() ? Pod.none : Pod.valueOf(podStr.toString());
		Client c = getOnlineClient(uid);
		toggleActivity(c, a, pod);
	} catch (Exception e) {
		log.error("Unexpected exception while toggle 'activity'", e);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:17,代码来源:RoomSidebar.java

示例14: getName

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
private static String getName(Client c) {
	String delim = "";
	StringBuilder sb = new StringBuilder();
	User u = c.getUser();
	if (!Strings.isEmpty(u.getFirstname())) {
		sb.append(u.getFirstname());
		delim = " ";
	}
	if (!Strings.isEmpty(u.getLastname())) {
		sb.append(delim).append(u.getLastname());
		delim = " ";
	}
	if (Strings.isEmpty(sb) && u.getAddress() != null && !Strings.isEmpty(u.getAddress().getEmail())) {
		sb.append(delim).append(u.getAddress().getEmail());
	}
	if (Strings.isEmpty(sb)) {
		sb.append("N/A");
	}
	return sb.toString();
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:21,代码来源:RoomClientPanel.java

示例15: RoomMenuPanel

import org.apache.wicket.util.string.Strings; //导入依赖的package包/类
public RoomMenuPanel(String id, final RoomPanel room) {
	super(id);
	setOutputMarkupPlaceholderTag(true);
	this.room = room;
	Room r = room.getRoom();
	setVisible(!r.isHidden(RoomElement.TopBar));
	add((roomName = new Label("roomName", r.getName())).setOutputMarkupPlaceholderTag(true).setOutputMarkupId(true));
	String tag = getGroup().getTag();
	add(logo, new Label("tag", tag).setVisible(!Strings.isEmpty(tag)));
	add((shareBtn = new StartSharingButton("share", room.getUid()))
			.setOutputMarkupPlaceholderTag(true).setOutputMarkupId(true));
	RoomInvitationForm rif = new RoomInvitationForm("form", room.getRoom().getId());
	add(invite = new InvitationDialog("invite", rif));
	rif.setDialog(invite);
	add(createPoll = new CreatePollDialog("createPoll", room.getRoom().getId()));
	add(vote = new VoteDialog("vote"));
	add(pollResults = new PollResultsDialog("pollResults", room.getRoom().getId()));
	add(sipDialer = new SipDialerDialog("sipDialer", room));
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:20,代码来源:RoomMenuPanel.java


注:本文中的org.apache.wicket.util.string.Strings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。