@SuppressWarnings("unchecked") protected void handleMouseDown(ListViewEvent<M> e) { if (locked) return; M sel = listStore.getAt(e.getIndex()); if (isSelected(sel) && !e.isControlKey()) { return; } if (selectionMode == SelectionMode.SINGLE) { if (isSelected(sel) && e.isControlKey()) { deselect(sel); } else if (!isSelected(sel)) { select(sel, false); } } else { if (e.isShiftKey() && lastSelected != null) { int last = listStore.indexOf(lastSelected); int index = e.getIndex(); int a = (last > index) ? index : last; int b = (last < index) ? index : last; select(a, b, e.isControlKey()); lastSelected = listStore.getAt(last); listView.focusItem(index); // view.focusRow(index); } else if (isSelected(sel) && e.isControlKey()) { doDeselect(Arrays.asList(sel), false); } else { doSelect(Arrays.asList(sel), e.isControlKey(), false); listView.focusItem(e.getIndex()); // view.focusRow(e.rowIndex); } } }
/** * Populates runs * * @param models * @param enabled : is combobox enabled */ @Override public void setModels(List<RunModel> models, boolean enabled) { if (models.size() > 0) { storeName.add(models); cbName.setValue(storeName.getAt(0)); } cbName.setEnabled(enabled); }
public ListStore<ModelData> getGroupComboStore(ListStore<BeanModel> sourceStore) { if (sourceGrid != null && groupCombo != null) return groupCombo.getStore(); if (sourceStore.getCount() > 0) { ListStore<ModelData> groupStore = new ListStore<ModelData>(); ModelData model; SortedSet<String> properties = new TreeSet<String>(); for (String property : sourceStore.getAt(0).getPropertyNames()) properties.add(property); for (String property : properties) { model = new BaseModelData(); model.set("value", property); model.set("description", getPropertyHeader(property)); groupStore.add(model); } return groupStore; } else return getGroupComboStore(); }
public void testSortSubTypes() { ComplexTypeModel dataType = new ComplexTypeModel("typeEDA", DataTypeConstants.STRING); ComplexTypeModel typeEDA = new ComplexTypeModel("typeEDA", null); typeEDA.setOrderValue(0); dataType.addComplexReusableTypes(typeEDA); ComplexTypeModel balit = new ComplexTypeModel("Balit", null); balit.setOrderValue(1); dataType.addComplexReusableTypes(balit); ComplexTypeModel pointEchange = new ComplexTypeModel("PointEchange", null); pointEchange.setOrderValue(3); dataType.addComplexReusableTypes(pointEchange); ComplexTypeModel secoursMutuelGrt = new ComplexTypeModel("SecoursMutuelGrt", null); secoursMutuelGrt.setOrderValue(2); dataType.addComplexReusableTypes(secoursMutuelGrt); ComplexTypeModel pointSoutirageJumeleRpd = new ComplexTypeModel("PointSoutirageJumeleRpd", null); pointSoutirageJumeleRpd.setOrderValue(9); dataType.addComplexReusableTypes(pointSoutirageJumeleRpd); ComplexTypeModel pointSoutirageRpt = new ComplexTypeModel("PointSoutirageRpt", null); pointSoutirageRpt.setOrderValue(4); dataType.addComplexReusableTypes(pointSoutirageRpt); ComplexTypeModel pointInjectionRptRpd = new ComplexTypeModel("PointInjectionRptRpd", null); pointInjectionRptRpd.setOrderValue(13); dataType.addComplexReusableTypes(pointInjectionRptRpd); ComplexTypeModel pointSoutirageRpd = new ComplexTypeModel("PointSoutirageRpd", null); pointSoutirageRpd.setOrderValue(5); dataType.addComplexReusableTypes(pointSoutirageRpd); ComplexTypeModel pointSoutirageProfile = new ComplexTypeModel("PointSoutirageProfile", null); pointSoutirageProfile.setOrderValue(7); dataType.addComplexReusableTypes(pointSoutirageProfile); ComplexTypeModel pointInjectionRpt = new ComplexTypeModel("PointInjectionRpt", null); pointInjectionRpt.setOrderValue(11); dataType.addComplexReusableTypes(pointInjectionRpt); ComplexTypeModel pointInjectionRpd = new ComplexTypeModel("PointInjectionRpd", null); pointInjectionRpd.setOrderValue(12); dataType.addComplexReusableTypes(pointInjectionRpd); ComplexTypeModel pointSoutirageJumeleRpt = new ComplexTypeModel("PointSoutirageJumeleRpt", null); pointSoutirageJumeleRpt.setOrderValue(8); dataType.addComplexReusableTypes(pointSoutirageJumeleRpt); ComplexTypeModel pointSoutirageRptRpd = new ComplexTypeModel("PointSoutirageRptRpd", null); pointSoutirageRptRpd.setOrderValue(6); dataType.addComplexReusableTypes(pointSoutirageRptRpd); ComplexTypeModel pointSoutirageJumeleRptRpd = new ComplexTypeModel("PointSoutirageJumeleRptRpd", null); pointSoutirageJumeleRptRpd.setOrderValue(10); dataType.addComplexReusableTypes(pointSoutirageJumeleRptRpd); ItemNodeModel node = new ItemNodeModel(); node.setRealType("Eda/typesEda/typeEDA"); Map<String, String> labelMap = new HashMap<String, String>(); labelMap.put("en", "typeEDA"); dataType.setLabelMap(labelMap); Field field = TreeDetailGridFieldCreator.createField( node, dataType, "en", new HashMap<String, Field<?>>(), null, null); assertNotNull(field); assertTrue(field instanceof ComboBoxField); ComboBoxField<ComboBoxModel> comboxField = (ComboBoxField<ComboBoxModel>) field; ListStore<ComboBoxModel> reusableTypes = comboxField.getStore(); assertNotNull(reusableTypes); assertEquals( "typeEDA", ((ComplexTypeModel) reusableTypes.getAt(0).get("reusableType")).getName()); assertEquals( "Balit", ((ComplexTypeModel) reusableTypes.getAt(1).get("reusableType")).getName()); assertEquals( "SecoursMutuelGrt", ((ComplexTypeModel) reusableTypes.getAt(2).get("reusableType")).getName()); assertEquals( "PointEchange", ((ComplexTypeModel) reusableTypes.getAt(3).get("reusableType")).getName()); assertEquals( "PointSoutirageRpt", ((ComplexTypeModel) reusableTypes.getAt(4).get("reusableType")).getName()); assertEquals( "PointSoutirageRpd", ((ComplexTypeModel) reusableTypes.getAt(5).get("reusableType")).getName()); assertEquals( "PointSoutirageRptRpd", ((ComplexTypeModel) reusableTypes.getAt(6).get("reusableType")).getName()); assertEquals( "PointSoutirageProfile", ((ComplexTypeModel) reusableTypes.getAt(7).get("reusableType")).getName()); assertEquals( "PointSoutirageJumeleRpt", ((ComplexTypeModel) reusableTypes.getAt(8).get("reusableType")).getName()); assertEquals( "PointSoutirageJumeleRpd", ((ComplexTypeModel) reusableTypes.getAt(9).get("reusableType")).getName()); assertEquals( "PointSoutirageJumeleRptRpd", ((ComplexTypeModel) reusableTypes.getAt(10).get("reusableType")).getName()); assertEquals( "PointInjectionRpt", ((ComplexTypeModel) reusableTypes.getAt(11).get("reusableType")).getName()); assertEquals( "PointInjectionRpd", ((ComplexTypeModel) reusableTypes.getAt(12).get("reusableType")).getName()); assertEquals( "PointInjectionRptRpd", ((ComplexTypeModel) reusableTypes.getAt(13).get("reusableType")).getName()); }