Example usage for org.apache.commons.lang3.mutable MutableInt toString

List of usage examples for org.apache.commons.lang3.mutable MutableInt toString

Introduction

In this page you can find the example usage for org.apache.commons.lang3.mutable MutableInt toString.

Prototype

@Override
public String toString() 

Source Link

Document

Returns the String value of this mutable.

Usage

From source file:com.norconex.jefmon.instances.InstancesPanel.java

private ListView<JobState> createJobStateListView(final InstanceSummary instance) {
    return new ListView<JobState>("statuses", Arrays.asList(STATUSES)) {
        private static final long serialVersionUID = -716585245859081922L;

        @Override/*from   ww w.jav a 2  s  .c om*/
        protected void populateItem(ListItem<JobState> item) {
            JobState status = item.getModelObject();
            MutableInt count = instance.getStatuses().get(status);
            if (count == null) {
                count = new MutableInt(0);
            }
            String css = "";
            if (instance.isInvalid()) {
                css = "fa fa-exclamation-circle nx-jef-status-error";
            } else if (status == null || count.getValue() == 0) {
                css = "jef-tree-job-blank";
            } else {
                switch (status) {
                case COMPLETED:
                    css = "fa fa-check-circle nx-jef-status-ok";
                    break;
                case RUNNING:
                    css = "fa fa-spinner fa-spin nx-jef-status-running";
                    break;
                default:
                    css = "fa fa-exclamation-circle nx-jef-status-error";
                    break;
                }
            }

            Label icon = new Label("statusIcon");
            icon.add(new CssClass(css));
            String countLabel = count.toString();
            if (instance.isInvalid()) {
                icon.setVisible(false);
                countLabel = StringUtils.EMPTY;
            }
            item.add(new Label("statusCount", countLabel));
            item.add(icon);
        }
    };
}