Package com.smartgwt.client.widgets

Examples of com.smartgwt.client.widgets.Canvas


        }
    }

    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 ServerCountLabel serverCountLabel = new ServerCountLabel();

        ItemSupplyXmlDS supplyXmlDS = new ItemSupplyXmlDS(SC.generateID()) {

            //this approach logs simulated server trips for DataSources with clientOnly:true
            //so that no server is required. Since this example has a clientOnly datasource that loads data
            //from a static xml, use the simulated server trips getClientOnlyResponse override point.
            //If working with a real server that returns data dynamically based on start/end row, override
            //transformResponse instead.

           
            @Override
            public DSResponse getClientOnlyResponse(DSRequest request, Record[] serverData) {
                DSResponse response = super.getClientOnlyResponse(request, serverData);
                int totalRows = response.getTotalRows();
                int startRow = response.getStartRow();
                int endRow = response.getEndRow();
                serverCountLabel.incrementAndUpdate(totalRows, startRow, endRow);
                serverCountLabel.setBackgroundColor("ffff77");
                new Timer() {
                    public void run() {
                        serverCountLabel.setBackgroundColor("ffffff");
                    }
                }.schedule(500);

                return response;
            }
        };

        //when working with a server that dynamically returns the response based on start row, end row,
        //use can override transformResponse instead of getClientOnlyResponse
        /*
        @Override
        protected void transformResponse(DSResponse response, DSRequest request, Object data) {
            int totalRows = response.getTotalRows();
            int startRow = response.getStartRow();
            int endRow = response.getEndRow();
            serverCountLabel.incrementAndUpdate(totalRows, startRow, endRow);
            serverCountLabel.setBackgroundColor("ffff77");
            new Timer() {
                public void run() {
                    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();
       
        DragLabel resizeAny = new DragLabel();
        resizeAny.setLeft(80);
        resizeAny.setTop(80);
        resizeAny.setContents("Resize from any side");
        resizeAny.setCanDragResize(true);
        resizeAny.setEdgeMarginSize(10);
        canvas.addChild(resizeAny);
       
        DragLabel resizeBR = new DragLabel();
        resizeBR.setLeft(280);
        resizeBR.setTop(80);
        resizeBR.setContents("Resize from bottom or right");
        resizeBR.setCanDragResize(true);
        resizeBR.setResizeFrom("B","R","BR");
        resizeBR.setEdgeMarginSize(10);
        canvas.addChild(resizeBR);
       
        return canvas;
    }
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);

        return canvas;
    }
View Full Code Here

        listGrid.setAutoFetchData(true);

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

        Canvas viewLabel = new Canvas();
        viewLabel.setContents("[Record Details can be dispalyed here]");
        viewTab.setPane(viewLabel);

        Tab editTab = new Tab("Edit");

        Canvas editLabel = new Canvas();
        editLabel.setContents("[Form for edits can be dispalyed here]");
        editTab.setPane(editLabel);

        tabSet.setTabs(viewTab, editTab);

        TreeGrid treeGrid = new TreeGrid();
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

        }
    }

    public Canvas getViewPanel() {

        Canvas canvas = new Canvas();

        CountryListGrid countryList1 = new CountryListGrid();
        countryList1.setBaseStyle("myBoxedGridCell");
        canvas.addChild(countryList1);

        CountryListGrid countryList2 = new CountryListGrid();
        countryList2.setTop(220);
        countryList2.setBaseStyle("myOtherGridCell");
        canvas.addChild(countryList2);

        return canvas;
    }
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.SINGLE);

        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);

        return canvas;
    }
View Full Code Here

            return DESCRIPTION;
        }
    }

    public Canvas getViewPanel() {
        Canvas canvas = new Canvas();
        canvas.addChild(new DragPanSampleImg());
        return canvas;
    }
View Full Code Here

      }       
      });
     
        label.addDropHandler(new DropHandler() {
      public void onDrop(DropEvent event) {
                Canvas target = EventHandler.getDragTarget();
                SC.say("You dropped the " +  target.getID());       
      }         
        });
       
        Canvas canvas = new Canvas();
        canvas.addChild(blue);
        canvas.addChild(green);
        canvas.addChild(label);
        return canvas;
    }
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.Canvas

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.