Package com.smartgwt.client.widgets.grid

Examples of com.smartgwt.client.widgets.grid.ListGrid


        }
    }

    public Canvas getViewPanel() {

        ListGrid countryGrid = new ListGrid();
        countryGrid.setWidth100();
        countryGrid.setHeight100();
        countryGrid.setShowAllRecords(true);
        countryGrid.setWrapCells(true);
        countryGrid.setCellHeight(56);

        ListGridField nameField = new ListGridField("countryName", "Country", 120);
        ListGridField backgroundField = new ListGridField("background", "Background");
        ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 50);
        countryCodeField.setAlign(Alignment.CENTER);
        countryCodeField.setType(ListGridFieldType.IMAGE);
        countryCodeField.setImageSize(24);
        countryCodeField.setImageURLPrefix("flags/24/");
        countryCodeField.setImageURLSuffix(".png");

        countryGrid.setFields(nameField, backgroundField, countryCodeField);

        countryGrid.setData(CountryData.getRecords());
        return countryGrid;
    }
View Full Code Here


    public Canvas getViewPanel() {

        Canvas canvas = new Canvas();

        final ListGrid countryGrid = new ListGrid();
        countryGrid.setWidth(500);
        countryGrid.setHeight(224);
        countryGrid.setShowAllRecords(true);
        countryGrid.setTop(50);

        ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 40);
        countryCodeField.setAlign(Alignment.CENTER);
        countryCodeField.setType(ListGridFieldType.IMAGE);
        countryCodeField.setImageURLPrefix("flags/16/");
        countryCodeField.setImageURLSuffix(".png");

        ListGridField nameField = new ListGridField("countryName", "Country");
        ListGridField capitalField = new ListGridField("capital", "Capital");
        ListGridField continentField = new ListGridField("continent", "Continent");
        countryGrid.setFields(countryCodeField, nameField, capitalField, continentField);
        countryGrid.setCanResizeFields(true);
        countryGrid.setData(CountryData.getRecords());
        canvas.addChild(countryGrid);

        IButton nameButton = new IButton("\"Name\"");
        nameButton.setLeft(0);
        nameButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                countryGrid.setFieldTitle("countryName", "Name");
            }
        });
        canvas.addChild(nameButton);

        IButton countryButton = new IButton("\"Country\"");
        countryButton.setLeft(120);
        countryButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                countryGrid.setFieldTitle("countryName", "Country");
            }
        });
        canvas.addChild(countryButton);

        return canvas;
View Full Code Here

                    serverCountLabel.setBackgroundColor("ffffff");
                }
            }.schedule(500);
        }*/

        final ListGrid supplyItemGrid = new ListGrid();
        supplyItemGrid.setWidth(500);
        supplyItemGrid.setHeight(300);
        supplyItemGrid.setAutoFetchData(true);
        supplyItemGrid.setShowFilterEditor(true);
        supplyItemGrid.setFilterOnKeypress(true);
        supplyItemGrid.setFetchDelay(500);
        supplyItemGrid.setDataSource(supplyXmlDS);

        ListGridField skuField = new ListGridField("SKU", 100);
        ListGridField nameField = new ListGridField("itemName", 150);
        ListGridField descriptionField = new ListGridField("description", 250);
        ListGridField categoryField = new ListGridField("category", 100);

        supplyItemGrid.setFields(skuField, nameField, descriptionField, categoryField );
               
        canvas.addChild(supplyItemGrid);
        canvas.addChild(serverCountLabel);

        return canvas;
View Full Code Here

    public Canvas getViewPanel() {

        Canvas canvas = new Canvas();

        final ListGrid countryGrid = new ListGrid();
        countryGrid.setWidth(500);
        countryGrid.setHeight(224);
        countryGrid.setTop(50);
        countryGrid.setShowAllRecords(true);
        countryGrid.setShowEmptyMessage(true);
        countryGrid.setEmptyMessage("<br>Click the <b>Set data</b> button to populate this grid.");

        ListGridField nameField = new ListGridField("countryName", "Country", 120);
        ListGridField capitalField = new ListGridField("capital", "Capital");
        ListGridField continentField = new ListGridField("continent", "Continent");
        ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 50);
        countryCodeField.setAlign(Alignment.CENTER);
        countryCodeField.setType(ListGridFieldType.IMAGE);
        countryCodeField.setImageURLPrefix("flags/16/");
        countryCodeField.setImageURLSuffix(".png");
        countryGrid.setFields(countryCodeField, nameField, capitalField, continentField);

        canvas.addChild(countryGrid);

        IButton setDataButton = new IButton("Set Data");
        setDataButton.setLeft(0);
        setDataButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                countryGrid.setData(CountryData.getRecords());
            }
        });
        canvas.addChild(setDataButton);

        IButton clearDataButton = new IButton("Clear Data");
        clearDataButton.setLeft(120);
        clearDataButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                countryGrid.setData(new ListGridRecord[]{});
            }
        });
        canvas.addChild(clearDataButton);

        return canvas;
View Full Code Here

    public Canvas getViewPanel() {

        Canvas canvas = new Canvas();

        final ListGrid countryGrid = new ListGrid();
        countryGrid.setWidth(500);
        countryGrid.setHeight(1);
        countryGrid.setTop(50);
        countryGrid.setShowAllRecords(true);
        countryGrid.setBodyOverflow(Overflow.VISIBLE);
        countryGrid.setOverflow(Overflow.VISIBLE);
        countryGrid.setLeaveScrollbarGap(false);

        ListGridField nameField = new ListGridField("countryName", "Country", 120);
        ListGridField backgroundField = new ListGridField("background", "Background");
        ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 50);
        countryCodeField.setAlign(Alignment.CENTER);
        countryCodeField.setType(ListGridFieldType.IMAGE);
        countryCodeField.setImageURLPrefix("flags/16/");
        countryCodeField.setImageURLSuffix(".png");

        countryGrid.setFields(nameField, backgroundField, countryCodeField);

        canvas.addChild(countryGrid);

        final CountryRecord[] records = CountryData.getRecords();

        final CountryRecord[] records5 = new CountryRecord[5];
        System.arraycopy(records, 0, records5, 0, 5);

        final CountryRecord[] records10 = new CountryRecord[10];
        System.arraycopy(records, 0, records10, 0, 10);

        IButton show5Button = new IButton("Show 5");
        show5Button.setLeft(0);
        show5Button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                countryGrid.setData(records5);
            }
        });
        canvas.addChild(show5Button);

        IButton show10Button = new IButton("Show 10");
        show10Button.setLeft(120);
        show10Button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                countryGrid.setData(records10);
            }
        });
        canvas.addChild(show10Button);

        IButton showAllButton = new IButton("Show All");
        showAllButton.setLeft(240);
        showAllButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                countryGrid.setData(records);
            }
        });
        canvas.addChild(showAllButton);

        return canvas;
View Full Code Here

    public Canvas getViewPanel() {

        Canvas canvas = new Canvas();

        final ListGrid countryGrid = new ListGrid();
        countryGrid.setWidth(500);
        countryGrid.setHeight(224);
        countryGrid.setShowAllRecords(true);
        countryGrid.setWrapCells(true);
        // taller rows to fit 'government' values
        countryGrid.setCellHeight(32);
        countryGrid.setHoverWidth(300);

        ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 50);
        countryCodeField.setAlign(Alignment.CENTER);
        countryCodeField.setType(ListGridFieldType.IMAGE);
        countryCodeField.setImageURLPrefix("flags/16/");
        countryCodeField.setImageURLSuffix(".png");

        ListGridField nameField = new ListGridField("countryName", "Country");
        ListGridField governmentField = new ListGridField("government", "Government", 120);
        governmentField.setShowHover(true);
        governmentField.setHoverCustomizer(new HoverCustomizer() {
            public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
                CountryRecord countryRecord = (CountryRecord) record;
                int governmentDesc = countryRecord.getGovernmentDesc();
                return governmentDescription[governmentDesc];
            }
        });

        countryGrid.setFields(countryCodeField, nameField, governmentField);
        countryGrid.setCanResizeFields(true);
        countryGrid.setData(CountryData.getRecords());
        canvas.addChild(countryGrid);

        IButton everyCell = new IButton("Show Hover on every cell");
        everyCell.setWidth(250);
        everyCell.setTop(250);
        everyCell.setActionType(SelectionType.RADIO);
        everyCell.setRadioGroup("canHover");
        everyCell.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                // When canHover is true on a ListGrid, cells will show hover text unless field.showHover is false
                countryGrid.setCanHover(true);
            }
        });
        canvas.addChild(everyCell);

        IButton governmentCell = new IButton("Show Hover on <i>Government</i> cells only");
        governmentCell.setWidth(250);
        governmentCell.setTop(300);
        governmentCell.setActionType(SelectionType.RADIO);
        governmentCell.setRadioGroup("canHover");
        governmentCell.setSelected(true);
        governmentCell.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                // When canHover is unset on a ListGrid, cells will show hover text if field.showHover is true
                countryGrid.setCanHover(null);
            }
        });
        canvas.addChild(governmentCell);

        IButton noCell = new IButton("Suppress all cell hovers");
        noCell.setWidth(250);
        noCell.setTop(350);
        noCell.setActionType(SelectionType.RADIO);
        noCell.setRadioGroup("canHover");
        noCell.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                // When canHover is false on a ListGrid, cells will not show any hover text
                countryGrid.setCanHover(false);
                //countryGrid.setHoverWidth(5);
            }
        });
        canvas.addChild(noCell);
View Full Code Here

        }
    }

    public Canvas getViewPanel() {

        final ListGrid countryGrid = new ListGrid();
        countryGrid.setWidth(500);
        countryGrid.setHeight(224);
        countryGrid.setShowAllRecords(true);
        countryGrid.setCanEdit(true);
        countryGrid.setEditByCell(true);
        countryGrid.setModalEditing(true);
        countryGrid.setEmptyCellValue("unknown");

        ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 40);
        countryCodeField.setAlign(Alignment.CENTER);
        countryCodeField.setType(ListGridFieldType.IMAGE);
        countryCodeField.setImageURLPrefix("flags/16/");
        countryCodeField.setImageURLSuffix(".png");

        ListGridField nameField = new ListGridField("countryName", "Country");
        ListGridField capitalField = new ListGridField("capital", "Capital");
        ListGridField nationHoodField = new ListGridField("independence", "Nationhood");
        nationHoodField.setType(ListGridFieldType.DATE);
        nationHoodField.setEmptyCellValue("--");

        countryGrid.setFields(countryCodeField, nameField, capitalField, nationHoodField);
        countryGrid.setCanResizeFields(true);
        countryGrid.setData(CountryData.getRecords());

        return countryGrid;
    }
View Full Code Here

    public Canvas getViewPanel() {

        Canvas canvas = new Canvas();

        final ListGrid selectedCountriesGrid = new ListGrid();
        selectedCountriesGrid.setWidth(250);
        selectedCountriesGrid.setHeight(100);
        selectedCountriesGrid.setTop(250);
        selectedCountriesGrid.setShowAllRecords(true);
        ListGridField selectedCountriesField = new ListGridField("countryName", "Selected Countries");
        selectedCountriesGrid.setFields(selectedCountriesField);

        final ListGrid countryGrid = new ListGrid();
       
        countryGrid.setWidth(500);
        countryGrid.setHeight(224);
        countryGrid.setShowAllRecords(true);
        countryGrid.setSelectionType(SelectionStyle.MULTIPLE);

        ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 40);
        countryCodeField.setAlign(Alignment.CENTER);
        countryCodeField.setType(ListGridFieldType.IMAGE);
        countryCodeField.setImageURLPrefix("flags/16/");
        countryCodeField.setImageURLSuffix(".png");

        ListGridField nameField = new ListGridField("countryName", "Country");
        ListGridField capitalField = new ListGridField("capital", "Capital");
        ListGridField continentField = new ListGridField("continent", "Continent");
        countryGrid.setFields(countryCodeField, nameField, capitalField, continentField);

        countryGrid.setData(CountryData.getRecords());
        countryGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
            public void onSelectionChanged(SelectionEvent event) {
                selectedCountriesGrid.setData(countryGrid.getSelection());
            }
        });

        canvas.addChild(countryGrid);
        canvas.addChild(selectedCountriesGrid);
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);

        TabSet tabSet = new TabSet();
        Tab viewTab = new Tab("View");

        Canvas viewLabel = new Canvas();
View Full Code Here

    public Canvas getViewPanel() {

        Canvas canvas = new Canvas();

        final ListGrid countryGrid = new ListGrid();
        countryGrid.setWidth(500);
        countryGrid.setHeight(224);
        countryGrid.setShowAllRecords(true);

        ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 40);
        countryCodeField.setAlign(Alignment.CENTER);
        countryCodeField.setType(ListGridFieldType.IMAGE);
        countryCodeField.setImageURLPrefix("flags/16/");
        countryCodeField.setImageURLSuffix(".png");

        ListGridField nameField = new ListGridField("countryName", "Country");
        ListGridField capitalField = new ListGridField("capital", "Capital");
        ListGridField continentField = new ListGridField("continent", "Continent");
        countryGrid.setFields(countryCodeField, nameField, capitalField, continentField);
        countryGrid.setCanResizeFields(true);
        countryGrid.setData(CountryData.getRecords());
        canvas.addChild(countryGrid);

        IButton rolloverOff = new IButton("Rollover Off");
        rolloverOff.setLeft(120);
        rolloverOff.setTop(240);
        rolloverOff.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                countryGrid.setShowRollOver(false);
            }
        });
        canvas.addChild(rolloverOff);
       
        IButton rolloverOn = new IButton("Rollover On");
        rolloverOn.setLeft(0);
        rolloverOn.setTop(240);
        rolloverOn.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                countryGrid.setShowRollOver(true);
            }
        });
        canvas.addChild(rolloverOn);

        return canvas;
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.grid.ListGrid

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.