Example usage for org.apache.wicket.util.string AppendingStringBuffer lastIndexOf

List of usage examples for org.apache.wicket.util.string AppendingStringBuffer lastIndexOf

Introduction

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

Prototype

public int lastIndexOf(final String str) 

Source Link

Document

Returns the index within this string of the rightmost occurrence of the specified substring.

Usage

From source file:com.norconex.jefmon.settings.panels.JobLocationsPanel.java

License:Apache License

private ListMultipleChoice<File> buildLocationsSelect(String markupId) {
    final ListMultipleChoice<File> lc = new ListMultipleChoice<File>(markupId, new ListModel<File>(),
            locations) {/*from   w w  w.ja v  a2s .co  m*/
        private static final long serialVersionUID = 7754249758151817399L;

        @Override
        protected CharSequence getDefaultChoice(String selected) {
            return "";
        }

        @Override
        protected void appendOptionHtml(AppendingStringBuffer buffer, File file, int index, String selected) {
            super.appendOptionHtml(buffer, file, index, selected);
            if (file == null) {
                return;
            }
            String icon = "nx-file-icon";
            if (file.isDirectory()) {
                icon = "nx-folder-icon";
            }
            buffer.insert(buffer.lastIndexOf("\">") + 1, " class=\"" + icon + "\"");
        }
    };
    lc.setMaxRows(7);
    lc.setOutputMarkupId(true);
    lc.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        private static final long serialVersionUID = -6508661554028761884L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            adjustButtonVisibility(target);
        }
    });

    return lc;
}