@Test public void testFormatItemList() { DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings() .dataset(EXPENSES) .group(COLUMN_DEPARTMENT) .column(COLUMN_DEPARTMENT) .column(COLUMN_ID, AggregateFunctionType.COUNT) .filterOn(false, true, true) .multiple(true) .width(90) .buildSettings(); SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList); String result = presenter.formatItemList(Arrays.asList("Sales", "Management", "IT"), 200); assertEquals(result, "Sales, Management, IT "); result = presenter.formatItemList(Arrays.asList("Sales", "Management", "IT")); assertEquals(result, "Sales, Management, IT "); result = presenter.formatItemList(Arrays.asList("Sales", "Management", "IT"), 150); assertEquals(result, "Sales, Managemen..."); result = presenter.formatItemList(Arrays.asList("Sales", "Management", "IT"), 130); assertEquals(result, "Sales, Managem..."); result = presenter.formatItemList(Arrays.asList("Sales", "Management", "IT"), 60); assertEquals(result, "Sales ..."); result = presenter.formatItemList(Arrays.asList("Sales", "Management", "IT"), 10); assertEquals(result, "S..."); }
public String formatItemList(List<String> itemList) { StringBuffer out = new StringBuffer(); for (String item : itemList) { if (out.length() > 0) { out.append(", "); } out.append(item); } return out.toString() + " "; }
SelectorDropDownDisplayer extends AbstractErraiDisplayer<SelectorDropDownDisplayer.View> { public String formatItemList(List<String> itemList) { StringBuffer out = new StringBuffer(); for (String item : itemList) { if (out.length() > 0) { out.append(", "); } out.append(item); } return out.toString() + " "; } }
SelectorDropDownDisplayer extends AbstractErraiDisplayer<SelectorDropDownDisplayer.View> { public String formatItemList(List<String> itemList) { StringBuffer out = new StringBuffer(); for (String item : itemList) { if (out.length() > 0) { out.append(", "); } out.append(item); } return out.toString() + " "; } @Inject  SelectorDropDownDisplayer(View view, SyncBeanManager beanManager); }
SelectorDropDownDisplayer extends AbstractErraiDisplayer<SelectorDropDownDisplayer.View> { public String formatItemList(List<String> itemList) { StringBuffer out = new StringBuffer(); for (String item : itemList) { if (out.length() > 0) { out.append(", "); } out.append(item); } return out.toString() + " "; } @Inject  SelectorDropDownDisplayer(View view, SyncBeanManager beanManager); @Override View getView(); @Override void close(); @Override DisplayerConstraints createDisplayerConstraints(); String getFirstColumnId(); String getFirstColumnName(); String formatItemList(List<String> itemList); String formatItemList(List<String> itemList, int maxWidth); }
SelectorDropDownDisplayer extends AbstractErraiDisplayer<SelectorDropDownDisplayer.View> { public String formatItemList(List<String> itemList) { StringBuffer out = new StringBuffer(); for (String item : itemList) { if (out.length() > 0) { out.append(", "); } out.append(item); } return out.toString() + " "; } @Inject  SelectorDropDownDisplayer(View view, SyncBeanManager beanManager); @Override View getView(); @Override void close(); @Override DisplayerConstraints createDisplayerConstraints(); String getFirstColumnId(); String getFirstColumnName(); String formatItemList(List<String> itemList); String formatItemList(List<String> itemList, int maxWidth);  }