Package com.smartgwt.client.data

Examples of com.smartgwt.client.data.DataSource


    layout.addMember(map);
    return layout;
  }

  private DataSource getGeocoderSelectDataSource() {
    DataSource dataSource = new DataSource();
    dataSource.setClientOnly(true);
    DataSourceField label = new DataSourceTextField(FIELD_LABEL);
    DataSourceField regex = new DataSourceTextField(FIELD_REGEX);
    dataSource.setFields(label, regex);

    Record record;
    record = new Record();
    record.setAttribute(FIELD_LABEL, "all");
    record.setAttribute(FIELD_REGEX, ".*");
    dataSource.addData(record);
    record = new Record();
    record.setAttribute(FIELD_LABEL, "Yahoo! PlaceFinder");
    record.setAttribute(FIELD_REGEX, "yahoo");
    dataSource.addData(record);
    record = new Record();
    record.setAttribute(FIELD_LABEL, "GeoNames");
    record.setAttribute(FIELD_REGEX, "geonames");
    dataSource.addData(record);
    record = new Record();
    record.setAttribute(FIELD_LABEL, "offline");
    record.setAttribute(FIELD_REGEX, "offline");
    dataSource.addData(record);

    return dataSource;
  }
View Full Code Here


        dataSource.setClientOnly(false);
        super.setDataSource(dataSource);
      }
    };
    formWidget.setStyleName(STYLE_FEATURE_FORM);
    DataSource source = new DataSource();
    FormItemList formItems = new FormItemList();
    for (AttributeInfo info : featureInfo.getAttributes()) {
      if (isIncluded(info)) {
        formItems.add(createItem(info));
        source.addField(createField(info));
      }
    }
    prepareForm(formItems, source);
    getWidget().setDataSource(source);
    getWidget().setFields(formItems.toArray());
View Full Code Here

                try {
                    long fetchTime = System.currentTimeMillis() - startTime;
                    Log.debug(result.size() + " saved searches fetched in: " + fetchTime + "ms");

                    ListGrid searchBarPickListGrid = searchBar.getPickListGrid();
                    DataSource ds = searchBarPickListGrid.getDataSource();

                    if (null == ds) {
                        ds = new DataSource();
                        ds.setClientOnly(true);
                        DataSourceTextField valueField = new DataSourceTextField(ATTR_ID, "Id");
                        valueField.setPrimaryKey(true);
                        ds.setFields(valueField);
                        searchBarPickListGrid.setDataSource(ds);

                    } else {
                        ds.invalidateCache();
                    }

                    for (SavedSearch savedSearch : result) {
                        Log.debug("savedSearch: " + savedSearch.getName());
                        ListGridRecord record = new ListGridRecord();
                        record.setAttribute(ATTR_ID, savedSearch.getId());
                        record.setAttribute(ATTR_KIND, "Saved");
                        record.setAttribute(ATTR_NAME, savedSearch.getName());
                        record.setAttribute(ATTR_DESCRIPTION, savedSearch.getDescription());
                        record.setAttribute(ATTR_PATTERN, savedSearch.getPattern());
                        if (savedSearch.getResultCount() != null)
                            record.setAttribute(ATTR_RESULT_COUNT, savedSearch.getResultCount());
                        ds.addData(record);
                    }

                    try {
                        searchBarPickListGrid.setData(new ListGridRecord[] {});
                        searchBarPickListGrid.fetchData();
View Full Code Here

                @Override
                public void onSuccess(List<SearchSuggestion> results) {

                    try {
                        ListGrid searchBarPickListGrid = searchBar.getPickListGrid();
                        DataSource ds = searchBarPickListGrid.getDataSource();

                        // create the datasource if needed
                        if (null == ds) {
                            ds = new DataSource();
                            ds.setClientOnly(true);
                            DataSourceTextField idField = new DataSourceTextField(ATTR_ID, "Id");
                            idField.setPrimaryKey(true);
                            idField.setCanView(false);

                            DataSourceTextField valueField = new DataSourceTextField(ATTR_VALUE, "Value");

                            ds.setFields(idField, valueField);

                            searchBarPickListGrid.setDataSource(ds);
                            searchBarPickListGrid.getField(ATTR_VALUE).setShowHover(true);
                            searchBarPickListGrid.getField(ATTR_VALUE).setHoverCustomizer(new HoverCustomizer() {

                                public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
                                    if (null == record) {
                                        return "";
                                    }
                                    String kind = record.getAttribute(ATTR_KIND);
                                    if (kind.equals("SAVED") || kind.equals("GLOBAL")) {
                                        String pattern = record.getAttribute(ATTR_PATTERN);

                                        if (!(null == pattern || pattern.isEmpty())) {
                                            return pattern;
                                        }
                                    }

                                    return "";
                                }
                            });

                        } else {
                            ds.invalidateCache();
                        }

                        for (SearchSuggestion searchSuggestion : results) {
                            Log.debug("search tab aware Suggestions: " + searchSuggestion.getKind() + ", "
                                + searchSuggestion.getValue() + ", " + searchSuggestion.getLabel());
                            ListGridRecord record = new ListGridRecord();
                            record.setAttribute(ATTR_ID, searchSuggestion.getValue());
                            if (null != searchSuggestion.getKind()) {
                                record.setAttribute(ATTR_KIND, searchSuggestion.getKind().getDisplayName());
                            }
                            record.setAttribute(ATTR_NAME, searchSuggestion.getLabel());
                            record.setAttribute(ATTR_VALUE, searchSuggestion.getValue());
                            String pattern = searchSuggestion.getOptional();
                            record.setAttribute(ATTR_PATTERN, (null == pattern) ? "" : pattern);
                            ds.addData(record);
                        }

                        try {
                            searchBarPickListGrid.setData(new ListGridRecord[] {});
                            searchBarPickListGrid.fetchData();
View Full Code Here

        }
    }

    public Canvas getViewPanel() {

        DataSource dataSource = ItemSupplyXmlDS.getInstance();

        final ListGrid listGrid = new ListGrid();
        listGrid.setUseAllDataSourceFields(true);
        listGrid.setDataSource(dataSource);
        listGrid.setAutoFetchData(true);
View Full Code Here

        label.setHeight(10);
        label.setWidth100();
        label.setContents("Showing items in Category 'Rollfix Glue");
        layout.addMember(label);

        final DataSource dataSource = ItemSupplyLocalDS.getInstance();

        final ListGrid listGrid = new ListGrid();
        listGrid.setWidth100();
        listGrid.setHeight(200);
        listGrid.setDataSource(dataSource);
View Full Code Here

        return layout;
    }

    private void loadXMLSchemaReply(SchemaSet schemaSet, ListGrid listGrid, DynamicForm dynamicForm, IButton validateButton) {
        DataSource schemaDS = schemaSet.getSchema("supplyItem");

        DataSource dataSource = new DataSource();
        dataSource.setInheritsFrom(schemaDS);
        dataSource.setUseParentFieldOrder(true);

        DataSourceTextField itemID = new DataSourceTextField("itemId");
        itemID.setHidden(true);
        itemID.setPrimaryKey(true);

        DataSourceTextField itemName = new DataSourceTextField("itemName", "item name");
        DataSourceDateField nextShipment = new DataSourceDateField("nextShipment", "next shipment");
        nextShipment.setUseTextField(true);

        dataSource.setFields(itemID, itemName, nextShipment);

        listGrid.setDataSource(dataSource);
        dynamicForm.setDataSource(dataSource);

        // to demonstrate grid editors, add sample data and start editing
View Full Code Here

        label.setHeight(10);
        label.setWidth100();
        label.setContents("Showing items in Category 'Rollfix Glue");
        layout.addMember(label);

        final DataSource dataSource = ItemSupplyLocalDS.getInstance();

        ListGrid listGrid = new ListGrid();
        listGrid.setWidth100();
        listGrid.setHeight(200);
        listGrid.setDataSource(dataSource);
View Full Code Here

        label.setHeight(10);
        label.setWidth100();
        label.setContents("Showing items in Category 'Rollfix Glue");
        layout.addMember(label);

        final DataSource dataSource = ItemSupplyLocalDS.getInstance();

        final DynamicForm form = new DynamicForm();
        form.setIsGroup(true);
        form.setGroupTitle("Update");
        form.setNumCols(4);
View Full Code Here

        }
    }
     
    public Canvas getViewPanel() {
     
        DataSource dataSource = new DataSource();
       
        IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator();
        integerRangeValidator.setMin(1);
        integerRangeValidator.setMax(20);
       
        DataSourceIntegerField dsIntegerField = new DataSourceIntegerField("intField");
        dsIntegerField.setTitle("Integer");
        dsIntegerField.setValidators(integerRangeValidator);
       
        dataSource.setFields(dsIntegerField);
       
        final DynamicForm form = new DynamicForm();
        form.setWidth(300);
        form.setDataSource(dataSource);
       
View Full Code Here

TOP

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

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.