Package com.smartgwt.client.widgets

Examples of com.smartgwt.client.widgets.Canvas


        // Only update the content pane if the item has an associated view factory.
        ViewFactory viewFactory = item.getViewFactory();
        if (viewFactory != null) {
            destroyCurrentContent();
            Canvas content = viewFactory.createView();
            if (content != null) {
                setContent(content);

                if (content instanceof BookmarkableView) {
                    ((BookmarkableView) content).renderView(viewPath.next().next());
View Full Code Here


    public String getTitle() {
        return viewName.getTitle();
    }

    public void destroy() {
        Canvas pane = getPane();
        if (null != pane) {
            pane.destroy();
        }
    }
View Full Code Here

            children = new ArrayList<Widget>();
            for (Tab tab : tabs) {
                children.add(tab.getPane());
            }
        } else if (widget instanceof Canvas) {
            Canvas canvas = (Canvas) widget;
            Canvas[] childrenArray = canvas.getChildren();
            children = new ArrayList<Widget>();
            children.addAll(Arrays.asList(childrenArray));
        } else {
            children = new ArrayList<Widget>();
        }
View Full Code Here

        sb.append(changeSet.getVersion());
        sb.append("</span>");
        sb.append("<br/>");
        sb.append(TimestampCellFormatter.DATE_TIME_FORMAT_MEDIUM.format(new Date(this.changeSet.getCtime())));

        Canvas titleCanvas = getTitleCanvas();

        titleCanvas.setWidth100();
        titleCanvas.setHeight(35);
        titleCanvas.setContents(sb.toString());
        titleCanvas.setPadding(4);

        titleCanvas.markForRedraw();
    }
View Full Code Here

            addMember(parametersSection);
        }

        // Results (if applicable)
        Canvas resultsSection = buildResultsSection(operationHistory);
        if (resultsSection != null) {
            addMember(resultsSection);
        }
    }
View Full Code Here

            StaticTextItem descriptionItem = buildDescriptionField(propertyDefinition);
            fields.add(descriptionItem);
        } else {
            Log.error("List " + propertyList + " has unsupported member type: " + memberDefinition);
            Canvas canvas = new Canvas();
            // TODO: Add label with error message to canvas.
            CanvasItem canvasItem = buildComplexPropertyField(canvas);
            canvasItem.setColSpan(3);
            canvasItem.setEndRow(true);
            fields.add(canvasItem);
View Full Code Here

        final PropertyDefinitionList propertyDefinitionList, final PropertyList propertyList) {
        Log.debug("Building list-of-maps grid for " + propertyList + "...");

        final int listMin = propertyDefinitionList.getMin();
        final int listMax = propertyDefinitionList.getMax();
        final Canvas errorPanel = buildListOfMapsGridErrorPanel(listMin, listMax);

        final ListGrid summaryTable = new ListGrid();
        listOfMapsGrids.put(propertyDefinitionList, summaryTable);
        summaryTable.setAlternateRecordStyles(true);
        summaryTable.setShowAllRecords(true);
        summaryTable.setShowAllColumns(true);
        summaryTable.setWidth100();
        // [BZ 822173 - Table layout problem on configuration page.]
        // setBodyOverflow(Overflow.VISIBLE) && setAutoFitFieldWidths(true) issue
        //summaryTable.setBodyOverflow(VISIBLE);
        //summaryTable.setOverflow(VISIBLE);
        // Instead, use setAutoFitData...
        summaryTable.setAutoFitData(Autofit.BOTH);
        summaryTable.setAutoFitFieldWidths(true);
        summaryTable.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
        summaryTable.setRecordEnabledProperty(null);

        List<ListGridField> fieldsList = new ArrayList<ListGridField>();
        final List<PropertyDefinition> propertyDefinitions = new ArrayList<PropertyDefinition>(
            memberPropertyDefinitionMap.getOrderedPropertyDefinitions());

        List<PropertyDefinition> summaryPropertyDefinitions = new ArrayList<PropertyDefinition>();
        for (PropertyDefinition subDef : propertyDefinitions) {
            if (subDef.isSummary()) {
                summaryPropertyDefinitions.add(subDef);
            }
        }
        if (summaryPropertyDefinitions.isEmpty()) {
            // An extra "feature of the config system". If no fields are labeled summary, all are considered summary.
            summaryPropertyDefinitions.addAll(propertyDefinitions);
        }

        for (PropertyDefinition summaryPropDef : summaryPropertyDefinitions) {
            ListGridField field = createListGridField(summaryPropDef);
            fieldsList.add(field);
        }

        boolean allSubDefsReadOnly = isAllReadOnly(propertyDefinitions);

        ListGridField editField = new ListGridField("edit", 20);
        editField.setType(ListGridFieldType.ICON);
        final boolean mapReadOnly = this.readOnly || allSubDefsReadOnly;
        String icon = (mapReadOnly) ? ImageManager.getViewIcon() : ImageManager.getEditIcon();
        editField.setCellIcon(Window.getImgURL(icon));
        editField.setCanEdit(false);
        editField.setCanGroupBy(false);
        editField.setCanSort(false);
        editField.setCanHide(false);
        editField.addRecordClickHandler(new RecordClickHandler() {
            public void onRecordClick(RecordClickEvent recordClickEvent) {
                PropertyMapListGridRecord record = (PropertyMapListGridRecord) recordClickEvent.getRecord();
                PropertyMap memberPropertyMap = (PropertyMap) record.getPropertyMap();
                Log.debug("Editing property map: " + memberPropertyMap);
                displayMapEditor(summaryTable, errorPanel, record, propertyDefinitionList, propertyList,
                    memberPropertyDefinitionMap, memberPropertyMap, mapReadOnly);
            }
        });
        fieldsList.add(editField);

        boolean propertyReadOnly = (readOnly || (!allPropertiesWritable && propertyDefinitionList.isReadOnly()));
        if (!propertyReadOnly) {
            ListGridField removeField = new ListGridField("remove", 20);
            removeField.setType(ListGridFieldType.ICON);
            removeField.setCellIcon(Window.getImgURL(ImageManager.getRemoveIcon()));
            removeField.setCanEdit(false);
            removeField.setCanFilter(true);
            removeField.setFilterEditorType(new SpacerItem());
            removeField.setCanGroupBy(false);
            removeField.setCanSort(false);
            removeField.setCanHide(false);

            removeField.addRecordClickHandler(new RecordClickHandler() {
                public void onRecordClick(final RecordClickEvent recordClickEvent) {
                    Log.debug("You want to delete: " + recordClickEvent.getRecordNum());
                    SC.confirm(MSG.view_configEdit_confirm_2(), new BooleanCallback() {
                        public void execute(Boolean confirmed) {
                            if (confirmed) {
                                if (summaryTable.getRecordList().getLength() <= listMin) {
                                    SC.say(MSG.view_configEdit_minBoundsExceeded(String.valueOf(listMin)));
                                } else {
                                    PropertyMapListGridRecord recordToBeDeleted = (PropertyMapListGridRecord) recordClickEvent
                                        .getRecord();
                                    propertyList.getList().remove(recordToBeDeleted.getIndex());
                                    ListGridRecord[] rows = buildSummaryRecords(propertyList, propertyDefinitions);
                                    boolean listGridRecordCountValid = isListGridRecordCountValid(rows, listMin,
                                        listMax);
                                    if (errorPanel.isVisible() && listGridRecordCountValid) {
                                        errorPanel.setVisible(false);
                                    }
                                    summaryTable.setData(rows);
                                    firePropertyChangedEvent(propertyList, propertyDefinitionList,
                                        listGridRecordCountValid);
                                }
                            }
                        }
                    });
                }
            });

            editField.setEditorType(new ButtonItem("delete", MSG.common_button_delete()));
            fieldsList.add(removeField);
        }

        summaryTable.setFields(fieldsList.toArray(new ListGridField[fieldsList.size()]));

        // Now add rows containing the actual data (i.e. member property values).
        ListGridRecord[] rows = buildSummaryRecords(propertyList, propertyDefinitions);
        summaryTable.setData(rows);

        VLayout summaryTableHolder = new EnhancedVLayout();

        ToolStrip toolStrip = new ToolStrip();
        toolStrip.setWidth100();
        if (!propertyReadOnly) {
            IButton addRowButton = new EnhancedIButton();
            addRowButton.setWidth("40px");
            addRowButton.setIcon(Window.getImgURL(ImageManager.getAddIcon()));
            addRowButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
                public void onClick(ClickEvent clickEvent) {
                    if (propertyList.getList().size() >= listMax) {
                        SC.say(MSG.view_configEdit_maxBoundsExceeded(String.valueOf(propertyDefinitionList.getMax())));
                        return;
                    }
                    displayMapEditor(summaryTable, errorPanel, null, propertyDefinitionList, propertyList,
                        memberPropertyDefinitionMap, null, mapReadOnly);
                }
            });
            toolStrip.addMember(addRowButton);
        }

        if (isListGridRecordCountValid(summaryTable.getRecords(), listMin, listMax)) {
            errorPanel.setVisible(false);
        } else {
            errorPanel.setVisible(true);
        }
        summaryTableHolder.setMembers(summaryTable, toolStrip, errorPanel);

        CanvasItem canvasItem = buildComplexPropertyField(summaryTableHolder);
        canvasItem.setColSpan(3);
View Full Code Here

                flags.append("configOnly");
            }
        }

        if (widget instanceof Canvas) {
            Canvas canvas = (Canvas) widget;

            if (canvas.isDrawn()) {
                if (flags.length() != 0) {
                    flags.append(", ");
                }
                flags.append("drawn");
            }
            if (canvas.isDirty()) {
                if (flags.length() != 0) {
                    flags.append(", ");
                }
                flags.append("dirty");
            }
            if (canvas.isDisabled()) {
                if (flags.length() != 0) {
                    flags.append(", ");
                }
                flags.append("disabled");
            }
View Full Code Here

        if (rootCanvas == null) {
            menuBarView = new MenuBarView();
            menuBarView.setWidth("100%");
            menuBarView.setExtraSpace(0);

            Canvas canvas = new Canvas(CONTENT_CANVAS_ID);
            canvas.setWidth100();
            canvas.setHeight100();
            canvas.setZIndex(0);

            rootCanvas = new RootCanvas();
            rootCanvas.setOverflow(Overflow.HIDDEN);

            rootCanvas.addMember(menuBarView);
View Full Code Here

        showBusy(false);
    }

    public Canvas createContent(String viewName) {
        Canvas canvas;

        boolean isLogout = LOGOUT_VIEW.equals(viewName);
        if (isLogout || LoginView.isLoginView()) {
            rootCanvas.hide();
            LoginView logoutView = new LoginView();
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.