本文整理汇总了Java中org.apache.wicket.util.string.StringValue.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringValue.isEmpty方法的具体用法?Java StringValue.isEmpty怎么用?Java StringValue.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.util.string.StringValue
的用法示例。
在下文中一共展示了StringValue.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AllFacetValuesPage
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
public AllFacetValuesPage(PageParameters params) {
super(params);
this.selectionModel = Model.of(parametersConverter.fromParameters(params));
final StringValue facetValue = params.get(SELECTED_FACET_PARAM);
if (facetValue.isEmpty()) {
Session.get().error("No facet provided for all values page");
throw new RestartResponseException(new FacetedSearchPage(selectionModel));
}
final String facet = facetParamMapper.getFacet(facetValue.toString());
if (vloConfig.getFacetsInSearch().contains(facet)) {
// create a new model so that all values will be retrieved
setModel(new FacetFieldModel(facet, facetFieldsService, selectionModel)); // gets all facet values
}
if (getModelObject() == null) {
Session.get().error(String.format("Facet '%s' could not be found", facet));
ErrorPage.triggerErrorPage(ErrorPage.ErrorType.PAGE_NOT_FOUND, params);
}
addComponents();
}
示例2: processTheme
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
/**
* Sets the theme from the page parameters if applicable. An present but
* empty theme value will reset the theme (by unsetting the style).
*
* @param parameters page parameters to process
* @see VloWebAppParameters#THEME
* @see Session#setStyle(java.lang.String)
*/
private void processTheme(PageParameters parameters) {
final StringValue themeValue = parameters.get(VloWebAppParameters.THEME);
if (!themeValue.isNull()) {
if (themeValue.isEmpty()) {
// empty string resets theme
logger.debug("Resetting theme");
Session.get().setStyle(null);
} else {
// theme found, set it as style in the session
final String theme = themeValue.toString().toLowerCase();
logger.debug("Setting theme to {}", theme);
Session.get().setStyle(theme);
}
/*
* Remove theme parameter to prevent it from interfering with
* further processing, specifically the parameters check in
* the simple page search
*/
parameters.remove(VloWebAppParameters.THEME, themeValue.toString());
}
}
示例3: getOidFromParameter
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
private String getOidFromParameter(PageParameters params){
if (params == null || params.isEmpty()) {
LOGGER.error("No page paraeters found for account activation. No user to activate his/her accounts");
return null;
}
StringValue userValue = params.get(SchemaConstants.USER_ID);
if (userValue == null || userValue.isEmpty()) {
LOGGER.error("No user defined in the page parameter. Expected user=? attribute filled but didmn't find one.");
return null;
}
return userValue.toString();
}
示例4: fromParameters
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
@Override
public QueryFacetsSelection fromParameters(PageParameters params) {
// Get query string from params
final String query = params.get(QUERY).toOptionalString();
final List<StringValue> facetSelectionTypes = params.getValues(FILTER_QUERY_TYPE);
final List<StringValue> facetValues = params.getValues(FILTER_QUERY);
final HashMap<String, FacetSelection> selection = Maps.newHashMapWithExpectedSize(facetValues.size());
// Get selection type from params
for (StringValue selectionType : facetSelectionTypes) {
if (!selectionType.isEmpty()) {
applySelectionTypeFromParameter(selectionType, selection);
}
}
// Get facet selections from params
for (StringValue facetValue : facetValues) {
if (!facetValue.isEmpty()) {
applyFacetValueFromParameter(facetValue, selection);
}
}
return new QueryFacetsSelection(query, selection);
}
示例5: encodePageParameters
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
@Override
protected Url encodePageParameters(Url url, PageParameters pageParameters, IPageParametersEncoder encoder) {
//get special page parameter that encodes the page fragment/anchor
final StringValue fragment = pageParameters.get(FRAGMENT_PAGE_PARAMETER);
if (fragment.isEmpty()) {
//business as usual
return super.encodePageParameters(url, pageParameters, encoder);
} else {
//we have a fragment parameter, remove from normal parameters and do post-processing
pageParameters.remove(FRAGMENT_PAGE_PARAMETER);
final Url result = super.encodePageParameters(url, pageParameters, encoder);
//set the fragment on the resulting URL
result.setFragment(fragment.toString());
return result;
}
}
示例6: loadAdapter
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
/**
*
* @param idParam
*/
private void loadAdapter(final StringValue idParam) {
if (idParam.isEmpty()) {
setPageTitle(new StringResourceModel("page.create.title", this,
null));
add(new Label("header", new StringResourceModel(
"form.create.header", this, null)));
adapterSettings = new AdapterSettings();
} else {
adapterSettings = adapterSettingsService.getById(idParam.toOptionalLong());
if (adapterSettings == null) {
throw new EntityNotFoundException(AdapterSettings.class, idParam.toOptionalString());
}
setPageTitle(new StringResourceModel("page.edit.title", this, null));
add(new Label("header", new StringResourceModel("form.edit.header",
this, null)));
}
}
示例7: respond
import org.apache.wicket.util.string.StringValue; //导入方法依赖的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);
}
}
示例8: loadTableEntity
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
/**
*
* @param idParam
*/
private void loadTableEntity(final StringValue idParam) {
if (idParam.isEmpty()) {
setPageTitle(new StringResourceModel("page.create.title", this,
null));
add(new Label("header", new StringResourceModel(
"form.create.header", this, null)));
tableEntity = new JenkinsMetricMeasurement();
} else {
setPageTitle(new StringResourceModel("page.edit.title", this, null));
add(new Label("header", new StringResourceModel("form.edit.header",
this, null)));
// set the tableEntity we got from previous page
try {
tableEntity = jenkinsService.getById(idParam
.toOptionalLong());
} catch (Exception e) {
throw new RestartResponseException(AboutPage.class);
}
}
}
示例9: actionDoAction
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
private Object actionDoAction(AjaxRequestTarget aTarget, IRequestParameters request, JCas jCas,
VID paramId)
throws IOException
{
StringValue layerParam = request.getParameterValue(PARAM_SPAN_TYPE);
if (!layerParam.isEmpty()) {
long layerId = Long.parseLong(layerParam.beforeFirst('_'));
AnnotationLayer layer = annotationService.getLayer(layerId);
if (!StringUtils.isEmpty(layer.getOnClickJavascriptAction())) {
// parse the action
List<AnnotationFeature> features = annotationService.listAnnotationFeature(layer);
AnnotationFS anno = WebAnnoCasUtil.selectByAddr(jCas, paramId.getId());
Map<String, Object> functionParams = OnClickActionParser.parse(layer, features,
getModelObject().getDocument(), anno);
// define anonymous function, fill the body and immediately execute
String js = String.format("(function ($PARAM){ %s })(%s)",
layer.getOnClickJavascriptAction(), JSONUtil.toJsonString(functionParams));
aTarget.appendJavaScript(js);
}
}
return null;
}
示例10: loadTableEntity
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
/**
*
* @param idParam
*/
private void loadTableEntity(final StringValue idParam) {
if (idParam.isEmpty()) {
setPageTitle(new StringResourceModel("page.create.title", this,
null));
add(new Label("header", new StringResourceModel(
"form.create.header", this, null)));
tableEntity = new JiraMetricMeasurement();
} else {
setPageTitle(new StringResourceModel("page.edit.title", this, null));
add(new Label("header", new StringResourceModel("form.edit.header",
this, null)));
// set the tableEntity we got from previous page
try {
tableEntity = jiraService.getById(idParam
.toOptionalLong());
} catch (Exception e) {
throw new RestartResponseException(AboutPage.class);
}
}
}
示例11: CustomerEditPage
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
public CustomerEditPage(PageParameters params){
super();
StringValue customerIdParam = params.get(CUSTOMER_ID_PARAM);
if(customerIdParam.isEmpty() || !StringUtils.isNumeric(customerIdParam.toString())){
getSession().error(MessageFormat.format(getString("param.customer.id.missing"), customerIdParam));
// "Missing customer id " + stringValue
setResponsePage(CustomerListPage.class);
}
Long customerId = customerIdParam.toLong();
Customer customer = service.findById(customerId);
if(customer == null){
getSession().error(MessageFormat.format(getString("customer.not-found"), customerId.toString()));
setResponsePage(CustomerListPage.class);
}
StringValue pageReferfenceIdParam = params.get(PAGE_REFERENCE_ID);
if(!pageReferfenceIdParam.isEmpty() || StringUtils.isNumeric(pageReferfenceIdParam.toString())){
setPageReferenceId(pageReferfenceIdParam.toInteger());
}
getCustomerModel().setObject(customer);
}
示例12: loadTableEntity
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
/**
*
* @param idParam
*/
private void loadTableEntity(final StringValue idParam) {
if (idParam.isEmpty()) {
setPageTitle(new StringResourceModel("page.create.title", this,
null));
add(new Label("header", new StringResourceModel(
"form.create.header", this, null)));
tableEntity = new SonarMetricMeasurement();
} else {
setPageTitle(new StringResourceModel("page.edit.title", this, null));
add(new Label("header", new StringResourceModel("form.edit.header",
this, null)));
// set the tableEntity we got from previous page
try {
tableEntity = sonarService.getById(idParam
.toOptionalLong());
} catch (Exception e) {
throw new RestartResponseException(AboutPage.class);
}
}
}
示例13: loadDashboard
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
/**
*
* @param idParam
*/
private void loadDashboard(final StringValue idParam) {
// Create a new dashboard, if no ID is provided
if (idParam.isEmpty()) {
setPageTitle(new StringResourceModel("page.create.title", this,
null));
add(new Label("header", new StringResourceModel(
"form.create.header", this, null)));
String id = String.valueOf(new Date().getTime());
String title = "Dashboard-" +UQasar.getSession().getLoggedInUser().getUserName() +"-" +id;
dashboard = new DbDashboard(id, title);
} else {
setPageTitle(new StringResourceModel("page.edit.title", this, null));
add(new Label("header", new StringResourceModel("form.edit.header",
this, null)));
// set the item we got from previous page
try {
dashboard = dashboardService
.getById(idParam.toOptionalLong());
} catch (Exception e) {
throw new RestartResponseException(AboutPage.class);
}
}
}
示例14: loadProcess
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
/**
*
* @param idParam
*/
private void loadProcess(final StringValue idParam) {
// If no id is provided
if (idParam.isEmpty()) {
setPageTitle(new StringResourceModel("page.create.title", this,
null));
add(new Label("header", new StringResourceModel(
"form.create.header", this, null)));
process = new Process();
}
// Attempt to load the process by the id
else {
process = processService.getById(idParam.toLong());
if (process == null) {
throw new EntityNotFoundException(Process.class, idParam.toOptionalString());
}
setPageTitle(new StringResourceModel("page.edit.title", this, null));
add(new Label("header", new StringResourceModel("form.edit.header",
this, null)));
}
}
示例15: loadSettings
import org.apache.wicket.util.string.StringValue; //导入方法依赖的package包/类
/**
*
* @param idParam
*/
private void loadSettings(final StringValue idParam) {
if (idParam.isEmpty()) {
setPageTitle(new StringResourceModel("page.create.title", this, null));
add(new Label("header", new StringResourceModel("form.create.header", this, null)));
platformSettings = new PlatformSettings();
} else {
platformSettings = platformSettingsService.getById(idParam.toOptionalLong());
if (platformSettings == null) {
throw new EntityNotFoundException(PlatformSettings.class, idParam.toOptionalString());
}
setPageTitle(new StringResourceModel("page.edit.title", this, null));
add(new Label("header", new StringResourceModel("form.edit.header", this, null)));
}
}