public VoteListGrid() { super(); // initialize the List Grid fields ListGridField iconField = new ListGridField(ICON, ICON_DISPLAY_NAME, ICON_COLUMN_LENGTH); iconField.setImageSize(16); iconField.setAlign(Alignment.CENTER); iconField.setType(ListGridFieldType.IMAGE); iconField.setImageURLPrefix(URL_PREFIX); iconField.setImageURLSuffix(URL_SUFFIX); ListGridField voteCodeField = new ListGridField(VOTE_CODE, VOTE_CODE_DISPLAY); voteCodeField.setWidth("20%"); ListGridField voteNameField = new ListGridField(VOTE_NAME, VOTE_NAME_DISPLAY); voteNameField.setWidth("20%"); ListGridField voteIDField = new ListGridField(VOTE_ID, VOTE_ID_DISPLAY); voteIDField.setHidden(true); ListGridField createdByField = new ListGridField(CREATED_BY, CREATED_BY_DISPLAY); createdByField.setWidth("20%"); ListGridField changedByField = new ListGridField(CHANGED_BY, CHANGED_BY_DISPLAY); changedByField.setWidth("20%"); ListGridField emptyField = new ListGridField(EMPTY_FIELD, EMPTY_FIELD_DISPLAY_NAME); this.setCanPickFields(false); this.setShowRowNumbers(true); this.setFields(voteIDField, voteNameField, voteCodeField, createdByField, changedByField); }
private ListGridField createIconField() { ListGridField iconField = new ListGridField("icon", " ", 28); iconField.setShowDefaultContextMenu(false); iconField.setCanSort(false); iconField.setAlign(Alignment.CENTER); iconField.setType(ListGridFieldType.IMAGE); iconField.setImageURLSuffix("_16.png"); iconField.setImageWidth(16); iconField.setImageHeight(16); return iconField; }
public ResourceLookupComboBoxItem(String name, String title) { super(name, title); setHint(MSG.widget_resourceSelector_selectResource()); setShowHintInField(false); setOptionDataSource(new ResourceDatasource()); ListGridField nameField = new ListGridField("name", MSG.common_title_name(), 250); nameField.setShowHover(true); nameField.setHoverCustomizer( new HoverCustomizer() { public String hoverHTML( Object value, ListGridRecord listGridRecord, int rowNum, int colNum) { return AncestryUtil.getResourceHoverHTML(listGridRecord, 0); } }); ListGridField ancestryField = new ListGridField(AncestryUtil.RESOURCE_ANCESTRY, MSG.common_title_ancestry(), 300); // needs to use a different cell formatter than what AncestryUtil.setupAncestryListGridField // creates ancestryField.setCellFormatter( new CellFormatter() { public String format(Object o, ListGridRecord listGridRecord, int rowNum, int colNum) { return AncestryUtil.getAncestryValue(listGridRecord, false); } }); AncestryUtil.setupAncestryListGridFieldHover(ancestryField); ListGridField descriptionField = new ListGridField("description", MSG.common_title_description()); ListGridField categoryField = new ListGridField("category", MSG.common_title_category(), 60); ListGridField availabilityField = new ListGridField("currentAvailability", MSG.common_title_availability(), 55); availabilityField.setAlign(Alignment.CENTER); setPickListFields(nameField, ancestryField, descriptionField, categoryField, availabilityField); setValueField("id"); setDisplayField("name"); setPickListWidth(800); setTextMatchStyle(TextMatchStyle.SUBSTRING); setCompleteOnTab(true); setAddUnknownValues(false); }
/** * Create a single field definition from a attribute definition. * * @param attributeInfo attribute info * @return field for grid */ private ListGridField createAttributeGridField(final AttributeInfo attributeInfo) { ListGridField gridField = new ListGridField(attributeInfo.getName(), attributeInfo.getLabel()); gridField.setAlign(Alignment.LEFT); gridField.setCanEdit(false); gridField.setShowIfCondition( new IdentifyingListGridFieldIfFunction(attributeInfo.isIdentifying())); if (attributeInfo instanceof PrimitiveAttributeInfo) { PrimitiveAttributeInfo info = (PrimitiveAttributeInfo) attributeInfo; if (info.getType().equals(PrimitiveType.BOOLEAN)) { gridField.setType(ListGridFieldType.BOOLEAN); } else if (info.getType().equals(PrimitiveType.STRING)) { gridField.setType(ListGridFieldType.TEXT); } else if (info.getType().equals(PrimitiveType.DATE)) { gridField.setType(ListGridFieldType.DATE); } else if (info.getType().equals(PrimitiveType.SHORT)) { gridField.setType(ListGridFieldType.INTEGER); } else if (info.getType().equals(PrimitiveType.INTEGER)) { gridField.setType(ListGridFieldType.INTEGER); } else if (info.getType().equals(PrimitiveType.LONG)) { gridField.setType(ListGridFieldType.INTEGER); } else if (info.getType().equals(PrimitiveType.FLOAT)) { gridField.setType(ListGridFieldType.FLOAT); } else if (info.getType().equals(PrimitiveType.DOUBLE)) { gridField.setType(ListGridFieldType.FLOAT); } else if (info.getType().equals(PrimitiveType.IMGURL)) { gridField.setType(ListGridFieldType.IMAGE); if (showImageAttributeOnHover) { addCellOverHandler(new ImageCellHandler(attributeInfo)); } } else if (info.getType().equals(PrimitiveType.CURRENCY)) { gridField.setType(ListGridFieldType.TEXT); } else if (info.getType().equals(PrimitiveType.URL)) { gridField.setType(ListGridFieldType.TEXT); gridField.setAttribute("text-decoration", "underline"); addCellClickHandler(new UrlCellHandler(attributeInfo)); } } else if (attributeInfo instanceof AssociationAttributeInfo) { gridField.setType(ListGridFieldType.TEXT); } return gridField; }
/** Actually create or update the fields. */ private void updateFields() { if (featureInfo != null) { // Create a header field for each attribute definition: List<ListGridField> fields = new ArrayList<ListGridField>(); if (idInTable) { ListGridField gridField = new ListGridField(ID_NAME, "ID"); gridField.setAlign(Alignment.LEFT); gridField.setCanEdit(false); fields.add(gridField); } for (AttributeInfo attributeInfo : featureInfo.getAttributes()) { if (!attributeInfo.isHidden() && (attributeInfo.isIdentifying() || allAttributesDisplayed)) { fields.add(createAttributeGridField(attributeInfo)); } } setFields(fields.toArray(new ListGridField[fields.size()])); setCanResizeFields(true); } }
@Override public void setDataSource(final DataSource datasource) { super.setDataSource(datasource); final Criterion levelcriterion = new Criterion(MillerTreeView.LEVEL, OperatorId.EQUALS, level); if (level != 0) { final Criterion parentcriterion = new Criterion(MillerTreeView.PARENT_ID, OperatorId.EQUALS, 0); levelcriterion.addCriteria(parentcriterion); } filterData(levelcriterion); final ArrayList<ListGridField> newfields = new ArrayList<ListGridField>(); for (final ListField field : ListField.values()) { final ListGridField newfield = new ListGridField(field.toString()); newfield.setTitle(Integer.toString(level)); newfield.setAlign(Alignment.LEFT); hideField(field.toString()); newfields.add(newfield); } setFields(newfields.toArray(new ListGridField[0])); }
private void init() { this.ownRulesGrid = new OwnRulesListGrid(); this.otherRulesGrid = new OtherUserRulesListGrid(); // grid fields ListGridField typeField = new ListGridField(EDIT_RULES_TYPE, i18n.type()); typeField.setWidth(60); typeField.setAlign(Alignment.CENTER); ListGridField nameField = new ListGridField(EDIT_RULES_NAME, i18n.name()); nameField.setAlign(Alignment.CENTER); ListGridField descriptionField = new ListGridField(EDIT_RULES_DESCRIPTION, i18n.description()); descriptionField.setAlign(Alignment.CENTER); ListGridField editField = new ListGridField(EDIT_RULES_EDIT, i18n.edit()); editField.setWidth(110); editField.setCanFilter(false); editField.setAlign(Alignment.CENTER); ListGridField publishField = new ListGridField(EDIT_RULES_PUBLISHED, i18n.publishButton()); publishField.setWidth(130); publishField.setCanFilter(false); publishField.setAlign(Alignment.CENTER); ListGridField deleteField = new ListGridField(EDIT_RULES_DELETE, i18n.delete()); deleteField.setWidth(110); deleteField.setCanFilter(false); deleteField.setAlign(Alignment.CENTER); ListGridField copyField = new ListGridField(EDIT_RULES_COPY, i18n.copy()); copyField.setWidth(110); copyField.setCanFilter(false); copyField.setAlign(Alignment.CENTER); // fill grid with rows and data ListGridField[] ownRulesFields = new ListGridField[] { typeField, nameField, descriptionField, editField, publishField, deleteField }; this.ownRulesGrid.setFields(ownRulesFields); this.ownRulesGrid.setCanResizeFields(false); ListGridField[] otherRulesfields = new ListGridField[] {typeField, nameField, descriptionField, copyField}; this.otherRulesGrid.setDefaultFields(otherRulesfields); this.otherRulesGrid.setCanResizeFields(false); this.form.setFields(this.headerItem); DynamicForm headerForm1 = new DynamicForm(); HeaderItem header1 = new HeaderItem(); header1.setDefaultValue(i18n.ownRules()); headerForm1.setItems(header1); DynamicForm headerForm2 = new DynamicForm(); HeaderItem header2 = new HeaderItem(); header2.setDefaultValue(i18n.otherRules()); headerForm2.setItems(header2); // add to mainLayout addMember(this.form); addMember(this.spacer); addMember(headerForm1); addMember(this.ownRulesGrid); addMember(this.spacer); addMember(headerForm2); addMember(this.otherRulesGrid); }
public ListaVentas(final Sgc_capa_web mainWindow) { String PATH_IMG = "/sgc_capa_web/images/"; VLayout layout = new VLayout(10); layout.setBackgroundColor("#006633"); final ListGrid facturaGrid = new ListGrid(); facturaGrid.setWidth(500); facturaGrid.setHeight(224); facturaGrid.setShowAllRecords(true); facturaGrid.setAlternateRecordStyles(true); facturaGrid.setShowEdges(true); facturaGrid.setBorder("0px"); facturaGrid.setBodyStyleName("normal"); facturaGrid.setLeaveScrollbarGap(false); facturaGrid.setBackgroundColor("#99ffcc"); /*-Buscar ------------------------------*/ DynamicForm buscarFields = new DynamicForm(); // buscarFields.setBackgroundColor("#99ffcc"); buscarFields.setItemLayout(FormLayoutType.ABSOLUTE); final TextItem codigoText = new TextItem("codigo"); codigoText.setWrapTitle(false); codigoText.setLeft(10); codigoText.setWidth(43); codigoText.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if ("Enter".equals(event.getKeyName())) { /* buscar por el campo correspondiente */ if (codigoText.getValue() != null) { Factura factura = new Factura(); factura.setId(Integer.parseInt(codigoText.getValue().toString())); listar(facturaGrid, factura, "codigo"); } } } }); ButtonItem buscarButton = new ButtonItem("find", ""); buscarButton.setIcon("view.png"); buscarButton.setWidth(50); buscarButton.setLeft(443); buscarButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { /* buscar por el campo correspondiente */ Factura factura = new Factura(); if (codigoText.getValue() != null) factura.setId(Integer.parseInt(codigoText.getValue().toString())); /*if(nombreusuarioText.getValue() != null) cliente.setNombreusuario(nombreusuarioText.getValue().toString());*/ listar(facturaGrid, factura, "nombre"); } }); buscarFields.setFields(codigoText, buscarButton); /*--------------------------------------*/ ListGridField codigoField = new ListGridField("codigo", "Codigo"); ListGridField fechaField = new ListGridField("fecha", "Fecha"); ListGridField numeroField = new ListGridField("numero", "Numero"); ListGridField pendienteField = new ListGridField("pendiente", "Pendiente"); ListGridField saldoField = new ListGridField("saldo", "Saldo"); ListGridField editarField = new ListGridField("edit", "Editar"); ListGridField borrarField = new ListGridField("remove", "Borrar"); codigoField.setAlign(Alignment.CENTER); editarField.setAlign(Alignment.CENTER); borrarField.setAlign(Alignment.CENTER); editarField.setType(ListGridFieldType.IMAGE); borrarField.setType(ListGridFieldType.IMAGE); editarField.setImageURLPrefix(PATH_IMG); borrarField.setImageURLPrefix(PATH_IMG); editarField.setImageURLSuffix(".png"); borrarField.setImageURLSuffix(".png"); facturaGrid.addCellClickHandler( new CellClickHandler() { @Override public void onCellClick(CellClickEvent event) { ListGridRecord record = event.getRecord(); int col = event.getColNum(); if (col > 4) { Factura factura = new Factura(); factura.setId(record.getAttributeAsInt("codigo")); factura.setFecha(record.getAttributeAsDate("fecha")); factura.setNumero(Integer.parseInt(record.getAttribute("numero"))); factura.setPendiente(record.getAttribute("pendiente")); factura.setSaldo(Double.parseDouble(record.getAttribute("saldo"))); if (col == 5) { /* Editar */ new VentaDetalle(factura, mainWindow); } else { /* Borrar */ FacturaServiceAsync service = GWT.create(FacturaService.class); ServiceDefTarget serviceDef = (ServiceDefTarget) service; serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() + "facturaService"); try { service.eliminar( record.getAttributeAsInt("codigo"), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert( "Ocurrio un error y no se puedo eliminar (objeto referenciado)"); // " // + // caught.getClass().getName() + " " + caught.getMessage()) ; } @Override public void onSuccess(Void result) { new ListaVentas(mainWindow); } }); } catch (NumberFormatException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } } }); codigoField.setWidth(50); fechaField.setWidth(180); numeroField.setWidth(50); pendienteField.setWidth(50); saldoField.setWidth(50); facturaGrid.setFields( codigoField, fechaField, numeroField, pendienteField, saldoField, editarField, borrarField); facturaGrid.setCanResizeFields(true); ButtonItem button = new ButtonItem("add", "Agregar"); button.setStartRow(false); button.setWidth(80); button.setIcon("add.png"); button.setAlign(Alignment.CENTER); button.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { new VentaDetalle(mainWindow); } }); listar(facturaGrid, new Factura(), "nombre"); Label label = new Label(); label.setBackgroundColor("#99ffcc"); label.setHeight(30); label.setWidth(500); label.setPadding(10); label.setAlign(Alignment.CENTER); label.setValign(VerticalAlignment.CENTER); label.setWrap(false); label.setShowEdges(true); label.setContents("<div style='color:black;font-size:15'><b>Lista de Ventas</b></div>"); layout.addMember(label); layout.addMember(buscarFields); layout.addMember(facturaGrid); DynamicForm form = new DynamicForm(); // form.setBackgroundColor("#99ffcc"); form.setWidth(300); form.setItems(button); layout.addMember(form); mainWindow.showDialog(layout); }
@Override protected void configureTable() { getListGrid().setEmptyMessage(MSG.view_messageCenter_noRecentMessages()); updateTitleCanvas( MSG.view_messageCenter_lastNMessages( String.valueOf(CoreGUI.getMessageCenter().getMaxMessages()))); ListGridField severityField = new ListGridField(FIELD_SEVERITY); severityField.setType(ListGridFieldType.ICON); severityField.setAlign(Alignment.CENTER); severityField.setShowValueIconOnly(true); HashMap<String, String> severityIcons = new HashMap<String, String>(5); severityIcons.put(Severity.Blank.name(), getSeverityIcon(Severity.Blank)); severityIcons.put(Severity.Info.name(), getSeverityIcon(Severity.Info)); severityIcons.put(Severity.Warning.name(), getSeverityIcon(Severity.Warning)); severityIcons.put(Severity.Error.name(), getSeverityIcon(Severity.Error)); severityIcons.put(Severity.Fatal.name(), getSeverityIcon(Severity.Fatal)); severityField.setValueIcons(severityIcons); severityField.setShowHover(true); severityField.setHoverCustomizer( new HoverCustomizer() { @Override public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) { try { Severity severity = ((Message) record.getAttributeAsObject(FIELD_OBJECT)).getSeverity(); switch (severity) { case Info: return MSG.common_severity_info(); case Warning: return MSG.common_severity_warn(); case Error: return MSG.common_severity_error(); case Fatal: return MSG.common_severity_fatal(); } } catch (Throwable e) { Log.error("Cannot get severity hover", e); } return null; } }); severityField.setSortNormalizer( new SortNormalizer() { @Override public Object normalize(ListGridRecord record, String fieldName) { try { Severity severity = ((Message) record.getAttributeAsObject(FIELD_OBJECT)).getSeverity(); return Integer.valueOf(severity.ordinal()); } catch (Throwable e) { Log.error("Cannot get sort nomalizer", e); } return Integer.valueOf(0); } }); ListGridField timeField = new ListGridField(FIELD_TIME, MSG.view_messageCenter_messageTime()); timeField.setType(ListGridFieldType.TIME); timeField.setAttribute("displayFormat", TimeFormatter.TOPADDEDTIME); timeField.setAlign(Alignment.LEFT); timeField.setShowHover(true); timeField.setHoverCustomizer(TimestampCellFormatter.getHoverCustomizer(FIELD_TIME)); ListGridField messageField = new ListGridField(FIELD_CONCISEMESSAGE, MSG.common_title_message()); severityField.setWidth(25); timeField.setWidth("15%"); messageField.setWidth("*"); getListGrid().setFields(severityField, timeField, messageField); setListGridDoubleClickHandler( new DoubleClickHandler() { @Override public void onDoubleClick(DoubleClickEvent event) { try { ListGrid listGrid = (ListGrid) event.getSource(); ListGridRecord[] selectedRows = listGrid.getSelection(); if (selectedRows != null && selectedRows.length > 0) { Message message = (Message) selectedRows[0].getAttributeAsObject( FIELD_OBJECT); // show the first selected showDetails(message); } } catch (Throwable e) { Log.error("Cannot show details for message", e); } } }); addTableAction( extendLocatorId("delete"), MSG.common_button_delete(), MSG.common_msg_areYouSure(), new AbstractTableAction(TableActionEnablement.ANY) { @Override public void executeAction(ListGridRecord[] selection, Object actionValue) { try { for (ListGridRecord record : selection) { Object doomed = record.getAttributeAsObject(FIELD_OBJECT); CoreGUI.getMessageCenter().getMessages().remove(doomed); } refresh(); } catch (Throwable e) { Log.error("Cannot delete messages", e); } } }); addTableAction( extendLocatorId("deleteAll"), MSG.common_button_delete_all(), MSG.common_msg_areYouSure(), new AbstractTableAction(TableActionEnablement.ALWAYS) { @Override public void executeAction(ListGridRecord[] selection, Object actionValue) { try { CoreGUI.getMessageCenter().getMessages().clear(); refresh(); } catch (Throwable e) { Log.error("Cannot delete all messages", e); } } }); LinkedHashMap<String, Integer> maxMessagesMap = new LinkedHashMap<String, Integer>(); maxMessagesMap.put("10", Integer.valueOf("10")); maxMessagesMap.put("25", Integer.valueOf("25")); maxMessagesMap.put("50", Integer.valueOf("50")); maxMessagesMap.put("100", Integer.valueOf("100")); maxMessagesMap.put("200", Integer.valueOf("200")); addTableAction( extendLocatorId("maxMessageMenu"), MSG.view_messageCenter_maxMessages(), null, maxMessagesMap, new AbstractTableAction(TableActionEnablement.ALWAYS) { @Override public void executeAction(ListGridRecord[] selection, Object actionValue) { try { Integer maxSize = (Integer) actionValue; CoreGUI.getMessageCenter().setMaxMessages(maxSize.intValue()); updateTitleCanvas(MSG.view_messageCenter_lastNMessages(maxSize.toString())); refresh(); } catch (Throwable e) { Log.error("Cannot set max messages", e); } } }); /* // TODO only for testing, remove this when done testing addTableAction(extendLocatorId("test"), "TEST MSG", null, new AbstractTableAction(TableActionEnablement.ALWAYS) { @Override public void executeAction(ListGridRecord[] selection, Object actionValue) { for (Severity severity : java.util.EnumSet.allOf(Severity.class)) { Message m = new Message(severity.name() + ':' + System.currentTimeMillis(), severity); CoreGUI.getMessageCenter().notify(m); } } }); */ // initial population of the list with current messages try { refresh(); } catch (Throwable e) { Log.error("Cannot perform initial refresh", e); } }
private void initColumns(List<String> currencyGroupList) { if (currencyGroupList.size() > 0) { List<ListGridField> currencyFieldList = new LinkedList<ListGridField>(); ListGridField dateField = new ListGridField("dt", constants.date()); dateField.setAlign(Alignment.CENTER); dateField.setCellFormatter( new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value instanceof Date) { DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd.MM.yyyy"); Date date = (Date) value; String format = dateFormatter.format(date); return format; } else if (value != null) return value.toString(); else return null; } }); currencyFieldList.add(dateField); CustomValidator customValidator = new CustomValidator() { protected boolean condition(Object value) { try { if (value instanceof Float) { return (Float) value > 0.0; } else if (value instanceof Integer) { return ((Integer) value).floatValue() > 0.0; } else { Float result = Float.parseFloat((String) value); return result > 0.0; } } catch (Exception ex) { } return false; } }; FloatItem floatItem = new FloatItem(); floatItem.setEditorValueFormatter( new FormItemValueFormatter() { @Override public String formatValue( Object value, Record record, DynamicForm form, FormItem item) { if (value == null) return ""; String formattedValue = String.valueOf(value); formattedValue = formattedValue.replace('.', ','); return formattedValue; } }); floatItem.setEditorValueParser( new FormItemValueParser() { @Override public Object parseValue(String value, DynamicForm form, FormItem item) { try { if (value != null) { String newValue = value.replace(',', '.'); Float result = Float.parseFloat(newValue); return result; } } catch (Exception ex) { } return null; } }); for (int index = 0; index < currencyGroupList.size(); index++) { String currencyName = currencyGroupList.get(index); if (currencyName != null && !baseCurrencyPrefix.equals(currencyName) && !docCurrencyPrefix.equals(currencyName)) { ListGridField currencyField = new ListGridField(CurrencyRecord.IDENTITY_CURRENCY + currencyName, currencyName); currencyField.setCellFormatter( new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) { return null; } else { NumberFormat nf = NumberFormat.getFormat("0.###"); try { return nf.format((Number) value); } catch (Exception e) { return value.toString(); } } } }); currencyField.setAlign(Alignment.CENTER); currencyField.setRequired(true); currencyField.setValidators(customValidator); currencyField.setEditorType(floatItem); currencyFieldList.add(currencyField); } } // -------------------------------------------------------------------- // Remove Row column // -------------------------------------------------------------------- ListGridField removeField = new ListGridField("remove", constants.remove()); removeField.setAlign(Alignment.CENTER); removeField.setType(ListGridFieldType.IMAGE); removeField.setCanEdit(false); removeField.setCanFilter(false); removeField.setCellFormatter( new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { return Canvas.imgHTML("[SKIN]/actions/remove.png"); } }); removeField.setWidth(60); currencyFieldList.add(removeField); ListGridField[] currencyFieldArray = new ListGridField[currencyFieldList.size()]; currencyFieldList.toArray(currencyFieldArray); currencyGrid.setFields(currencyFieldArray); } }
public TabFindAbonent() { setTitle(CallCenter.constants.findAbonent()); setCanClose(true); datasource = DataSource.get("AbonentsDS"); mainLayout = new VLayout(5); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.setMargin(5); searchForm = new DynamicForm(); searchForm.setAutoFocus(true); searchForm.setWidth(750); searchForm.setNumCols(3); searchForm.setTitleOrientation(TitleOrientation.TOP); mainLayout.addMember(searchForm); firstNameItem = new TextItem(); firstNameItem.setTitle(CallCenter.constants.name()); firstNameItem.setWidth(250); firstNameItem.setName("firstNameItem"); lastNameItem = new TextItem(); lastNameItem.setTitle(CallCenter.constants.lastName()); lastNameItem.setWidth(250); lastNameItem.setName("lastNameItem"); phoneItem = new TextItem(); phoneItem.setTitle(CallCenter.constants.phone()); phoneItem.setWidth(250); phoneItem.setName("phone"); streetItem = new TextItem(); streetItem.setTitle(CallCenter.constants.street()); streetItem.setName("street_name_geo"); streetItem.setWidth(250); citiesItem = new ComboBoxItem(); citiesItem.setTitle(CallCenter.constants.city()); citiesItem.setName("city_name_geo"); citiesItem.setWidth(250); citiesItem.setFetchMissingValues(true); citiesItem.setFilterLocally(false); citiesItem.setAddUnknownValues(false); DataSource cityDS = DataSource.get("CityDS"); citiesItem.setOptionOperationId("searchCitiesFromDBForCombos"); citiesItem.setOptionDataSource(cityDS); citiesItem.setValueField("city_id"); citiesItem.setDisplayField("city_name_geo"); citiesItem.setOptionCriteria(new Criteria()); citiesItem.setAutoFetchData(false); citiesItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { Criteria criteria = citiesItem.getOptionCriteria(); if (criteria != null) { String oldAttr = criteria.getAttribute("city_id"); if (oldAttr != null) { Object nullO = null; criteria.setAttribute("city_id", nullO); } } } }); regionItem = new ComboBoxItem(); regionItem.setTitle(CallCenter.constants.cityRegion()); regionItem.setName("city_region_name_geo"); regionItem.setWidth(250); regionItem.setFetchMissingValues(true); regionItem.setFilterLocally(false); regionItem.setAddUnknownValues(false); DataSource streetsDS = DataSource.get("CityRegionDS"); regionItem.setOptionOperationId("searchCityRegsFromDBForCombos"); regionItem.setOptionDataSource(streetsDS); regionItem.setValueField("city_region_id"); regionItem.setDisplayField("city_region_name_geo"); Criteria criteria = new Criterion(); regionItem.setOptionCriteria(criteria); regionItem.setAutoFetchData(false); regionItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { Criteria criteria = regionItem.getOptionCriteria(); if (criteria != null) { String oldAttr = criteria.getAttribute("city_region_id"); if (oldAttr != null) { Object nullO = null; criteria.setAttribute("city_region_id", nullO); } } } }); searchForm.setFields( lastNameItem, firstNameItem, phoneItem, streetItem, citiesItem, regionItem); HLayout buttonLayout = new HLayout(5); buttonLayout.setWidth(750); buttonLayout.setHeight(30); buttonLayout.setAlign(Alignment.RIGHT); clearButton = new IButton(); clearButton.setTitle(CallCenter.constants.clear()); findButton = new IButton(); findButton.setTitle(CallCenter.constants.find()); buttonLayout.setMembers(findButton, clearButton); mainLayout.addMember(buttonLayout); listGrid = new ListGrid() { protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) { ListGridRecord countryRecord = (ListGridRecord) record; if (countryRecord == null) { return super.getCellCSSText(record, rowNum, colNum); } Integer deleted = countryRecord.getAttributeAsInt("deleted"); if (deleted != null && !deleted.equals(0)) { return "color:red;"; } else { return super.getCellCSSText(record, rowNum, colNum); } }; }; listGrid.setWidth(1000); listGrid.setHeight100(); listGrid.setAlternateRecordStyles(true); listGrid.setDataSource(datasource); listGrid.setAutoFetchData(false); listGrid.setShowFilterEditor(false); listGrid.setCanEdit(false); listGrid.setCanRemoveRecords(false); listGrid.setFetchOperation("customSearchForCC"); listGrid.setCanSort(false); listGrid.setCanResizeFields(false); listGrid.setCanSelectText(true); listGrid.setCanDragSelectText(true); listGrid.setShowFilterEditor(true); listGrid.setFilterOnKeypress(true); ListGridField firstname = new ListGridField("firstname", CallCenter.constants.name(), 120); firstname.setCanFilter(true); ListGridField lastname = new ListGridField("lastname", CallCenter.constants.lastName(), 150); lastname.setCanFilter(true); ListGridField city = new ListGridField("city", CallCenter.constants.city(), 140); city.setCanFilter(false); ListGridField address = new ListGridField("address", CallCenter.constants.address()); address.setCanFilter(true); ListGridField phone = new ListGridField("phone", CallCenter.constants.phone(), 100); phone.setCanFilter(true); firstname.setAlign(Alignment.LEFT); lastname.setAlign(Alignment.LEFT); city.setAlign(Alignment.LEFT); address.setAlign(Alignment.LEFT); phone.setAlign(Alignment.CENTER); listGrid.setFields(lastname, firstname, city, address, phone); mainLayout.addMember(listGrid); clearButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { firstNameItem.clearValue(); lastNameItem.clearValue(); phoneItem.clearValue(); streetItem.clearValue(); citiesItem.clearValue(); regionItem.clearValue(); } }); findButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { search(); } }); citiesItem.addChangedHandler( new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { String value = citiesItem.getValueAsString(); if (value == null) { return; } regionItem.clearValue(); fillCityRegionCombo(new Integer(value)); } }); firstNameItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); lastNameItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); phoneItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); streetItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); listGrid.addRecordDoubleClickHandler( new RecordDoubleClickHandler() { @Override public void onRecordDoubleClick(RecordDoubleClickEvent event) { DlgViewAbonent dlgViewAbonent = new DlgViewAbonent(listGrid, datasource, listGrid.getSelectedRecord()); dlgViewAbonent.show(); } }); setPane(mainLayout); }
public teamsInClass_Team_Widget( final Criteria criteria, final UserDetailsReceivedEvent userDetails) { this.userDetails = userDetails; final TeamModelMessages targetMessages = (TeamModelMessages) GWT.create(TeamModelMessages.class); BoatTypeModelMessages boatTypeMessages = (BoatTypeModelMessages) GWT.create(BoatTypeModelMessages.class); setPadding(10); setIsGroup(true); setGroupTitle( classMessages.richFormView_teamsInClass_coupling_with_Team( targetMessages.tab_name_TeamModel())); // all elements from the target reference, to be picked from to make a connection setWidth100(); setHeight100(); this.grid.setWidth100(); // grid.setHeight(150); //automatically ought to use all the space // grid.setHeight("*"); this.grid.setAlternateRecordStyles(false); this.grid.setCellHeight(32); this.grid.setDataSource(dataSource); this.grid.setAutoFetchData(false); this.grid.setCanEdit(true); this.grid.setModalEditing(true); this.grid.setShowFilterEditor(true); this.grid.setDoubleClickDelay(100); this.grid.setEditEvent(ListGridEditEvent.DOUBLECLICK); this.grid.setListEndEditAction(RowEndEditAction.DONE); this.grid.setCanRemoveRecords(true); this.grid.setAutoSaveEdits(true); this.grid.setCanSelectText(true); this.grid.setAllowFilterExpressions(true); this.grid.setCanDragSelectText(true); this.grid.setCanRemoveRecords( false); // we have our own delete button, with extra functionality /* */ ListGridField idField = new ListGridField("Team_id", "Team id"); ListGridField sailNumberField = new ListGridField("sailNumber", targetMessages.sailNumber()); sailNumberField.setAlign(Alignment.LEFT); sailNumberField = TeamRichTableView.setFormatterForsailNumber(sailNumberField); ListGridField teamNameField = new ListGridField("teamName", targetMessages.teamName()); teamNameField.setAlign(Alignment.LEFT); teamNameField = TeamRichTableView.setFormatterForteamName(teamNameField); ListGridField nameCaptainField = new ListGridField("nameCaptain", targetMessages.nameCaptain()); nameCaptainField.setAlign(Alignment.LEFT); nameCaptainField = TeamRichTableView.setFormatterFornameCaptain(nameCaptainField); ListGridField streetField = new ListGridField("street", targetMessages.street()); streetField.setAlign(Alignment.LEFT); streetField = TeamRichTableView.setFormatterForstreet(streetField); ListGridField zipcodeField = new ListGridField("zipcode", targetMessages.zipcode()); zipcodeField.setAlign(Alignment.LEFT); zipcodeField = TeamRichTableView.setFormatterForzipcode(zipcodeField); ListGridField cityField = new ListGridField("city", targetMessages.city()); cityField.setAlign(Alignment.LEFT); cityField = TeamRichTableView.setFormatterForcity(cityField); ListGridField emailField = new ListGridField("email", targetMessages.email()); emailField.setAlign(Alignment.LEFT); emailField = TeamRichTableView.setFormatterForemail(emailField); ListGridField phoneField = new ListGridField("phone", targetMessages.phone()); phoneField.setAlign(Alignment.LEFT); phoneField = TeamRichTableView.setFormatterForphone(phoneField); ListGridField numPersonsField = new ListGridField("numPersons", targetMessages.numPersons()); numPersonsField.setAlign(Alignment.LEFT); numPersonsField = TeamRichTableView.setFormatterFornumPersons(numPersonsField); ListGridField toerField = new ListGridField("toer", targetMessages.toer()); toerField = TeamRichTableView.setFormatterFortoer(toerField); ListGridField spinField = new ListGridField("spin", targetMessages.spin()); spinField = TeamRichTableView.setFormatterForspin(spinField); ListGridField waitinglistField = new ListGridField("waitinglist", targetMessages.waitinglist()); waitinglistField = TeamRichTableView.setFormatterForwaitinglist(waitinglistField); ListGridField femaleTeamField = new ListGridField("femaleTeam", targetMessages.femaleTeam()); femaleTeamField = TeamRichTableView.setFormatterForfemaleTeam(femaleTeamField); ListGridField remark_Field = new ListGridField("remark_", targetMessages.remark_()); remark_Field.setAlign(Alignment.LEFT); remark_Field = TeamRichTableView.setFormatterForremark_(remark_Field); ListGridField teamStartTimeField = new ListGridField("teamStartTime", targetMessages.teamStartTime()); teamStartTimeField.setAlign(Alignment.LEFT); teamStartTimeField = TeamRichTableView.setFormatterForteamStartTime(teamStartTimeField); teamStartTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME); // call to a custom field, this class should be created customly teamStartTimeField = nl.sytematic.projects.BrioRaceSystem.client.custom.TeamTeamStartTimeCustomFieldFactory .getCustomField(grid, teamStartTimeField, userDetails); ListGridField endTimeField = new ListGridField("endTime", targetMessages.endTime()); endTimeField.setAlign(Alignment.LEFT); endTimeField = TeamRichTableView.setFormatterForendTime(endTimeField); endTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME); ListGridField sailingTimeField = new ListGridField("sailingTime", targetMessages.sailingTime()); sailingTimeField.setAlign(Alignment.LEFT); sailingTimeField = TeamRichTableView.setFormatterForsailingTime(sailingTimeField); sailingTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME); // call to a custom field, this class should be created customly sailingTimeField = nl.sytematic.projects.BrioRaceSystem.client.custom.TeamSailingTimeCustomFieldFactory .getCustomField(grid, sailingTimeField, userDetails); ListGridField swTimeField = new ListGridField("swTime", targetMessages.swTime()); swTimeField.setAlign(Alignment.LEFT); swTimeField = TeamRichTableView.setFormatterForswTime(swTimeField); swTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME); // call to a custom field, this class should be created customly swTimeField = nl.sytematic.projects.BrioRaceSystem.client.custom.TeamSwTimeCustomFieldFactory .getCustomField(grid, swTimeField, userDetails); ListGridField registrationDateTimeField = new ListGridField("registrationDateTime", targetMessages.registrationDateTime()); registrationDateTimeField.setAlign(Alignment.LEFT); registrationDateTimeField = TeamRichTableView.setFormatterForregistrationDateTime(registrationDateTimeField); // registrationDateTimeField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME); DateTimeItem registrationDateTimeEditor = new DateTimeItem(); registrationDateTimeEditor.setUseTextField(true); registrationDateTimeEditor.setUseMask(true); // registrationDateTimeEditor.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME); registrationDateTimeField.setEditorType(registrationDateTimeEditor); // registrationDateTimeField.setFilterEditorType(registrationDateTimeEditor); // call to a custom field, this class should be created customly registrationDateTimeField = nl.sytematic.projects.BrioRaceSystem.client.custom .TeamRegistrationDateTimeCustomFieldFactory.getCustomField( grid, registrationDateTimeField, userDetails); ListGridField payDateField = new ListGridField("payDate", targetMessages.payDate()); payDateField.setAlign(Alignment.LEFT); payDateField = TeamRichTableView.setFormatterForpayDate(payDateField); // payDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE); DateItem payDateEditor = new DateItem(); payDateEditor.setUseTextField(true); payDateEditor.setUseMask(true); // payDateEditor.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE); payDateField.setEditorType(payDateEditor); // payDateField.setFilterEditorType(payDateEditor); ListGridField payOrderField = new ListGridField("payOrder", targetMessages.payOrder()); payOrderField.setAlign(Alignment.LEFT); payOrderField = TeamRichTableView.setFormatterForpayOrder(payOrderField); ListGridField payIdField = new ListGridField("payId", targetMessages.payId()); payIdField.setAlign(Alignment.LEFT); payIdField = TeamRichTableView.setFormatterForpayId(payIdField); ListGridField acceptedField = new ListGridField("accepted", targetMessages.accepted()); acceptedField = TeamRichTableView.setFormatterForaccepted(acceptedField); ListGridField payStatusField = new ListGridField("payStatus", targetMessages.payStatus()); payStatusField.setAlign(Alignment.LEFT); payStatusField = TeamRichTableView.setFormatterForpayStatus(payStatusField); ListGridField BoatTypeField = new ListGridField("BoatType_id", boatTypeMessages.name_single()); ListGridField ClassField = new ListGridField("Class_id", classMessages.name_single()); final SelectItem BoatTypeSelectItem = new SelectItem("BoatType_id", boatTypeMessages.name_single()); BoatTypeSelectItem.setOptionDataSource(DataSource.get("BoatType")); BoatTypeSelectItem.setValueField("BoatType_id"); BoatTypeSelectItem.setAlign(Alignment.LEFT); BoatTypeSelectItem.setTextAlign(Alignment.LEFT); BoatTypeSelectItem.setTitleAlign(Alignment.LEFT); ListGrid BoatTypeListGrid = new ListGrid(); BoatTypeListGrid.setShowFilterEditor(true); BoatTypeListGrid.setFilterOnKeypress(true); SortSpecifier BoatTypeSort = new SortSpecifier("typeName", SortDirection.ASCENDING); SortSpecifier[] BoatTypeSorts = new SortSpecifier[] {BoatTypeSort}; BoatTypeListGrid.setInitialSort(BoatTypeSorts); BoatTypeSelectItem.setDisplayField("typeName"); BoatTypeSelectItem.setAllowEmptyValue(true); BoatTypeSelectItem.setPickListWidth(800); BoatTypeSelectItem.setPickListFields( new ListGridField("typeName", boatTypeMessages.typeName()), new ListGridField("SW_value", boatTypeMessages.SW_value())); BoatTypeSelectItem.setPickListProperties(BoatTypeListGrid); BoatTypeField.setAlign(Alignment.LEFT); BoatTypeField.setEditorType(BoatTypeSelectItem); BoatTypeField.setOptionDataSource(DataSource.get("BoatType")); BoatTypeField.setDisplayField("typeName"); BoatTypeField.setFilterEditorType(BoatTypeSelectItem); // reusing this is okay appareantly ButtonItem newBoatType = new ButtonItem("newBoatType", boatTypeMessages.new_window()); newBoatType.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { BoatTypeNewEntryWindow w = new BoatTypeNewEntryWindow( null, new DSCallback() { @Override public void execute( DSResponse response, Object rawData, DSRequest request) { RecordList rl = response.getDataAsRecordList(); if (rl.getLength() > 0) { Record r = rl.get(0); Log.debug("Record found in callback"); Integer id = r.getAttributeAsInt("BoatType_id"); Log.debug("ID is " + id); BoatTypeSelectItem.setValue(id); // select the just added value } } }); w.show(); w.bringToFront(); } }); final SelectItem ClassSelectItem = new SelectItem("Class_id", classMessages.name_single()); ClassSelectItem.setOptionDataSource(DataSource.get("Class")); ClassSelectItem.setValueField("Class_id"); ClassSelectItem.setAlign(Alignment.LEFT); ClassSelectItem.setTextAlign(Alignment.LEFT); ClassSelectItem.setTitleAlign(Alignment.LEFT); ListGrid ClassListGrid = new ListGrid(); ClassListGrid.setShowFilterEditor(true); ClassListGrid.setFilterOnKeypress(true); SortSpecifier ClassSort = new SortSpecifier("className", SortDirection.ASCENDING); SortSpecifier[] ClassSorts = new SortSpecifier[] {ClassSort}; ClassListGrid.setInitialSort(ClassSorts); ClassSelectItem.setDisplayField("className"); ClassSelectItem.setAllowEmptyValue(true); ClassSelectItem.setPickListWidth(800); ClassSelectItem.setPickListFields( new ListGridField("className", classMessages.className()), new ListGridField("startTime", classMessages.startTime())); ClassSelectItem.setPickListProperties(ClassListGrid); ClassField.setAlign(Alignment.LEFT); ClassField.setEditorType(ClassSelectItem); ClassField.setOptionDataSource(DataSource.get("Class")); ClassField.setDisplayField("className"); ClassField.setFilterEditorType(ClassSelectItem); // reusing this is okay appareantly ButtonItem newClass = new ButtonItem("newClass", classMessages.new_window()); newClass.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { ClassNewEntryWindow w = new ClassNewEntryWindow( null, new DSCallback() { @Override public void execute( DSResponse response, Object rawData, DSRequest request) { RecordList rl = response.getDataAsRecordList(); if (rl.getLength() > 0) { Record r = rl.get(0); Log.debug("Record found in callback"); Integer id = r.getAttributeAsInt("Class_id"); Log.debug("ID is " + id); ClassSelectItem.setValue(id); // select the just added value } } }); w.show(); w.bringToFront(); } }); ListGridField deleteField = new ListGridField("deleteField", "-"); deleteField.setShouldPrint(false); deleteField.setCellIcon( GWT.getHostPageBaseURL() + "images/icons/32/woofunction/remove_32.png"); deleteField.setType(ListGridFieldType.ICON); deleteField.setTitle(""); deleteField.setWidth(32); deleteField.setIconSize(24); deleteField.setCanDragResize(false); deleteField.setCanSort(false); deleteField.setCanEdit(false); deleteField.setCanGroupBy(false); deleteField.setCanFreeze(false); deleteField.setCanFilter(false); deleteField.setCanHide(false); deleteField.setCanReorder(false); this.grid.addRecordClickHandler( new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { ListGridField clicked = event.getField(); final Record r = event.getRecord(); if ("deleteField".equals(clicked.getName())) { SC.confirm( radosMessages.delete_confirm_coupling(), new BooleanCallback() { public void execute(Boolean confirmed) { if (confirmed != null && confirmed) { grid.removeData(r); } else { // Cancel } } }); } } }); ArrayList<ListGridField> fields = new ArrayList<ListGridField>(); fields.add(idField); fields.add(sailNumberField); fields.add(teamNameField); fields.add(nameCaptainField); fields.add(streetField); fields.add(zipcodeField); fields.add(cityField); fields.add(emailField); fields.add(phoneField); fields.add(numPersonsField); fields.add(toerField); fields.add(spinField); fields.add(waitinglistField); fields.add(femaleTeamField); fields.add(remark_Field); fields.add(teamStartTimeField); fields.add(endTimeField); fields.add(sailingTimeField); fields.add(swTimeField); fields.add(registrationDateTimeField); fields.add(payDateField); fields.add(payOrderField); fields.add(payIdField); fields.add(acceptedField); fields.add(payStatusField); fields.add(BoatTypeField); if (userDetails.hasAuthority("CAN_DELETE_TEAM")) { fields.add(deleteField); } ListGridField[] fieldsArr = fields.toArray(new ListGridField[fields.size()]); this.grid.setFields(fieldsArr); this.grid.fetchData(criteria); buttonPanel.setMargin(2); grid.hideField("Team_id"); // newButton.setSize(32); newButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/add_32.png"); newButton.setIconOrientation("right"); newButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Map<String, Object> defaultValues = new HashMap<String, Object>(); defaultValues.put("Class_id", criteria.getAttribute("Class_id")); grid.startEditingNew(defaultValues); } }); buttonPanel.addMember(newButton); /*IButton printButton = new IButton(radosMessages.richTableView_print_button());*/ IButton printButton = new IButton(radosMessages.richTableView_print_button()); printButton.setShowRollOver(false); printButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/printer_32.png"); printButton.setIconOrientation("right"); // Img printButton = new // Img(GWT.getHostPageBaseURL()+"images/icons/32/woofunction/printer_32.png"); // printButton.setSize(32); // printButton.setAltText(radosMessages.richTableView_print_button()); printButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Canvas.showPrintPreview(grid); } }); buttonPanel.addMember(printButton); EmailGridButtonWidget email = new EmailGridButtonWidget(new Canvas[] {grid}); email.setDefaultMessage(targetMessages.name_single() + "overzicht"); email.setDefaultSubject(targetMessages.name_single() + "overzicht"); email.setDefaultFrom(BrioRaceSystemApplicationPanel.getUserdetails().getEmail()); buttonPanel.addMember(email); ExportButtonWidget exportButton = new ExportButtonWidget(grid, dataSource); buttonPanel.addMember(exportButton); buttonPanel.setHeight(30); this.addMember(buttonPanel); this.addMember(grid); handleRights(); }
public TabBillingComps() { try { setTitle(CallCenterBK.constants.billingComps()); setCanClose(true); billingCompsDS = DataSource.get("BillingCompsDS"); mainLayout = new VLayout(5); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.setMargin(5); searchForm = new DynamicForm(); searchForm.setAutoFocus(true); searchForm.setWidth(830); searchForm.setTitleWidth(250); searchForm.setNumCols(4); mainLayout.addMember(searchForm); billingCompNameItem = new TextItem(); billingCompNameItem.setTitle(CallCenterBK.constants.companyName()); billingCompNameItem.setWidth(250); billingCompNameItem.setName("billingCompNameItem"); phoneIndexItem = new TextItem(); phoneIndexItem.setTitle(CallCenterBK.constants.index()); phoneIndexItem.setWidth(250); phoneIndexItem.setName("phoneIndexItem"); hasCalcItem = new SelectItem(); hasCalcItem.setTitle(CallCenterBK.constants.hasCalculation()); hasCalcItem.setWidth(250); hasCalcItem.setName("hasCalcItem"); hasCalcItem.setDefaultToFirstOption(true); hasCalcItem.setValueMap(ClientMapUtil.getInstance().getHasCalculations()); operatorItem = new SelectItem(); operatorItem.setTitle(CallCenterBK.constants.operator()); operatorItem.setWidth(200); operatorItem.setName("operator_src"); operatorItem.setDefaultToFirstOption(true); ClientUtils.fillCombo( operatorItem, "OperatorsDS", "searchOperators", "operator_src", "operator_src_descr"); searchForm.setFields(billingCompNameItem, phoneIndexItem, hasCalcItem, operatorItem); HLayout buttonLayout = new HLayout(5); buttonLayout.setWidth(830); buttonLayout.setHeight(30); buttonLayout.setAlign(Alignment.RIGHT); clearButton = new IButton(); clearButton.setTitle(CallCenterBK.constants.clear()); findButton = new IButton(); findButton.setTitle(CallCenterBK.constants.find()); buttonLayout.setMembers(findButton, clearButton); mainLayout.addMember(buttonLayout); ToolStrip toolStrip = new ToolStrip(); toolStrip.setWidth100(); toolStrip.setPadding(5); mainLayout.addMember(toolStrip); addBtn = new ToolStripButton(CallCenterBK.constants.add(), "addIcon.png"); addBtn.setLayoutAlign(Alignment.LEFT); addBtn.setWidth(50); toolStrip.addButton(addBtn); editBtn = new ToolStripButton(CallCenterBK.constants.modify(), "editIcon.png"); editBtn.setLayoutAlign(Alignment.LEFT); editBtn.setWidth(50); toolStrip.addButton(editBtn); deleteBtn = new ToolStripButton(CallCenterBK.constants.disable(), "deleteIcon.png"); deleteBtn.setLayoutAlign(Alignment.LEFT); deleteBtn.setWidth(50); toolStrip.addButton(deleteBtn); toolStrip.addSeparator(); billingCompBillByDayBtn = new ToolStripButton(CallCenterBK.constants.telCombBillByDay(), "billing.png"); billingCompBillByDayBtn.setLayoutAlign(Alignment.LEFT); billingCompBillByDayBtn.setWidth(50); toolStrip.addButton(billingCompBillByDayBtn); billingCompBillByMonthBtn = new ToolStripButton(CallCenterBK.constants.telCombBillByMonth(), "billing.png"); billingCompBillByMonthBtn.setLayoutAlign(Alignment.LEFT); billingCompBillByMonthBtn.setWidth(50); toolStrip.addButton(billingCompBillByMonthBtn); billingCompsGrid = new ListGrid(); billingCompsGrid.setWidth100(); billingCompsGrid.setHeight100(); billingCompsGrid.setAlternateRecordStyles(true); billingCompsGrid.setDataSource(billingCompsDS); billingCompsGrid.setAutoFetchData(false); billingCompsGrid.setShowFilterEditor(false); billingCompsGrid.setCanEdit(false); billingCompsGrid.setCanRemoveRecords(false); billingCompsGrid.setFetchOperation("searchAllBillingComps"); billingCompsGrid.setShowRowNumbers(true); billingCompsGrid.setCanHover(true); billingCompsGrid.setShowHover(true); billingCompsGrid.setShowHoverComponents(true); billingCompsGrid.setWrapCells(true); billingCompsGrid.setFixedRecordHeights(false); billingCompsGrid.setCanDragSelectText(true); ListGridField billing_company_name = new ListGridField("billing_company_name", CallCenterBK.constants.companyName()); ListGridField our_percent = new ListGridField("our_percent", CallCenterBK.constants.ourPercent(), 150); ListGridField has_calculation_descr = new ListGridField("has_calculation_descr", CallCenterBK.constants.hasCalculation(), 150); ListGridField call_price = new ListGridField("call_price", CallCenterBK.constants.callPrice(), 150); our_percent.setAlign(Alignment.CENTER); has_calculation_descr.setAlign(Alignment.CENTER); call_price.setAlign(Alignment.CENTER); billingCompsGrid.setFields( billing_company_name, our_percent, has_calculation_descr, call_price); mainLayout.addMember(billingCompsGrid); findButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { search(); } }); billingCompNameItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); phoneIndexItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); clearButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { billingCompNameItem.clearValue(); } }); addBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { DlgAddEditBillingComps dlgAddEditBillingComp = new DlgAddEditBillingComps(billingCompsGrid, null); dlgAddEditBillingComp.show(); } }); editBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenterBK.constants.pleaseSelrecord()); return; } DlgAddEditBillingComps dlgAddEditBillingComp = new DlgAddEditBillingComps(billingCompsGrid, listGridRecord); dlgAddEditBillingComp.show(); } }); deleteBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenterBK.constants.pleaseSelrecord()); return; } SC.ask( CallCenterBK.constants.askForDisable(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { delete(listGridRecord); } } }); } }); billingCompsGrid.addRecordDoubleClickHandler( new RecordDoubleClickHandler() { @Override public void onRecordDoubleClick(RecordDoubleClickEvent event) { ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); DlgAddEditBillingComps dlgAddEditBillingComp = new DlgAddEditBillingComps(billingCompsGrid, listGridRecord); dlgAddEditBillingComp.show(); } }); billingCompBillByDayBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenterBK.constants.pleaseSelrecord()); return; } Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id"); getBillingCompBillByDay(billing_company_id); } }); billingCompBillByMonthBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenterBK.constants.pleaseSelrecord()); return; } Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id"); getBillingCompBillByMonth(billing_company_id); } }); setPane(mainLayout); } catch (Exception e) { SC.say(e.toString()); } }
public ReportReceiveLayout_2(final User currentUser) { setWidth(950); setHeight100(); HLayout searchLayout = new HLayout(); searchLayout.setHeight(20); final DynamicForm searchForm = new DynamicForm(); searchForm.setWidth(450); searchForm.setHeight(30); searchForm.setMargin(5); searchForm.setNumCols(4); searchForm.setCellPadding(2); searchForm.setAutoFocus(true); searchForm.setSelectOnFocus(true); searchForm.setIsGroup(true); searchForm.setDataSource(TransferDS.getInstance()); searchForm.setUseAllDataSourceFields(false); searchForm.setGroupTitle("ตัวกรอง"); final SelectItem statusSelected = new SelectItem("status", "สถานะ"); statusSelected.setWrapTitle(false); // statusSelected.setValueMap("รอแก้ไข", "รออนุมัติ", "อนุมัติแล้ว"); statusSelected.setValueMap(TransferStatus.getValueMap()); statusSelected.setAllowEmptyValue(true); statusSelected.setEmptyDisplayValue("ทั้งหมด"); statusSelected.setOperator(OperatorId.EQUALS); final TextItem jidText = new TextItem("plan_id", "รหัสแผนการผลิต"); jidText.setWrapTitle(false); jidText.setOperator(OperatorId.REGEXP); // final TextItem smidText = new TextItem("smid", "รหัสช่าง"); // smidText.setWrapTitle(false); // smidText.setOperator(OperatorId.REGEXP); // final DynamicForm dateForm = new DynamicForm(); // dateForm.setWidth(300); // dateForm.setHeight(30); // dateForm.setMargin(5); // dateForm.setNumCols(2); // dateForm.setCellPadding(2); // dateForm.setSelectOnFocus(true); // dateForm.setIsGroup(true); // dateForm.setGroupTitle("วันที่ขอโอนสินค้า"); DateRange dateRange = new DateRange(); dateRange.setRelativeStartDate(new RelativeDate("-1w")); dateRange.setRelativeEndDate(RelativeDate.TODAY); final DateItem from = new DateItem("create_from", "ตั้งแต่"); final DateItem to = new DateItem("create_to", "ถึง"); from.setDefaultChooserDate(dateRange.getStartDate()); from.setDefaultValue(dateRange.getStartDate()); from.setUseTextField(true); to.setDefaultChooserDate(dateRange.getEndDate()); to.setDefaultValue(dateRange.getEndDate()); to.setUseTextField(true); searchForm.setItems(jidText, statusSelected, from, to); // searchForm.setItems(planText, jidText); // dateForm.setItems(from, to); final ListGrid orderListGrid = new ListGrid(); orderListGrid.setAutoFetchData(true); orderListGrid.setCanMultiSort(true); orderListGrid.setShowRowNumbers(true); orderListGrid.setShowGridSummary(true); AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { // new Criterion("status", OperatorId.NOT_EQUAL, "3_to_next_process"), // new Criterion("created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), // to.getValueAsDate()) new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, dateRange.getStartDate(), dateRange.getEndDate()) }); orderListGrid.setCriteria(criteria); orderListGrid.setDataSource(TransferDS.getInstance()); orderListGrid.setInitialSort( new SortSpecifier[] { new SortSpecifier("status", SortDirection.DESCENDING), new SortSpecifier("created_date", SortDirection.DESCENDING) }); orderListGrid.setUseAllDataSourceFields(false); orderListGrid.setSelectionType(SelectionStyle.NONE); ListGridField transfer_id = new ListGridField("transfer_id", 100); transfer_id.setSummaryFunction( new SummaryFunction() { public Object getSummaryValue(Record[] records, ListGridField field) { return records.length + " รายการ"; } }); transfer_id.setShowGridSummary(true); ListGridField status = new ListGridField("status", 120); ListGridField plan_id = new ListGridField("plan_id", 100); ListGridField transfer_by = new ListGridField("transfer_by"); ListGridField transfer_date = new ListGridField("transfer_date", 150); ListGridField total_weight = new ListGridField("total_sent_weight", 120); total_weight.setCellFormatter(FieldFormatter.getNumberFormat()); total_weight.setAlign(Alignment.RIGHT); total_weight.setSummaryFunction(SummaryFunctionType.SUM); total_weight.setShowGridSummary(true); ListGridField total_amount = new ListGridField("total_sent_amount", 120); total_amount.setCellFormatter(FieldFormatter.getNumberFormat()); total_amount.setAlign(Alignment.RIGHT); total_amount.setSummaryFunction(SummaryFunctionType.SUM); total_amount.setShowGridSummary(true); orderListGrid.setFields( transfer_date, transfer_id, status, plan_id, transfer_by, total_weight, total_amount); // orderListGrid.hideField("status"); HLayout buttonLayout = new HLayout(); buttonLayout.setMargin(10); buttonLayout.setMembersMargin(5); buttonLayout.setHeight(30); IButton searchButton = new IButton("ค้นหาคำขอโอนสินค้า"); searchButton.setIcon("icons/16/reports-icon.png"); searchButton.setWidth(170); searchButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Criterion search = new Criterion(); search.addCriteria(searchForm.getValuesAsCriteria()); AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), to.getValueAsDate()), search }); reportDate.setContents( "ตั้งแต่วันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(from.getValueAsDate()) + " ถึงวันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(to.getValueAsDate())); orderListGrid.fetchData(criteria); orderListGrid.deselectAllRecords(); } }); IButton listAllButton = new IButton("ล้างรายการค้นหา"); listAllButton.setIcon("[SKIN]actions/refresh.png"); listAllButton.setWidth(150); listAllButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), to.getValueAsDate()) }); searchForm.reset(); reportDate.setContents( "ตั้งแต่วันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(from.getValueAsDate()) + " ถึงวันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(to.getValueAsDate())); orderListGrid.fetchData(criteria); orderListGrid.deselectAllRecords(); } }); IButton printButton = new IButton("พิมพ์รายงาน"); printButton.setIcon("icons/16/print.png"); printButton.setWidth(120); buttonLayout.addMembers(searchButton, listAllButton, printButton); searchLayout.addMembers(searchForm); // reviseLayout. addMember(searchLayout); // reviseLayout. addMember(buttonLayout); final VLayout gridLayout = new VLayout(); gridLayout.setWidth100(); gridLayout.setHeight(500); Label text = new Label(); text.setContents("รายงานการโอนสินค้าเข้าคลังสินค้า"); text.setAlign(Alignment.CENTER); text.setHeight(10); text.setStyleName("printTitle"); reportDate = new Label(); reportDate.setContents( "ตั้งแต่วันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(from.getValueAsDate()) + " ถึงวันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(to.getValueAsDate())); reportDate.setAlign(Alignment.CENTER); reportDate.setHeight(10); reportDate.setStyleName("printDetails"); gridLayout.addMember(text); gridLayout.addMember(reportDate); gridLayout.addMember(orderListGrid); addMember(gridLayout); printButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Canvas.showPrintPreview(gridLayout); } }); }
public DeliveryOrderLayout(final User currentUser) { // Tab reviseTab = new Tab("ข้อมูลใบแจ้งหนี้", "icons/16/search-good-icon.png"); // VLayout reviseLayout = new VLayout(); // reviseLayout. setWidth(750); // reviseLayout. setHeight100(); HLayout searchLayout = new HLayout(); searchLayout.setHeight(20); final DynamicForm searchForm = new DynamicForm(); searchForm.setWidth(450); searchForm.setHeight(30); searchForm.setMargin(5); searchForm.setNumCols(4); searchForm.setCellPadding(2); searchForm.setAutoFocus(true); searchForm.setSelectOnFocus(true); searchForm.setIsGroup(true); searchForm.setDataSource(DeliveryDS.getInstance()); searchForm.setUseAllDataSourceFields(false); searchForm.setGroupTitle("ค้นหารายการนำส่งสินค้า"); final TextItem deliveryText = new TextItem("delivery_id", "รหัสรายการนำส่งสินค้า"); deliveryText.setWrapTitle(false); deliveryText.setOperator(OperatorId.REGEXP); final TextItem saleText = new TextItem("sale_id", "รหัสรายการขาย"); saleText.setWrapTitle(false); saleText.setOperator(OperatorId.REGEXP); final SelectItem statusSelected = new SelectItem("issued_status", "สถานะ"); statusSelected.setWrapTitle(false); // statusSelected.setValueMap("กำลังนำส่ง", "นำส่งแล้ว"); statusSelected.setValueMap(DeliveryStatus.getIssueValueMap()); statusSelected.setAllowEmptyValue(true); statusSelected.setEmptyDisplayValue("ทั้งหมด"); statusSelected.setOperator(OperatorId.EQUALS); final TextItem cidText = new TextItem("cid", "รหัสลูกค้า"); cidText.setWrapTitle(false); cidText.setOperator(OperatorId.REGEXP); final DynamicForm dateForm = new DynamicForm(); dateForm.setWidth(300); dateForm.setHeight(30); dateForm.setMargin(5); dateForm.setNumCols(2); dateForm.setCellPadding(2); dateForm.setSelectOnFocus(true); dateForm.setIsGroup(true); // dateForm.setGroupTitle("วันที่นำส่งสินค้า"); dateForm.setGroupTitle("วันที่ออกใบนำส่งสินค้า"); DateRange dateRange = new DateRange(); dateRange.setRelativeStartDate(new RelativeDate("-7d")); dateRange.setRelativeEndDate(RelativeDate.TODAY); // final DateItem from = new DateItem("delivery_from" , "ตั้งแต่"); // final DateItem to = new DateItem("delivery_to" , "ถึง"); final DateItem from = new DateItem("created_from", "ตั้งแต่"); final DateItem to = new DateItem("created_to", "ถึง"); from.setDefaultChooserDate(dateRange.getStartDate()); from.setDefaultValue(dateRange.getStartDate()); from.setUseTextField(true); to.setDefaultChooserDate(dateRange.getEndDate()); to.setDefaultValue(dateRange.getEndDate()); to.setUseTextField(true); FromToValidate.addValidator(from, to); searchForm.setItems(deliveryText, statusSelected, saleText, cidText); // searchForm.setItems(Text, cidText, cnameText); dateForm.setItems(from, to); // final ListGrid deliveryListGrid = new EditorListGrid(new RequestViewWindow(), currentUser); final ListGrid deliveryListGrid = new ListGrid(); deliveryListGrid.setAutoFetchData(true); deliveryListGrid.setCanMultiSort(true); // deliveryListGrid.setCriteria(new Criterion("status", OperatorId.NOT_EQUAL, "ยกเลิก")); deliveryListGrid.setDataSource(DeliveryDS.getInstance()); deliveryListGrid.setInitialSort( new SortSpecifier[] { new SortSpecifier("issued_status", SortDirection.ASCENDING), new SortSpecifier("delivery", SortDirection.DESCENDING) }); deliveryListGrid.setUseAllDataSourceFields(false); deliveryListGrid.setGroupByField("issued_status"); deliveryListGrid.setGroupStartOpen(GroupStartOpen.ALL); ListGridField delivery_id = new ListGridField("delivery_id", 120); ListGridField sale_id = new ListGridField("sale_id", 100); // ListGridField quote_id = new ListGridField("quote_id" , 90); ListGridField cus_name = new ListGridField("cus_name", 180); ListGridField status = new ListGridField("issued_status"); // LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); // valueMap.put("3_approved", "approved"); // status.setValueMap(valueMap); ListGridField total_amount = new ListGridField("total_amount", 120); total_amount.setCellFormatter(FieldFormatter.getIntegerFormat()); total_amount.setAlign(Alignment.RIGHT); // ListGridField netInclusive = new ListGridField("netInclusive", 125); // netInclusive.setCellFormatter(FieldFormatter.getPriceFormat()); // netInclusive.setAlign(Alignment.RIGHT); ListGridField delivery_date = new ListGridField("delivery", 120); // created_date.setType(ListGridFieldType.DATE); // created_date.setCellFormatter(new CellFormatter() { // // @Override // public String format(Object arg0, ListGridRecord arg1, int arg2, int arg3) { // DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy"); // return fmt.format(arg1.getAttributeAsDate("created_date")); // } // }); // ListGridField iconField = new ListGridField("viewDeliveryField", "เรียกดูรายการ", 80); deliveryListGrid.setFields(status, delivery_id, sale_id, cus_name, total_amount, delivery_date); searchLayout.addMembers(searchForm, dateForm); // reviseLayout. addMember(searchLayout); HLayout buttonLayout = new HLayout(); buttonLayout.setMargin(10); buttonLayout.setMembersMargin(5); buttonLayout.setHeight(30); IButton searchButton = new IButton("ค้นหารายการนำส่งสินค้า"); searchButton.setIcon("icons/16/icon_view.png"); searchButton.setWidth(150); searchButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Criterion search = new Criterion(); search.addCriteria(searchForm.getValuesAsCriteria()); AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { // new Criterion("delivery", OperatorId.BETWEEN_INCLUSIVE, // from.getValueAsDate(), to.getValueAsDate()), new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), to.getValueAsDate()), search }); deliveryListGrid.fetchData(criteria); deliveryListGrid.deselectAllRecords(); } }); IButton listAllButton = new IButton("แสดงรายการทั้งหมด"); listAllButton.setIcon("[SKIN]actions/refresh.png"); listAllButton.setWidth(150); listAllButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { // new Criterion("delivery", OperatorId.BETWEEN_INCLUSIVE, // from.getValueAsDate(), to.getValueAsDate()) new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), to.getValueAsDate()) }); searchForm.reset(); deliveryListGrid.fetchData(criteria); deliveryListGrid.deselectAllRecords(); } }); HLayout empty = new HLayout(); empty.setWidth("*"); IButton viewButton = new IButton("เรียกดูรายการ"); viewButton.setIcon("icons/16/icon_view.png"); viewButton.setWidth(150); viewButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { ListGridRecord selected = deliveryListGrid.getSelectedRecord(); if (selected == null) { SC.warn("กรุณาเลือกรายการเบิกสินค้า"); return; } RequestViewWindow deliveryWindow = new RequestViewWindow(); deliveryWindow.show(selected, false, currentUser, 1); } }); IButton receiveOrderButton = new IButton("เบิกจ่ายสินค้า"); receiveOrderButton.setIcon("icons/16/actions-receive-icon.png"); receiveOrderButton.setWidth(100); receiveOrderButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { ListGridRecord selected = deliveryListGrid.getSelectedRecord(); if (selected == null) { SC.warn("กรุณาเลือกรายการเบิกสินค้า"); return; } if (selected .getAttributeAsString("issued_status") .equalsIgnoreCase("0_product_request")) { RequestViewWindow deliveryWindow = new RequestViewWindow(); deliveryWindow.show(selected, true, currentUser, 2); } else { SC.warn("จ่ายสินค้าแล้ว"); } } }); buttonLayout.addMembers(searchButton, listAllButton, empty, viewButton, receiveOrderButton); // buttonLayout.addMembers(searchButton, listAllButton); // reviseLayout. addMember(buttonLayout); VLayout gridLayout = new VLayout(); gridLayout.setWidth100(); gridLayout.setHeight(355); gridLayout.addMember(deliveryListGrid); // reviseLayout. addMember(gridLayout); // reviseTab.setPane(reviseLayout); // return reviseTab; }
public Canvas getViewPanel() { Canvas canvas = new Canvas(); final ListGrid countryGrid = new ListGrid(); countryGrid.setWidth(550); countryGrid.setHeight(224); countryGrid.setShowAllRecords(true); countryGrid.setCellHeight(22); countryGrid.setDataSource(CountryXmlDS.getInstance()); ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 40); countryCodeField.setAlign(Alignment.CENTER); countryCodeField.setType(ListGridFieldType.IMAGE); countryCodeField.setImageURLPrefix("flags/16/"); countryCodeField.setImageURLSuffix(".png"); countryCodeField.setCanEdit(false); ListGridField nameField = new ListGridField("countryName", "Country"); ListGridField continentField = new ListGridField("continent", "Continent"); ListGridField memberG8Field = new ListGridField("member_g8", "Member G8"); ListGridField populationField = new ListGridField("population", "Population"); populationField.setType(ListGridFieldType.INTEGER); populationField.setCellFormatter( new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value != null) { NumberFormat nf = NumberFormat.getFormat("0,000"); try { return nf.format(((Number) value).longValue()); } catch (Exception e) { return value.toString(); } } else { return null; } } }); ListGridField independenceField = new ListGridField("independence", "Independence"); countryGrid.setFields( countryCodeField, nameField, continentField, memberG8Field, populationField, independenceField); countryGrid.setAutoFetchData(true); countryGrid.setCanEdit(true); countryGrid.setEditEvent(ListGridEditEvent.CLICK); countryGrid.setListEndEditAction(RowEndEditAction.NEXT); canvas.addChild(countryGrid); IButton button = new IButton("Edit New"); button.setTop(250); button.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { countryGrid.startEditingNew(); } }); canvas.addChild(button); return canvas; }
public TabCalendar() { try { setTitle(CallCenter.constants.menuCalendar()); setCanClose(true); datasource = DataSource.get("CalSecDS"); mainLayout = new VLayout(5); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.setMargin(5); searchForm = new DynamicForm(); searchForm.setAutoFocus(true); searchForm.setWidth(780); searchForm.setTitleWidth(300); searchForm.setNumCols(4); mainLayout.addMember(searchForm); calendarStateItem = new ComboBoxItem(); calendarStateItem.setTitle(CallCenter.constants.type()); calendarStateItem.setWidth(300); calendarStateItem.setName("calendar_state_id"); calendarStateItem.setValueMap(ClientMapUtil.getInstance().getCalendarStates()); calendarStateItem.setAddUnknownValues(false); secCalendarTypeItem = new ComboBoxItem(); secCalendarTypeItem.setTitle(CallCenter.constants.moonPhase()); secCalendarTypeItem.setWidth(300); secCalendarTypeItem.setName("calendar_event_id"); secCalendarTypeItem.setValueMap(ClientMapUtil.getInstance().getSecCalendarTypes()); secCalendarTypeItem.setAddUnknownValues(false); calendarDayItem = new DateItem(); calendarDayItem.setTitle(CallCenter.constants.date()); calendarDayItem.setWidth(300); calendarDayItem.setValue(new Date()); calendarDayItem.setName("calendar_day"); calendarDayItem.setHint(CallCenter.constants.choose()); descriptionItem = new TextItem(); descriptionItem.setTitle(CallCenter.constants.description()); descriptionItem.setName("calendar_description"); descriptionItem.setWidth(300); commentItem = new TextItem(); commentItem.setTitle(CallCenter.constants.comment()); commentItem.setName("calendar_comment"); commentItem.setWidth(300); byCalendarDayItem = new CheckboxItem(); byCalendarDayItem.setTitle(CallCenter.constants.searchByDate()); byCalendarDayItem.setWidth(300); byCalendarDayItem.setName("buCalDaySearch"); byCalendarDayItem.setValue(false); searchForm.setFields( calendarStateItem, secCalendarTypeItem, descriptionItem, commentItem, byCalendarDayItem, calendarDayItem); HLayout buttonLayout = new HLayout(5); buttonLayout.setWidth(780); buttonLayout.setHeight(30); buttonLayout.setAlign(Alignment.RIGHT); clearButton = new IButton(); clearButton.setTitle(CallCenter.constants.clear()); findButton = new IButton(); findButton.setTitle(CallCenter.constants.find()); buttonLayout.setMembers(findButton, clearButton); mainLayout.addMember(buttonLayout); ToolStrip toolStrip = new ToolStrip(); toolStrip.setWidth(780); toolStrip.setPadding(5); mainLayout.addMember(toolStrip); addBtn = new ToolStripButton(CallCenter.constants.add(), "addIcon.png"); addBtn.setLayoutAlign(Alignment.LEFT); addBtn.setWidth(50); toolStrip.addButton(addBtn); editBtn = new ToolStripButton(CallCenter.constants.modify(), "editIcon.png"); editBtn.setLayoutAlign(Alignment.LEFT); editBtn.setWidth(50); toolStrip.addButton(editBtn); disableBtn = new ToolStripButton(CallCenter.constants.disable(), "deleteIcon.png"); disableBtn.setLayoutAlign(Alignment.LEFT); disableBtn.setWidth(50); toolStrip.addButton(disableBtn); activateBtn = new ToolStripButton(CallCenter.constants.enable(), "restoreIcon.gif"); activateBtn.setLayoutAlign(Alignment.LEFT); activateBtn.setWidth(50); toolStrip.addButton(activateBtn); toolStrip.addSeparator(); copyBtn = new ToolStripButton(CallCenter.constants.copy(), "copy.png"); copyBtn.setLayoutAlign(Alignment.LEFT); copyBtn.setWidth(50); toolStrip.addButton(copyBtn); listGrid = new ListGrid() { protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) { ListGridRecord countryRecord = (ListGridRecord) record; if (countryRecord == null) { return super.getCellCSSText(record, rowNum, colNum); } Integer deleted = countryRecord.getAttributeAsInt("deleted"); if (deleted != null && !deleted.equals(0)) { return "color:red;"; } else { return super.getCellCSSText(record, rowNum, colNum); } }; }; listGrid.setWidth(780); listGrid.setHeight(260); listGrid.setAlternateRecordStyles(true); listGrid.setDataSource(datasource); listGrid.setAutoFetchData(false); listGrid.setShowFilterEditor(false); listGrid.setCanEdit(false); listGrid.setCanRemoveRecords(false); listGrid.setFetchOperation("searchAllSecularCalendars"); listGrid.setShowRowNumbers(true); listGrid.setCanHover(true); listGrid.setShowHover(true); listGrid.setShowHoverComponents(true); datasource.getField("calendar_day").setTitle(CallCenter.constants.date()); datasource.getField("event").setTitle(CallCenter.constants.moonPhase()); datasource.getField("state").setTitle(CallCenter.constants.type()); datasource.getField("sun_rise").setTitle(CallCenter.constants.order()); datasource.getField("calendar_description").setTitle(CallCenter.constants.description()); datasource.getField("calendar_comment").setTitle(CallCenter.constants.comment()); datasource.getField("rec_date").setTitle(CallCenter.constants.recDate()); datasource.getField("rec_user").setTitle(CallCenter.constants.recUser()); datasource.getField("upd_date").setTitle(CallCenter.constants.updDate()); datasource.getField("upd_user").setTitle(CallCenter.constants.updUser()); ListGridField calendar_day = new ListGridField("calendar_day", CallCenter.constants.date(), 150); ListGridField event = new ListGridField("event", CallCenter.constants.moonPhase(), 150); ListGridField state = new ListGridField("state", CallCenter.constants.type(), 80); ListGridField sun_rise = new ListGridField("sun_rise", CallCenter.constants.sunRise(), 100); ListGridField calendar_description = new ListGridField("calendar_description", CallCenter.constants.description(), 250); calendar_day.setAlign(Alignment.LEFT); event.setAlign(Alignment.LEFT); state.setAlign(Alignment.CENTER); sun_rise.setAlign(Alignment.CENTER); listGrid.setFields(calendar_day, event, state, sun_rise, calendar_description); mainLayout.addMember(listGrid); findButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { search(); } }); clearButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { calendarStateItem.clearValue(); secCalendarTypeItem.clearValue(); calendarDayItem.clearValue(); descriptionItem.clearValue(); commentItem.clearValue(); } }); addBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, null, false); dlgEditSecCalendar.show(); } }); editBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, listGridRecord, false); dlgEditSecCalendar.show(); } }); copyBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, listGridRecord, true); dlgEditSecCalendar.show(); } }); disableBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } Integer deleted = listGridRecord.getAttributeAsInt("deleted"); if (!deleted.equals(0)) { SC.say(CallCenter.constants.recordAlrDisabled()); return; } final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id"); SC.ask( CallCenter.constants.askForDisable(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { changeStatus(calendar_id, 1); } } }); } }); activateBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } Integer deleted = listGridRecord.getAttributeAsInt("deleted"); if (deleted.equals(0)) { SC.say(CallCenter.constants.recordAlrEnabled()); return; } final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id"); SC.ask( CallCenter.constants.askForEnable(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { changeStatus(calendar_id, 0); } } }); } }); TabSet tabSet = new TabSet(); tabSet.setWidth(780); Tab tabDetViewer = new Tab(CallCenter.constants.view()); final DetailViewer detailViewer = new DetailViewer(); detailViewer.setDataSource(datasource); detailViewer.setWidth(750); tabDetViewer.setPane(detailViewer); listGrid.addRecordClickHandler( new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { detailViewer.viewSelectedData(listGrid); } }); listGrid.addRecordDoubleClickHandler( new RecordDoubleClickHandler() { @Override public void onRecordDoubleClick(RecordDoubleClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, listGridRecord, false); dlgEditSecCalendar.show(); } }); tabSet.setTabs(tabDetViewer); mainLayout.addMember(tabSet); setPane(mainLayout); } catch (Exception e) { e.printStackTrace(); SC.say(e.getMessage().toString()); } }
public DlgSortOrderOrgs(TabOrganization tabOrganization, Record records[]) { try { this.tabOrganization = tabOrganization; setTitle(CallCenter.constants.sortOrgs()); setHeight(710); setWidth(1000); setShowMinimizeButton(false); setIsModal(true); setShowModalMask(true); setCanDrag(false); setCanDragReposition(false); setCanDragResize(false); setCanDragScroll(false); centerInPage(); hLayout = new VLayout(5); hLayout.setWidth100(); hLayout.setHeight100(); hLayout.setPadding(10); // ToolStrip toolStrip = new ToolStrip(); // toolStrip.setWidth100(); // toolStrip.setPadding(5); // hLayout.addMember(toolStrip); // // upBtn = new ToolStripButton(CallCenter.constants.sortUp(), // "sortUp.png"); // upBtn.setLayoutAlign(Alignment.LEFT); // upBtn.setWidth(50); // toolStrip.addButton(upBtn); // // downBtn = new ToolStripButton(CallCenter.constants.sortDown(), // "sortDown.png"); // downBtn.setLayoutAlign(Alignment.LEFT); // downBtn.setWidth(50); // toolStrip.addButton(downBtn); listGrid = new ListGrid() { protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) { ListGridRecord countryRecord = (ListGridRecord) record; if (countryRecord == null) { return super.getCellCSSText(record, rowNum, colNum); } Integer deleted = countryRecord.getAttributeAsInt("deleted"); if (deleted != null && !deleted.equals(0)) { return "color:red;"; } else { Integer statuse = countryRecord.getAttributeAsInt("statuse"); switch (statuse) { case 1: // not functions return "color:pink;"; case 2: // disabled return "text-decoration:line-through;"; default: return super.getCellCSSText(record, rowNum, colNum); } } }; }; listGrid.setWidth100(); listGrid.setHeight(625); listGrid.setCanReorderRecords(true); listGrid.setCanAcceptDroppedRecords(true); listGrid.setAutoSaveEdits(false); listGrid.setCanSelectAll(false); listGrid.setData(records); ListGridField nameField = new ListGridField("org_name", CallCenter.constants.orgName(), 400); ListGridField identcode = new ListGridField("identcode", CallCenter.constants.identCode(), 150); ListGridField director = new ListGridField("director", CallCenter.constants.director(), 150); ListGridField real_address = new ListGridField("real_address", CallCenter.constants.orgAddress(), 230); identcode.setAlign(Alignment.CENTER); director.setAlign(Alignment.CENTER); real_address.setAlign(Alignment.LEFT); listGrid.setFields(nameField, identcode, director, real_address); hLayout.addMember(listGrid); HLayout hLayoutItem = new HLayout(5); hLayoutItem.setWidth100(); hLayoutItem.setAlign(Alignment.RIGHT); IButton saveItem = new IButton(); saveItem.setTitle(CallCenter.constants.save()); saveItem.setWidth(100); IButton cancItem = new IButton(); cancItem.setTitle(CallCenter.constants.close()); cancItem.setWidth(100); hLayoutItem.setMembers(saveItem, cancItem); hLayout.addMember(hLayoutItem); cancItem.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { destroy(); } }); saveItem.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { save(); } }); addItem(hLayout); } catch (Exception e) { e.printStackTrace(); SC.say(e.toString()); } }
public Canvas getViewPanel() { VLayout layout = new VLayout(15); layout.setWidth(650); layout.setAutoHeight(); final ListGrid countryGrid = new ListGrid(); countryGrid.setLeaveScrollbarGap(true); countryGrid.setCanFreezeFields(false); countryGrid.setCanGroupBy(false); countryGrid.setWidth100(); countryGrid.setHeight(224); countryGrid.setDataSource(CountryXmlDS.getInstance()); countryGrid.setAutoFetchData(true); // allow users to add formula and summary fields // accessible in the grid header context menu countryGrid.setCanAddFormulaFields(true); countryGrid.setCanAddSummaryFields(true); ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 50); countryCodeField.setAlign(Alignment.CENTER); countryCodeField.setType(ListGridFieldType.IMAGE); countryCodeField.setImageURLPrefix("flags/16/"); countryCodeField.setImageURLSuffix(".png"); countryCodeField.setCanSort(false); ListGridField nameField = new ListGridField("countryName", "Country"); ListGridField capitalField = new ListGridField("capital", "Capital"); ListGridField populationField = new ListGridField("population", "Population"); populationField.setCellFormatter( new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) return null; try { NumberFormat nf = NumberFormat.getFormat("0,000"); return nf.format(((Number) value).longValue()); } catch (Exception e) { return value.toString(); } } }); ListGridField areaField = new ListGridField("area", "Area (km²)"); areaField.setType(ListGridFieldType.INTEGER); areaField.setCellFormatter( new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) return null; String val = null; try { NumberFormat nf = NumberFormat.getFormat("0,000"); val = nf.format(((Number) value).longValue()); } catch (Exception e) { return value.toString(); } return val + "km²"; } }); countryGrid.setFields(countryCodeField, nameField, capitalField, populationField, areaField); ToolStripButton formulaButton = new ToolStripButton("Formula Builder", "crystal/oo/sc_insertformula.png"); formulaButton.setAutoFit(true); formulaButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { countryGrid.addFormulaField(); } }); ToolStripButton summaryBuilder = new ToolStripButton("Summary Builder", "crystal/16/apps/tooloptions.png"); summaryBuilder.setAutoFit(true); summaryBuilder.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { countryGrid.addSummaryField(); } }); ToolStripButton savePreference = new ToolStripButton("Persist State", "silk/database_gear.png"); savePreference.setAutoFit(true); savePreference.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { String viewState = countryGrid.getViewState(); Offline.put("exampleState", viewState); SC.say("Preferences persisted."); } }); // toolstrip to attach to the country grid ToolStrip countryGridToolStrip = new ToolStrip(); countryGridToolStrip.setWidth100(); countryGridToolStrip.addFill(); countryGridToolStrip.addButton(formulaButton); countryGridToolStrip.addButton(summaryBuilder); countryGridToolStrip.addSeparator(); countryGridToolStrip.addButton(savePreference); VLayout countryGridLayout = new VLayout(0); countryGridLayout.setWidth(650); countryGridLayout.addMember(countryGridToolStrip); countryGridLayout.addMember(countryGrid); layout.addMember(countryGridLayout); final String previouslySavedState = (String) Offline.get("exampleState"); if (previouslySavedState != null) { countryGrid.addDrawHandler( new DrawHandler() { @Override public void onDraw(DrawEvent event) { // restore any previously saved view state for this grid countryGrid.setViewState(previouslySavedState); } }); } return layout; }
public Tasks() { super(); SectionStack sectionStack = new SectionStack(); sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE); sectionStack.setWidth100(); sectionStack.setHeight100(); sections = new SectionStackSection[3]; for (int i = 0; i < 2; i++) { sections[i] = new SectionStackSection(i == 0 ? "My Tasks" : "Available Tasks"); sections[i].setExpanded(true); sections[i].setResizeable(false); ListGridField complete = new ListGridField("complete", " "); complete.setType(ListGridFieldType.BOOLEAN); complete.setCanEdit(true); complete.setCanToggle(true); if (i == 0) { final MyTasksListGrid taskgrid = new MyTasksListGrid(); taskgrid.setWidth100(); taskgrid.setHeight100(); taskgrid.setCanExpandRecords(true); taskgrid.setCanExpandMultipleRecords(false); taskgrid.setExpansionMode(ExpansionMode.DETAILS); taskgrid.setShowAllRecords(true); taskgrid.setExpansionCanEdit(true); taskgrid.addCellDoubleClickHandler( new CellDoubleClickHandler() { public void onCellDoubleClick(CellDoubleClickEvent event) { taskgrid.expandRecord(taskgrid.getRecord(event.getRowNum())); } }); ListGridField processIntanceID = new ListGridField("$#processInstanceId", "Workflow"); processIntanceID.setBaseStyle("linkLabel"); processIntanceID.addRecordClickHandler( new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { Object[] args = {event.getValue(), true}; PageManager.getInstance().setPageHistory(Pages.VIEWWORKFLOW, args); } }); taskgrid.setFields( complete, new ListGridField("taskname", "Name"), new ListGridField("$#createTime", "Time"), new ListGridField("$#priority", "Priority"), new ListGridField("$#assignee", "Assignee"), new ListGridField("$#activityName", "ActivityName"), processIntanceID); sections[i].addItem(taskgrid); } else { CustomListGrid grid = new CustomListGrid(); grid.setWidth100(); grid.setHeight100(); grid.setCanExpandRecords(true); grid.setCanExpandMultipleRecords(false); grid.setExpansionMode(ExpansionMode.DETAILS); grid.setShowAllRecords(true); complete.addRecordClickHandler(getRecordClickHandler(grid, i == 1)); grid.setShowRecordComponents(true); grid.setShowRecordComponentsByCell(true); ListGridField assign = new ListGridField("Assign", "Assign"); assign.setAlign(Alignment.CENTER); grid.setFields( complete, new ListGridField("taskname", "Name"), new ListGridField("$#createTime", "Time"), new ListGridField("$#priority", "Priority"), assign); sections[i].addItem(grid); } } sections[2] = new SectionStackSection("Event Log"); sections[2].setExpanded(true); sections[2].setResizeable(false); ListGrid grid = new ListGrid(); grid.setWidth100(); grid.setHeight100(); grid.setCanExpandRecords(false); grid.setShowAllRecords(true); grid.setCanEdit(false); grid.setFields( new ListGridField("$#endTime", "Time"), new ListGridField("$#id", "Task"), new ListGridField("$#assignee", "User"), new ListGridField("$#state", "Action"), new ListGridField("outcome", "Outcome"), new ListGridField("$#processInstanceId", "Workflow")); sections[2].addItem(grid); sectionStack.addSection(sections[0]); sectionStack.addSection(sections[1]); sectionStack.addSection(sections[2]); BpmServiceMain.sendGet( "/processInstances/tasks?assignee=" + BpmServiceMain.getUser(), new AsyncCallback<String>() { public void onFailure(Throwable arg0) {} public void onSuccess(String arg0) { ArrayList<Task> tasks = Parse.parseProcessTasks(arg0); records1 = new ListGridRecord[MAX_TASKS]; int i = 0; for (Task t : tasks) { records1[i++] = createLGR(false, t); } ((MyTasksListGrid) sections[0].getItems()[0]).setData(records1); } }); BpmServiceMain.sendGet( "/processInstances/tasks?candidate=" + BpmServiceMain.getUser(), new AsyncCallback<String>() { public void onFailure(Throwable arg0) {} public void onSuccess(String arg0) { ArrayList<Task> tasks = Parse.parseProcessTasks(arg0); records2 = new ListGridRecord[MAX_TASKS]; int i = 0; for (Task t : tasks) { records2[i++] = createLGR(false, t); } ((CustomListGrid) sections[1].getItems()[0]).setData(records2); } }); int dayLength = 24 * 60 * 60 * 1000; Date d = new Date(); d.setTime(d.getTime() + dayLength); String end = (1900 + d.getYear()) + "-" + (d.getMonth() < 9 ? "0" : "") + (d.getMonth() + 1) + "-" + (d.getDate() < 9 ? "0" : "") + d.getDate(); d = new Date(); d.setTime(d.getTime() - dayLength * 3); String start = (1900 + d.getYear()) + "-" + (d.getMonth() < 9 ? "0" : "") + (d.getMonth() + 1) + "-" + (d.getDate() < 9 ? "0" : "") + d.getDate(); BpmServiceMain.sendGet( "/tasks/history?assignee=" + BpmServiceMain.getUser() + "&start=" + start + "&end=" + end, new AsyncCallback<String>() { public void onFailure(Throwable arg0) {} public void onSuccess(String arg0) { ArrayList<Task> tasks = Parse.parseTasks(arg0); records3 = new ListGridRecord[MAX_TASKS]; int i = 0; for (Task t : tasks) { records3[i++] = createLGR(true, t); } ((ListGrid) sections[2].getItems()[0]).setData(records3); ((ListGrid) sections[2].getItems()[0]).sort(0, SortDirection.DESCENDING); } }); createPage(sectionStack, PageWidget.PAGE_TASKS); timer = new Timer() { public void run() { updateTasks(); } }; timer.scheduleRepeating(BpmServiceMain.getPollingRate()); }