Example usage for org.apache.wicket.util.string StringValue isNull

List of usage examples for org.apache.wicket.util.string StringValue isNull

Introduction

In this page you can find the example usage for org.apache.wicket.util.string StringValue isNull.

Prototype

public boolean isNull() 

Source Link

Document

Returns whether the text is null.

Usage

From source file:com.cubeia.games.poker.admin.wicket.util.WicketHelpers.java

License:Open Source License

private static boolean nullValue(StringValue value) {
    return value == null || value.isNull() || value.isEmpty();
}

From source file:com.cubeia.games.poker.admin.wicket.util.WicketHelpers.java

License:Open Source License

public static boolean isEmpty(StringValue value) {
    return value == null || value.isEmpty() || value.isNull();
}

From source file:com.cubeia.games.poker.admin.wicket.util.WicketHelpers.java

License:Open Source License

public static Date toDateOrNull(StringValue value) {
    if (value.isNull())
        return null;
    return new DateConverter().convertToObject(value.toString(), Locale.getDefault());
}

From source file:com.ecom.web.components.gmap.event.ZoomEndListener.java

License:Apache License

@Override
protected void onEvent(AjaxRequestTarget target) {
    Request request = RequestCycle.get().getRequest();
    int oldLevel = 0;
    int newLevel = 0;
    StringValue oldZoomLevelParameter = request.getRequestParameters().getParameterValue("argument0");
    StringValue newZoomLevelParameter = request.getRequestParameters().getParameterValue("argument1");
    if (oldZoomLevelParameter.isNull() || newZoomLevelParameter.isNull()) {
        return;/*from   www .j  a  va2  s.  co m*/
    }
    oldLevel = oldZoomLevelParameter.toInt();
    newLevel = newZoomLevelParameter.toInt();
    onZoomEnd(target, oldLevel, newLevel);
}

From source file:com.evolveum.midpoint.gui.api.page.PageBase.java

License:Apache License

private int getSelectedTabForConfiguration(WebPage page) {
    PageParameters params = page.getPageParameters();
    StringValue val = params.get(PageSystemConfiguration.SELECTED_TAB_INDEX);
    String value = null;/*from   w w  w.jav  a  2  s. c o  m*/
    if (val != null && !val.isNull()) {
        value = val.toString();
    }

    return StringUtils.isNumeric(value) ? Integer.parseInt(value)
            : PageSystemConfiguration.CONFIGURATION_TAB_BASIC;
}

From source file:com.evolveum.midpoint.gui.impl.page.admin.configuration.component.ObjectPolicyConfigurationTabPanel.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    PageParameters params = getPage().getPageParameters();
    StringValue val = params.get(PageSystemConfiguration.SELECTED_TAB_INDEX);
    if (val != null && !val.isNull()) {
        params.remove(params.getPosition(PageSystemConfiguration.SELECTED_TAB_INDEX));
    }//from  w w  w  .  j a va 2 s  .c  o  m
    params.set(PageSystemConfiguration.SELECTED_TAB_INDEX,
            PageSystemConfiguration.CONFIGURATION_TAB_OBJECT_POLICY);

    initLayout();
}

From source file:com.romeikat.datamessie.core.base.ui.page.AbstractAuthenticatedPage.java

License:Open Source License

private void initialize() {
    // Active project
    final IModel<ProjectDto> activeProjectModel = new LoadableDetachableModel<ProjectDto>() {

        private static final long serialVersionUID = 1L;

        @Override//from ww w  . jav  a2  s. c o m
        protected ProjectDto load() {
            // Determine requested project id
            final StringValue projectParameter = getRequest().getRequestParameters()
                    .getParameterValue("project");
            // Load respective project
            ProjectDto activeProject;
            if (projectParameter.isNull()) {
                activeProject = getDefaultProject();
            } else {
                final Long userId = DataMessieSession.get().getUserId();
                activeProject = projectDao.getAsDto(sessionFactory.getCurrentSession(),
                        projectParameter.toLong(), userId);
                if (activeProject == null) {
                    activeProject = getDefaultProject();
                }
            }
            // Ensure project parameter
            if (activeProject != null) {
                getPageParameters().set("project", activeProject.getId());
                DataMessieSession.get().getDocumentsFilterSettings().setProjectId(activeProject.getId());
            }
            // Done
            return activeProject;
        }
    };

    aciveProjectDropDownChoice = new ProjectSelector("activeProjectSelector", activeProjectModel) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSelectionChanged(final ProjectDto newSelection) {
            if (newSelection == null) {
                return;
            }

            final PageParameters projectPageParameters = new PageParameters();
            final Long selectedProjectId = newSelection.getId();
            projectPageParameters.set("project", selectedProjectId);
            final Class<? extends Page> responsePage = AbstractAuthenticatedPage.this.getNavigationLinkClass();
            final PageParameters pageParameters = getDefaultPageParameters(projectPageParameters);
            AbstractAuthenticatedPage.this.setResponsePage(responsePage, pageParameters);
        }

        @Override
        protected boolean wantOnSelectionChangedNotifications() {
            return true;
        }
    };
    add(aciveProjectDropDownChoice);

    // Navigation links
    final List<NavigationLink<? extends Page>> navigationLinks = getDataMessieApplication()
            .getNavigationLinks();
    final ListView<NavigationLink<? extends Page>> navigationLinksListView = new ListView<NavigationLink<? extends Page>>(
            "navigationLinks", navigationLinks) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<NavigationLink<? extends Page>> item) {
            // Link
            final NavigationLink<? extends Page> navigationLink = item.getModelObject();
            final PageParameters projectPageParameters = createProjectPageParameters();
            final BookmarkablePageLink<? extends Page> bookmarkablePageLink = createBookmarkablePageLink(
                    "navigationLink", navigationLink, projectPageParameters);
            final Label bookmarkablePageLinkLabel = new Label("navigationLinkLabel", navigationLink.getLabel());
            // Active link
            if (AbstractAuthenticatedPage.this.getNavigationLinkClass() == navigationLink.getPageClass()) {
                markLinkSelected(bookmarkablePageLink);
            }
            // Done
            bookmarkablePageLink.add(bookmarkablePageLinkLabel);
            item.add(bookmarkablePageLink);
        }
    };
    add(navigationLinksListView);

    // Sign out link
    signOutLink = new Link<SignInPage>("signOutLink") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick() {
            AuthenticatedWebSession.get().invalidate();
            setResponsePage(getApplication().getHomePage());
        }
    };
    add(signOutLink);

    // Side panels
    final List<SidePanel> sidePanels = getDataMessieApplication().getSidePanels();
    final ListView<SidePanel> sidePanelsListView = new ListView<SidePanel>("sidePanels", sidePanels) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<SidePanel> item) {
            // Link
            final SidePanel sidePanel = item.getModelObject();
            final Panel panel = sidePanel.getPanel();
            item.add(panel);
        }
    };
    add(sidePanelsListView);

    // Task executions container
    final WebMarkupContainer taskExecutionsContainer = new WebMarkupContainer("taskExecutionsContainer");
    taskExecutionsContainer.setOutputMarkupId(true);
    taskExecutionsContainer.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(selfUpdatingInterval)));
    add(taskExecutionsContainer);
    // Task executions
    taskExecutionsPanel = new AjaxLazyLoadPanel("taskExecutionsPanel") {
        private static final long serialVersionUID = 1L;

        @Override
        public Component getLazyLoadComponent(final String id) {
            final TaskExecutionsPanel taskExecutionsPanel = new TaskExecutionsPanel(id);
            return taskExecutionsPanel;
        }

    };
    taskExecutionsContainer.add(taskExecutionsPanel);
}

From source file:com.romeikat.datamessie.core.base.ui.page.AbstractDocumentsFilterPage.java

License:Open Source License

private StringValue getParameterValue(final IRequestParameters requestParameters, final String parameterName) {
    final Set<String> requestParameterNames = requestParameters.getParameterNames();
    if (!requestParameterNames.contains(parameterName)) {
        return null;
    }/*from  w  w w .jav  a 2  s .  com*/
    final StringValue parameterValue = requestParameters.getParameterValue(parameterName);
    if (parameterValue.isNull()) {
        return null;
    }
    return parameterValue;
}

From source file:com.romeikat.datamessie.core.view.ui.page.DocumentPage.java

License:Open Source License

private void initialize() {
    // Document/*from   w  ww.j  a v  a  2 s .c  om*/
    documentModel = new LoadableDetachableModel<DocumentDto>() {
        private static final long serialVersionUID = 1L;

        @Override
        public DocumentDto load() {
            final StringValue idParameter = getRequest().getRequestParameters().getParameterValue("id");
            return idParameter.isNull() ? null
                    : documentDao.getAsDto(sessionFactory.getCurrentSession(), idParameter.toLong());
        }
    };
    final DocumentDto document = documentModel.getObject();

    // Table
    final WebMarkupContainer documentWmc = new WebMarkupContainer("document") {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onConfigure() {
            super.onConfigure();
            setVisible(documentModel.getObject() != null);
        }
    };
    add(documentWmc);

    // ID
    final Label idLabel = new Label("idLabel", new PropertyModel<Long>(documentModel, "id"));
    documentWmc.add(idLabel);
    // Title
    final Label titleLabel = new Label("titleLabel", new PropertyModel<String>(documentModel, "title"));
    documentWmc.add(titleLabel);
    // Stemmed title
    final Label stemmedTitleLabel = new Label("stemmedTitleLabel",
            new PropertyModel<String>(documentModel, "stemmedTitle"));
    documentWmc.add(stemmedTitleLabel);
    // URLs
    urlLink = new ExternalLink("urlLink", new PropertyModel<String>(documentModel, "url"),
            new PropertyModel<String>(documentModel, "url"));
    urlLink.setContextRelative(false);
    documentWmc.add(urlLink);
    // Description
    final Label descriptionLabel = new Label("descriptionLabel",
            new PropertyModel<String>(documentModel, "description"));
    documentWmc.add(descriptionLabel);
    // Stemmed description
    final Label stemmedDescriptionLabel = new Label("stemmedDescriptionLabel",
            new PropertyModel<String>(documentModel, "stemmedDescription"));
    documentWmc.add(stemmedDescriptionLabel);
    // Published
    final Label publishedLabel = new Label("publishedLabel",
            new PropertyModel<LocalDateTime>(documentModel, "published"));
    documentWmc.add(publishedLabel);
    // Downloaded
    final Label downloadedLabel = new Label("downloadedLabel",
            new PropertyModel<LocalDateTime>(documentModel, "downloaded"));
    documentWmc.add(downloadedLabel);
    // Link to source
    final PageParameters sourcePageParameters = createProjectPageParameters();
    sourcePageParameters.set("id", document.getSourceId());
    final Label sourceNameLabel = new Label("sourceNameLabel",
            new PropertyModel<String>(documentModel, "sourceName"));
    final Link<SourcePage> sourceLink = new BookmarkablePageLink<SourcePage>("sourceLink", SourcePage.class,
            sourcePageParameters);
    sourceLink.add(sourceNameLabel);
    documentWmc.add(sourceLink);
    // Status code
    final Label statusCodeLabel = new Label("statusCodeLabel",
            new PropertyModel<Integer>(documentModel, "statusCode"));
    documentWmc.add(statusCodeLabel);
    // State
    final Label stateLabel = new Label("stateLabel",
            new PropertyModel<DocumentProcessingState>(documentModel, "state"));
    documentWmc.add(stateLabel);
    // Raw content
    final TextArea<String> rawContentTextArea = new TextArea<String>("rawContentTextArea",
            new PropertyModel<String>(documentModel, "rawContent"));
    documentWmc.add(rawContentTextArea);
    // Cleaned content
    final TextArea<String> cleanedContentTextArea = new TextArea<String>("cleanedContentTextArea",
            new PropertyModel<String>(documentModel, "cleanedContent"));
    documentWmc.add(cleanedContentTextArea);
    // Stemmed content
    final TextArea<String> stemmedContentTextArea = new TextArea<String>("stemmedContentTextArea",
            new PropertyModel<String>(documentModel, "stemmedContent"));
    documentWmc.add(stemmedContentTextArea);
    // Named entities
    final TextArea<String> namedEntitiesTextArea = new TextArea<String>("namedEntitiesTextArea",
            new PropertyModel<String>(documentModel, "namedEntities"));
    documentWmc.add(namedEntitiesTextArea);
}

From source file:com.romeikat.datamessie.core.view.ui.page.SourcePage.java

License:Open Source License

private void initialize() {
    final HibernateSessionProvider sessionProvider = new HibernateSessionProvider(sessionFactory);

    // Source/*from www . j  a v a 2 s . co m*/
    final StringValue idParameter = getRequest().getRequestParameters().getParameterValue("id");
    final Long userId = DataMessieSession.get().getUserId();
    final SourceDto source = idParameter.isNull() ? null
            : sourceDao.getAsDto(sessionProvider.getStatelessSession(), userId, idParameter.toLong());
    // Model cannot be a LoadableDetachableModel as the contained DTO will be edited across
    // multiple Ajax requests (by RedirectingRulesPanel and TagSelectingRulesPanel)
    sourceModel = new Model<SourceDto>(source) {
        private static final long serialVersionUID = 1L;

        @Override
        public SourceDto getObject() {
            final SourceDto oldSource = super.getObject();
            // If a valid new source is requested, return that one
            final StringValue idParameter = getRequest().getRequestParameters().getParameterValue("id");
            if (!idParameter.isNull() && oldSource != null) {
                if (oldSource.getId() != idParameter.toLong()) {
                    final HibernateSessionProvider sessionProvider = new HibernateSessionProvider(
                            sessionFactory);
                    final SourceDto newSource = sourceDao.getAsDto(sessionProvider.getStatelessSession(),
                            userId, idParameter.toLong());
                    sessionProvider.closeStatelessSession();
                    if (newSource != null) {
                        return newSource;
                    }
                }
            }
            // Return old source
            return oldSource;
        }
    };

    // Form
    final Form<SourceDto> sourceForm = new Form<SourceDto>("source",
            new CompoundPropertyModel<SourceDto>(sourceModel)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit() {
            final HibernateSessionProvider sessionProvider = new HibernateSessionProvider(sessionFactory);
            new ExecuteWithTransaction(sessionProvider.getStatelessSession()) {
                @Override
                protected void execute(final StatelessSession statelessSession) {
                    sourceService.updateSource(statelessSession, getModelObject());
                }
            }.execute();
            sessionProvider.closeStatelessSession();
        }

        @Override
        protected void onConfigure() {
            super.onConfigure();
            setVisible(getModelObject() != null);
        }
    };
    add(sourceForm);

    // ID
    final Label idLabel = new Label("id");
    sourceForm.add(idLabel);
    // Name
    final TextField<String> nameTextField = new TextField<String>("name");
    sourceForm.add(nameTextField);
    // Language
    final Label languageLabel = new Label("language");
    sourceForm.add(languageLabel);
    // Types
    final SourceTypeChoice typesChoice = new SourceTypeChoice("types").setWidth(320);
    sourceForm.add(typesChoice);
    // URL
    final TextField<String> urlTextField = new TextField<String>("url");
    sourceForm.add(urlTextField);
    // Link to URL
    final ExternalLink urlLink = new ExternalLink("urlLink", new PropertyModel<String>(sourceModel, "url"));
    sourceForm.add(urlLink);
    // URL extracting rules
    final IModel<List<RedirectingRuleDto>> redirectingRulesModel = new PropertyModel<List<RedirectingRuleDto>>(
            sourceModel, "redirectingRules");
    final RedirectingRulesPanel redirectingRulesPanel = new RedirectingRulesPanel("redirectingRules",
            redirectingRulesModel);
    sourceForm.add(redirectingRulesPanel);
    // Tag selecting rules
    final IModel<List<TagSelectingRuleDto>> tagSelectingRulesModel = new PropertyModel<List<TagSelectingRuleDto>>(
            sourceModel, "tagSelectingRules");
    final TagSelectingRulesPanel tagSelectingRulesPanel = new TagSelectingRulesPanel("tagSelectingRules",
            tagSelectingRulesModel);
    sourceForm.add(tagSelectingRulesPanel);
    // Visible
    final CheckBox visibleCheckBox = new CheckBox("visible");
    sourceForm.add(visibleCheckBox);

    sessionProvider.closeStatelessSession();
}