Package com.smartgwt.client.data

Examples of com.smartgwt.client.data.RecordList


                    .append(FIELD_SLOWEST).append(',') //
                    .append(FIELD_AVERAGE).append(',') //
                    .append(FIELD_FASTEST).append(',') //
                    .append(FIELD_STDDEV).append('\n');

                RecordList records = getListGrid().getDataAsRecordList();
                int recordsSize = records.getLength();
                for (int i = 0; i < recordsSize; i++) {
                    Record record = records.get(i);
                    csv.append(record.getAttribute(FIELD_SERVICENAME)).append(',') //
                        .append(record.getAttribute(FIELD_METHODNAME)).append(',') //
                        .append(record.getAttribute(FIELD_COUNT)).append(',') //
                        .append(record.getAttribute(FIELD_SLOWEST)).append(',') //
                        .append(record.getAttribute(FIELD_AVERAGE)).append(',') //
View Full Code Here


        deleteDriftDefinitionsByName(driftDefNames);
    }

    private void deleteAll() {
        final RecordList records = getListGrid().getDataAsRecordList();
        final int numRecords = records.getLength();
        final String[] driftDefNames = new String[numRecords];
        for (int i = 0; i < numRecords; i++) {
            Record record = records.get(i);
            String driftDefName = record.getAttribute(DriftDefinitionDataSource.ATTR_NAME);
            driftDefNames[i] = driftDefName;
        }

        deleteDriftDefinitionsByName(driftDefNames);
View Full Code Here

            public void executeAction(ListGridRecord[] selection, Object actionValue) {
                final String s = "~";
                StringBuilder csv = new StringBuilder();
                csv.append(FIELD_ID).append(s).append(FIELD_NAME).append(s).append(FIELD_VALUE).append('\n');

                RecordList records = getListGrid().getDataAsRecordList();
                int recordsSize = records.getLength();
                for (int i = 0; i < recordsSize; i++) {
                    Record record = records.get(i);
                    csv.append(record.getAttribute(FIELD_ID)).append(s).append(record.getAttribute(FIELD_NAME))
                        .append(s).append(record.getAttribute(FIELD_VALUE)).append('\n');
                }

                new MessageWindow("Export To CSV", "<pre>" + csv.toString() + "</pre>").show();
View Full Code Here

                    .append(FIELD_STATUS).append(',') //
                    .append(FIELD_TOTAL_ROWS).append(',') //
                    .append(FIELD_START_ROW).append(',') //
                    .append(FIELD_END_ROW).append('\n');

                RecordList records = getListGrid().getDataAsRecordList();
                int recordsSize = records.getLength();
                for (int i = 0; i < recordsSize; i++) {
                    Record record = records.get(i);
                    csv.append(record.getAttributeAsDate(FIELD_TIMESTAMP)).append(',') //
                        .append(record.getAttribute(FIELD_REQUEST_ID)).append(',') //
                        .append(record.getAttribute(FIELD_STATUS)).append(',') //
                        .append(record.getAttribute(FIELD_TOTAL_ROWS)).append(',') //
                        .append(record.getAttribute(FIELD_START_ROW)).append(',') //
View Full Code Here

            public void onClick(ClickEvent event) {
                ListGridRecord selectedRecord = myList2.getSelectedRecord();
                if(selectedRecord != null) {
                    int idx = myList2.getRecordIndex(selectedRecord);
                    if(idx > 0) {
                        RecordList rs = myList2.getRecordList();
                        rs.removeAt(idx);
                        rs.addAt(selectedRecord, idx - 1);
                    }
                }
            }
        });

        TransferImgButton upFirst = new TransferImgButton(TransferImgButton.UP_FIRST);
        upFirst.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                ListGridRecord selectedRecord = myList2.getSelectedRecord();
                if(selectedRecord != null) {
                    int idx = myList2.getRecordIndex(selectedRecord);
                    if(idx > 0) {
                        RecordList rs = myList2.getRecordList();
                        rs.removeAt(idx);
                        rs.addAt(selectedRecord, 0);
                    }
                }
            }
        });

        TransferImgButton down = new TransferImgButton(TransferImgButton.DOWN);
        down.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                ListGridRecord selectedRecord = myList2.getSelectedRecord();
                if(selectedRecord != null) {
                    RecordList rs = myList2.getRecordList();
                    int numRecords = rs.getLength();
                    int idx = myList2.getRecordIndex(selectedRecord);
                    if(idx < numRecords - 1) {
                        rs.removeAt(idx);
                        rs.addAt(selectedRecord, idx + 1);
                    }
                }
            }
        });

        TransferImgButton downLast = new TransferImgButton(TransferImgButton.DOWN_LAST);
        downLast.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                ListGridRecord selectedRecord = myList2.getSelectedRecord();
                if(selectedRecord != null) {
                    RecordList rs = myList2.getRecordList();
                    int numRecords = rs.getLength();
                    int idx = myList2.getRecordIndex(selectedRecord);
                    if(idx < numRecords - 1) {
                        rs.removeAt(idx);
                        rs.addAt(selectedRecord, rs.getLength() -1);
                    }
                }
            }
        });
View Full Code Here

                   
                    grid.deselectAllRecords();
                    String value = (String) event.getDisplayValue();
                    if (value==null) return;
                   
                    RecordList recordList = grid.getDataAsRecordList();
                    int index = recordList.findIndex(item.getFieldName(), value);
                    grid.selectRecord(index);
                }
            });
           
            setInitHandler(new FormItemInitHandler () {
                @Override
                public void onInit(FormItem item) {
                    ListGrid grid = new ListGrid();
                    grid.setWidth("*");
                    grid.setHeight("*");
                    grid.setLeaveScrollbarGap(false);
                    grid.setFields(((ListGridItem) item).getGridFields());
                    grid.setData(((ListGridItem)item).getGridData());
                    grid.setAutoFetchData(true);
                   
                    grid.addDrawHandler(new DrawHandler() {
                        @Override
                        public void onDraw(DrawEvent event) {
                            ListGrid grid = (ListGrid)event.getSource();
                            RecordList data = grid.getDataAsRecordList();
                            CanvasItem item = grid.getCanvasItem();
                            String value = (String)item.getValue();
                            String fieldName = item.getFieldName();
                            if (value != null) grid.selectRecord(data.find(fieldName, value));                           
                        }
                    });
                   
                    grid.addSelectionUpdatedHandler(new SelectionUpdatedHandler() {
                        @Override
View Full Code Here

                    if (gridFields != null) grid.setFields(getGridFields());
                    if (gridSortField != null) grid.setSortField(getGridSortField());
                    grid.setSortDirection(SortDirection.ASCENDING);
                   
                    // The form item's data is set to a list of records
                    RecordList value = (RecordList) item.getValue();
                    if (value != null) grid.setData(value);
                   
                    grid.setCanEdit(true);
                    grid.setSaveLocally(true);
                   
                    grid.addCellSavedHandler(new CellSavedHandler() {
                        @Override
                        public void onCellSaved(CellSavedEvent event) {
                            ListGrid grid = (ListGrid) event.getSource();
                            GridEditorItem item = (GridEditorItem) grid.getCanvasItem();
                            RecordList data = grid.getDataAsRecordList();
                            item.storeValue(data);
                           
                            if (item.getGridSortField() == null) return;
                            grid.sort(item.getGridSortField(), SortDirection.ASCENDING);
                        }
                    });
                   
                    setCanvas(grid);
                   
                    addShowValueHandler(new ShowValueHandler() {
                        @Override
                        public void onShowValue(ShowValueEvent event) {
                            ListGrid grid = (ListGrid)((CanvasItem)event.getSource()).getCanvas();
                            RecordList records = event.getDataValueAsRecordList();
                            if (records != null && grid != null) grid.setData(records);
                        }
                    });
                }
            });
View Full Code Here

    }
   
    private RecordList orderItemData;
    private RecordList getOrderItemData(int orderID) {
        if (orderItemData == null) {
            orderItemData  = new RecordList();
           
            orderItemData.addList(new ListGridRecord[] {
                new ListGridRecord () {{
                    setAttribute("pk", 0);
                    setAttribute("orderID", 0);
                    setAttribute("itemDescription", "Yellow Widget");
                    setAttribute("unitPrice", 23.01);
                }},
                new ListGridRecord () {{
                    setAttribute("pk", 1);
                    setAttribute("orderID", 0);
                    setAttribute("itemDescription", "Green Widget");
                    setAttribute("unitPrice", 28.99);
                }},
                new ListGridRecord () {{
                    setAttribute("pk", 2);
                    setAttribute("orderID", 1);
                    setAttribute("itemDescription", "Red Widget");
                    setAttribute("unitPrice", 100);
                }},
                new ListGridRecord () {{
                    setAttribute("pk", 3);
                    setAttribute("orderID", 1);
                    setAttribute("itemDescription", "Orange Widget");
                    setAttribute("unitPrice", 48.22);
                }},
                new ListGridRecord () {{
                    setAttribute("pk", 4);
                    setAttribute("orderID", 2);
                    setAttribute("itemDescription", "Yellow Widget");
                    setAttribute("unitPrice", 23.01);
                }}
            });
        }
        return new RecordList(orderItemData.findAll("orderID", orderID));
    }
View Full Code Here

   * com.cubusmail.client.events.MessageLoadedListener#onMessageLoaded(com
   * .cubusmail.common.model.GWTMessage)
   */
  public void onMessageLoaded( GWTMessage message ) {

    RecordList list = this.grid.getRecordList();
    if ( list != null && list.getLength() > 0 ) {
      MessageGridRecord record = (MessageGridRecord) list.find( MessageListFields.ID.name(), String
          .valueOf( message.getId() ) );
      if ( record != null ) {
        GWTMessageRecord source = message.getMessageRecord();
        int index = this.grid.getRecordIndex( record );
        if ( index > -1 ) {
View Full Code Here

TOP

Related Classes of com.smartgwt.client.data.RecordList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.