Example usage for org.apache.wicket.util.string Strings isEmpty

List of usage examples for org.apache.wicket.util.string Strings isEmpty

Introduction

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

Prototype

public static boolean isEmpty(final CharSequence string) 

Source Link

Document

Checks whether the string is considered empty.

Usage

From source file:com.vk.bingmaps.api.obj.BMapOptions.java

License:Apache License

public BMapOptions(String credentials) {
    if (Strings.isEmpty(credentials))
        throw new IllegalArgumentException("BingMaps API Key cannot be null");
    this.credentials = credentials;
}

From source file:com.vk.bingmaps.api.obj.BPushpin.java

License:Apache License

@Override
protected void updateOnAjaxCall(AjaxRequestTarget target, BEvent overlayEvent) {
    Request request = RequestCycle.get().getRequest();
    String loc = request.getParameter("overlay.location");
    if (!Strings.isEmpty(loc)) {
        this.location = BLocation.parse(loc);
    } else {/*from   w w  w . ja v  a2s . c  o m*/
        //TODO warn
    }
}

From source file:com.wiquery.plugins.jqgrid.component.XMLDataRequestTarget.java

License:Apache License

/**
 * Adds a component to the list of components to be rendered
 * //  ww w  .j  av  a  2 s.  com
 * @param markupId
 *            id of client-side dom element that will be updated
 * 
 * @param component
 *            component to be rendered
 */
public final void addComponent(Component component, String markupId) {
    if (Strings.isEmpty(markupId)) {
        throw new IllegalArgumentException("markupId cannot be empty");
    }
    if (component == null) {
        throw new IllegalArgumentException("component cannot be null");
    } else if (component instanceof Page) {
        if (component != page) {
            throw new IllegalArgumentException("component cannot be a page");
        }
    } else if (component instanceof AbstractRepeater) {
        throw new IllegalArgumentException("Component " + component.getClass().getName()
                + " has been added to the target. This component is a repeater and cannot be repainted via ajax directly. Instead add its parent or another markup container higher in the hierarchy.");
    }

    component.setMarkupId(markupId);
    markupIdToComponent.put(markupId, component);
}

From source file:com.wiquery.plugins.jqgrid.component.XMLDataRequestTarget.java

License:Apache License

/**
 * Returns the HTML id of the last focused element.
 * //from  w  w w .  j a v a  2s.c  o m
 * @return markup id of last focused element, <code>null</code> if none
 */
public String getLastFocusedElementId() {
    String id = ((WebRequestCycle) RequestCycle.get()).getWebRequest().getHttpServletRequest()
            .getHeader("Wicket-FocusedElementId");
    return Strings.isEmpty(id) ? null : id;
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.administration.AdminManagePersonPage.java

License:Apache License

private void addPersonField(final PersonForm form) {

    // added autocomplete textfield for subject
    AutoCompleteSettings settings = prepareAutoCompleteSettings();

    AbstractAutoCompleteTextRenderer<Person> renderer = new AbstractAutoCompleteTextRenderer<Person>() {

        private static final long serialVersionUID = 1L;

        @Override/*from   ww  w. ja va 2s  . c  om*/
        protected String getTextValue(Person object) {
            return object.getAutoCompleteData();
        }
    };

    final AutoCompleteTextField<Person> personField = new AutoCompleteTextField<Person>("personField",
            new Model<Person>(), Person.class, renderer, settings) {

        private static final long serialVersionUID = 1L;

        @Override
        protected Iterator<Person> getChoices(String input) {
            List<Person> choices;
            List<Person> allChoices = personFacade.getAllRecords();

            if (Strings.isEmpty(input)) {
                choices = allChoices;
            } else {

                choices = new ArrayList<Person>(10);
                for (Person t : allChoices) {
                    if ((t.getAutoCompleteData() != null)
                            && t.getAutoCompleteData().toLowerCase().contains(input.toLowerCase())
                            || t.getAutoCompleteData().toLowerCase().startsWith(input.toLowerCase())) {
                        choices.add(t);
                    }
                }
            }
            Collections.sort(choices);
            return choices.iterator();
        }
    };

    personField.setLabel(ResourceUtils.getModel("label.subjectPerson"));
    personField.add(new AjaxFormComponentUpdatingBehavior("onChange") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {

            Person person = personField.getModelObject();
            if (person.getPersonId() != 0) {
                form.setModelObject(person);
                form.setVisible(true);
            }

            target.add(getFeedback(), form);
        }
    });
    Form<Void> selectForm = new Form<Void>("selectForm");
    add(selectForm.add(personField));
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.experiments.converters.DiseaseConverter.java

License:Apache License

@Override
public Disease convertToObject(String s, Locale locale) {
    if (Strings.isEmpty(s)) {
        return null;
    }/* w ww.j  a va2  s.c o m*/

    List<Disease> diseases = diseaseFacade.readByParameter("title", s);
    return (diseases != null && diseases.size() > 0) ? diseases.get(0) : new Disease();

}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.experiments.converters.HardwareConverter.java

License:Apache License

@Override
public Hardware convertToObject(String s, Locale locale) {
    if (Strings.isEmpty(s)) {
        return null;
    }/*www.  j  ava2  s.  c  o  m*/

    List<Hardware> hardwares = hardwareFacade.readByParameter("title", s);
    return (hardwares != null && hardwares.size() > 0) ? hardwares.get(0) : new Hardware();

}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.experiments.converters.PersonConverter.java

License:Apache License

@Override
public Person convertToObject(String s, Locale locale) {
    if (Strings.isEmpty(s)) {
        return null;
    }/*from  w  w  w. ja  v  a  2 s .co m*/

    String[] datas = s.split(" ");
    String name = datas[datas.length - 1];

    List<Person> persons = personFacade.readByParameter("username", name);
    Person person = new Person();
    person.setUsername(name);

    return (persons != null && persons.size() > 0) ? persons.get(0) : person;
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.experiments.converters.PharmaceuticalConverter.java

License:Apache License

@Override
public Pharmaceutical convertToObject(String s, Locale locale) {
    if (Strings.isEmpty(s)) {
        return null;
    }/*www .ja  v a 2  s .c o m*/

    List<Pharmaceutical> pharmaceuticals = pharmaceuticalFacade.readByParameter("title", s);
    return (pharmaceuticals != null && pharmaceuticals.size() > 0) ? pharmaceuticals.get(0)
            : new Pharmaceutical();
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.experiments.converters.ProjectTypeConverter.java

License:Apache License

@Override
public ProjectType convertToObject(String s, Locale locale) {
    if (Strings.isEmpty(s)) {
        return null;
    }//w  w w .j a  va  2  s  . c o m

    List<ProjectType> projectTypes = projectTypeFacade.readByParameter("title", s);
    return (projectTypes != null && projectTypes.size() > 0) ? projectTypes.get(0) : new ProjectType();

}