Package com.smartgwt.client.widgets

Examples of com.smartgwt.client.widgets.Canvas


    /**
     * create a grid with the appropriate structure.
     * @return
     */
    private Canvas createGridPersons() {
        Canvas canvas = new Canvas();
        personGrid.setWidth100();
        personGrid.setHeight100();
        personGrid.setEmptyCellValue("-");
        personGrid.setDataSource(GridFieldAdmin.getInstance());

        //creates the columns
        ListGridField nameField = new ListGridField("Name", constants.name());
        //ListGridField groupField = new ListGridField("Group", constants.group());
        ListGridField activeField = new ListGridField("Active", constants.active());
        //personGrid.setFields(nameField, groupField, activeField);
        personGrid.setFields(nameField, activeField);

        //configure the grid, by adding the context menu.
        personGrid.setSortField(0);
        personGrid.setDataPageSize(50);
        personGrid.setAutoFetchData(true);
        popupPersons();
        personGrid.setContextMenu(menu);

        //configure grid handlers.
        personGrid.addRecordClickHandler(new RecordClickHandler() {
            public void onRecordClick(RecordClickEvent event) {
                ListGridRecord record = (ListGridRecord) event.getRecord();
                idItemSelected = record.getAttribute("id");
                popupPersons();
                personGrid.setContextMenu(menu);
            }
        });

        personGrid.addRowContextClickHandler( new RowContextClickHandler() {
            @Override
            public void onRowContextClick(RowContextClickEvent event) {
                ListGridRecord record = (ListGridRecord) event.getRecord();
                idItemSelected = record.getAttribute("id");
                popupPersons();
                personGrid.setContextMenu(menu);
            }
        });

        personGrid.addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
            @Override
            public void onRecordDoubleClick(RecordDoubleClickEvent event) {
                ListGridRecord record = (ListGridRecord) event.getRecord();
                idItemSelected = record.getAttribute("id");
                popupPersons();
                personGrid.setContextMenu(menu);
                //managePerson(idItemSelected, SHOW);
                new UserPanel(record.getAttribute("Name"), "group", true, canvasPrincipal);               
            }
        });
        canvas.addChild(personGrid);

        return canvas;
     }
View Full Code Here


    /**
     * create a grid with the appropriate structure.
     * @return
     */
    private Canvas createGridProducts() {
        Canvas canvas = new Canvas();
        productGrid.setWidth100();
        productGrid.setHeight100();
        productGrid.setEmptyCellValue("-");
        GridFieldPrincipal aux = GridFieldPrincipal.getInstance();
        aux.invalidateCache();
        aux.destroy();
        productGrid.setDataSource(aux);

        //creates the columns
        ListGridField nameField = new ListGridField("Name", constants.name());
        ListGridField initialEstimationField = new ListGridField("InitialEstimation", constants.initialEstimation());
        initialEstimationField.setWidth("10%");
        ListGridField capitalField = new ListGridField("CurrentEstimation", constants.currentEstimation());
        capitalField.setWidth("10%");
        ListGridField descriptionField = new ListGridField("Description", constants.description());
        productGrid.setFields(nameField, initialEstimationField, capitalField, descriptionField);

        //configure the grid, by adding the context menu.
        productGrid.setSortField(0);
        productGrid.setDataPageSize(50);
        productGrid.setAutoFetchData(true);
        popupProduct();
        productGrid.setContextMenu(menu);

        //configure grid handlers.
        productGrid.addRecordClickHandler(new RecordClickHandler() {
            @Override
            public void onRecordClick(RecordClickEvent event) {
                ListGridRecord record = (ListGridRecord) event.getRecord();
                idItemSelected = record.getAttribute("id");
                popupProduct();
                productGrid.setContextMenu(menu);
            }
        });

        productGrid.addRowContextClickHandler( new RowContextClickHandler() {
            @Override
            public void onRowContextClick(RowContextClickEvent event) {
                ListGridRecord record = (ListGridRecord) event.getRecord();
                idItemSelected = record.getAttribute("id");
                popupProduct();
                productGrid.setContextMenu(menu);
            }
        });

        productGrid.addRecordDoubleClickHandler(new RecordDoubleClickHandler() {
            @Override
            public void onRecordDoubleClick(RecordDoubleClickEvent event) {
                ListGridRecord record = (ListGridRecord) event.getRecord();
                idItemSelected = record.getAttribute("id");
                popupProduct();
                productGrid.setContextMenu(menu);
                po.manageProducts(idItemSelected, SHOW);                               
            }
        });
        canvas.addChild(productGrid);
        return canvas;
     }
View Full Code Here

        messageLayout.setWidth(200);
        messageLayout.setHeight(300);
        messageLayout.setBorder("1px solid #6a6a6a");
        messageLayout.setLayoutMargin(5);
       
        final Canvas textCanvas = new Canvas();
        textCanvas.setPrefix("<b>Message from Rob:</b><BR>");
        textCanvas.setPadding(5);
        textCanvas.setHeight(1);

        final DynamicForm form = new DynamicForm();
        form.setNumCols(2);
        form.setHeight("*");
        form.setColWidths(60, "*");
       
        TextItem subjectItem = new TextItem();
        subjectItem.setTitle("Subject");
        subjectItem.setWidth("*");
        subjectItem.setDefaultValue("Re: your message");

        TextAreaItem messageItem = new TextAreaItem();
        messageItem.setShowTitle(false);
        messageItem.setColSpan(2);
        messageItem.setHeight("*");
        messageItem.setWidth("*");
        messageItem.setLength(5000);
        form.setFields(subjectItem, messageItem);
       
        messageLayout.addMember(textCanvas);
        messageLayout.addMember(form);
       
        VLayout buttonLayout = new VLayout(10);       
       
        IButton shortMessageButton = new IButton("Short message");
        shortMessageButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                textCanvas.setContents(textCanvas.getPrefix() + "I'll be in town Saturday.  Give me a call on my cell and" +
                                       " we'll get a bite to eat.");
            }
        });

        IButton longMessageButton = new IButton("Long message");
View Full Code Here

        tab.setPane(mainPanel);

        mainTabSet.addTab(tab);

        Canvas canvas = new Canvas();
        canvas.setBackgroundImage("[SKIN]/shared/background.gif");
        canvas.setWidth100();
        canvas.setHeight100();
        canvas.addChild(mainTabSet);

        hLayout.addMember(canvas);
        main.addMember(hLayout);

        if (SC.hasFirebug()) {
View Full Code Here

                if (panelID != null) {
                    String tabID = panelID + "_tab";
                    tab = mainTabSet.getTab(tabID);
                }
                if (tab == null) {
                    Canvas panel = factory.create();
                    tab = new Tab();
                    tab.setID(factory.getID() + "_tab");
                    //store history token on tab so that when an already open is selected, one can retrieve the
                    //history token and update the URL
                    tab.setAttribute("historyToken", explorerTreeNode.getNodeID());
View Full Code Here

    }
  }

  public Canvas getViewPanel() {

    Canvas main = new Canvas();

    Menu mDepartment = new Menu();
    mDepartment.setCanSelectParentItems(true);
    mDepartment.setData(getLocalItemsAsArray());
    mDepartment.setWidth(130);

    mDepartment.addItemClickHandler(new ItemClickHandler() {
      public void onItemClick(ItemClickEvent event) {
        SC.say("You picked the \"" + event.getItem().getTitle()
            + "\" department.");
      }
    });

    IMenuButton bDepartment = new IMenuButton("Go to department", mDepartment);
    bDepartment.setWidth(130);

    main.addChild(bDepartment);

    Menu mCategory = new Menu();
    mCategory.setCanSelectParentItems(true);
    mCategory.setDataSource(SupplyCategoryXmlDS.getInstance());
    mCategory.setWidth(130);

    mCategory.addItemClickHandler(new ItemClickHandler() {
      public void onItemClick(ItemClickEvent event) {
        MenuItem item = event.getItem();
        SC.say("You picked the \""
            + item.getAttributeAsString("categoryName")
            + "\" category.");
      }
    });

    IMenuButton bCategory = new IMenuButton("Go to category", mCategory);
    bCategory.setTop(30);
    bCategory.setWidth(140);

    main.addChild(bCategory);

    return main;
  }
View Full Code Here

        }
    }

    public Canvas getViewPanel() {

        Canvas canvas = new Canvas();

        Canvas yahooAttribution = new Canvas();
        yahooAttribution.setHeight(31);
        yahooAttribution.setContents("<a href='http://developer.yahoo.net/about'>"
                + "<img src='http://l.yimg.com/a/i/us/nt/bdg/websrv_88_1.gif' border='0'>"
                + "</a>");
        canvas.addChild(yahooAttribution);

        XJSONDataSource yahooDS = new XJSONDataSource();
View Full Code Here

                    }
                });
            }
        });

        Canvas main = new Canvas();
        main.addChild(labelAnswer);
        main.addChild(buttonConfirm);
        main.addChild(buttonAsk);

        return main;
    }
View Full Code Here

        }
    }

    public Canvas getViewPanel() {

        Canvas canvas = new Canvas();

        final HTMLFlow htmlFlow = new HTMLFlow();
        htmlFlow.setHeight(45);
        htmlFlow.setWidth(75);
        htmlFlow.setTop(50);
        htmlFlow.setOverflow(Overflow.HIDDEN);
        htmlFlow.setStyleName("exampleTextBlock");
        htmlFlow.setShowEdges(true);

        String contents = "<span class='exampleDropTitle'>Ajax&nbsp;&nbsp;</span> <b>A</b>synchronous <b>J</b>avaScript " +
                "<b>A</b>nd <b>X</b>ML (AJAX) is a Web development technique for creating interactive <b>web applications</b>. " +
                "The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind" +
                " the scenes, so that the entire Web page does not have to be reloaded each time the user makes a change. " +
                "This is meant to increase the Web page's <b>interactivity</b>, <b>speed</b>, and <b>usability</b>. " +
                "(Source: <a href='http://www.wikipedia.org' title='Wikipedia' target='_blank'>Wikipedia</a>)";
        htmlFlow.setContents(contents);

        IButton expandButton = new IButton("Expand");
        expandButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                htmlFlow.resizeBy(235, 150);
            }
        });

        IButton collapseButton = new IButton("Collapse");
        collapseButton.setLeft(120);
        collapseButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                htmlFlow.resizeTo(75, 45);
            }
        });

        canvas.addChild(expandButton);
        canvas.addChild(collapseButton);
        canvas.addChild(htmlFlow);
        return canvas;
    }
View Full Code Here

        vStack.setShowEdges(true);
        vStack.setEdgeImage("edges/green/6.png");
        vStack.setCanAcceptDrop(true);
        vStack.setAnimateMembers(true);
        vStack.setDropLineThickness(4);
        Canvas dropLineProp = new Canvas();
        dropLineProp.setBackgroundColor("#40c040");
        vStack.setDropLineProperties(dropLineProp);
        vStack.addMember(new DragPiece("cube_blue.png"));
        vStack.addMember(new DragPiece("cube_green.png"));
        vStack.addMember(new DragPiece("cube_yellow.png"));
       
        Canvas main = new Canvas();
        main.addChild(hStack);
        main.addChild(vStack);
       
       
        return main;
    }
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.