Examples of ListGrid


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

        if (canDeploy) {
            setListGridDoubleClickHandler(new DoubleClickHandler() {
                @Override
                public void onDoubleClick(DoubleClickEvent event) {
                    ListGrid listGrid = (ListGrid) event.getSource();
                    ListGridRecord[] selectedRows = listGrid.getSelectedRecords();
                    if (selectedRows != null && selectedRows.length == 1) {
                        String selectedId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_BUNDLE_ID);
                        String selectedVersionId = selectedRows[0].getAttribute(BundleVersionDataSource.FIELD_ID);
                        CoreGUI.goToView(LinkManager.getBundleDeploymentLink(Integer.valueOf(selectedId),
                            Integer.valueOf(selectedVersionId)));
View Full Code Here

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

     * @see org.rhq.coregui.client.components.table.Table#configureTable()
     */
    @Override
    protected void configureTable() {
        if (isDetailsEnabled()) {
            ListGrid grid = getListGrid();

            // Make the value of some specific field a link to the details view for the corresponding record.
            ListGridField field = (grid != null) ? grid.getField(getDetailsLinkColumnName()) : null;
            if (field != null) {
                field.setCellFormatter(getDetailsLinkColumnCellFormatter());
            }

            setListGridDoubleClickHandler(new DoubleClickHandler() {
                @Override
                public void onDoubleClick(DoubleClickEvent event) {
                    ListGrid listGrid = (ListGrid) event.getSource();
                    ListGridRecord[] selectedRows = listGrid.getSelectedRecords();
                    if (selectedRows != null && selectedRows.length == 1) {
                        showDetails(selectedRows[0]);
                    }
                }
            });
View Full Code Here

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

    }

    @Override
    protected void configureTable() {
        List<ListGridField> fields = getDataSource().getListGridFields();
        ListGrid listGrid = getListGrid();
        listGrid.setFields(fields.toArray(new ListGridField[fields.size()]));
        listGrid.sort(FIELD_NAME, SortDirection.ASCENDING);

        addTableAction(MSG.common_button_enable(), MSG.common_msg_areYouSure(), ButtonColor.BLUE, new AuthorizedTableAction(this,
            TableActionEnablement.ANY, Permission.MANAGE_SETTINGS) {
            public void executeAction(ListGridRecord[] selections, Object actionValue) {
                int[] selectedIds = getSelectedIds(selections);
View Full Code Here

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

    }

    @Override
    protected void configureTable() {
        List<ListGridField> fields = getDataSource().getListGridFields();
        ListGrid listGrid = getListGrid();
        listGrid.setFields(fields.toArray(new ListGridField[fields.size()]));
        listGrid.sort(FIELD_NAME, SortDirection.ASCENDING);

        addTableAction(MSG.common_button_enable(), MSG.common_msg_areYouSure(), ButtonColor.BLUE,
            new AuthorizedTableAction(this, TableActionEnablement.ANY, Permission.MANAGE_SETTINGS) {
            public void executeAction(ListGridRecord[] selections, Object actionValue) {
                int[] selectedIds = getSelectedIds(selections);
View Full Code Here

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

        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);
View Full Code Here

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

    @Override
    protected void configureTable() {
        super.configureTable();

        ListGrid listGrid = getListGrid();

        ListGridField resourceNameField = listGrid.getField(MeasurementDataTraitCriteria.SORT_FIELD_RESOURCE_NAME);
        resourceNameField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                String url = LinkManager.getResourceLink(listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
                return LinkManager.getHref(url, o.toString());
            }
View Full Code Here

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

        setWidth100();
        setMargin(7);

        this.hlayout = new HLayout();
        this.assignedGrid = new ListGrid();

        if (this.isReadOnly) {
            this.assignedGrid.setSelectionType(SelectionStyle.NONE);
        } else {
            this.availableGrid = new ListGrid();
        }
    }
View Full Code Here

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

        setEscapeHtmlInDetailsLinkColumn(true);
    }

    @Override
    protected void configureTable() {
        ListGrid listGrid = getListGrid();

        AbstractAlertDefinitionsDataSource ds = getAlertDefinitionDataSource();
        setDataSource(ds);
        listGrid.setDataSource(ds);
        listGrid.setFields(ds.getListGridFields().toArray(new ListGridField[0]));

        listGrid.setUseAllDataSourceFields(true);
        listGrid.setWrapCells(true);
        listGrid.setFixedRecordHeights(false);
        //listGrid.getField("id").setWidth(55);

        // name and description are user-editable, so escape HTML to prevent XSS attacks
        ListGridField nameField = listGrid.getField(AbstractAlertDefinitionsDataSource.FIELD_NAME);
        nameField.setCellFormatter(new EscapedHtmlCellFormatter());
        ListGridField descriptionField = listGrid.getField(AbstractAlertDefinitionsDataSource.FIELD_DESCRIPTION);
        descriptionField.setCellFormatter(new EscapedHtmlCellFormatter());

        final boolean isAuthorized = isAuthorizedToModifyAlertDefinitions();

        addTableAction(MSG.common_button_new(), null, ButtonColor.BLUE, new AbstractTableAction() {
View Full Code Here

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

    @Override
    protected void configureTable() {
        super.configureTable();

        ListGrid listGrid = getListGrid();

        listGrid.setShowAllRecords(true);
        //listGrid.setGroupStartOpen(GroupStartOpen.ALL);
        //listGrid.groupBy(MeasurementDataTraitCriteria.SORT_FIELD_DISPLAY_NAME);

        ListGridField resourceNameField = listGrid.getField(MeasurementDataTraitCriteria.SORT_FIELD_RESOURCE_NAME);
        resourceNameField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                String url = LinkManager.getResourceLink(listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
                return LinkManager.getHref(url, o.toString());
            }
View Full Code Here

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

        };
    }

    @Override
    protected ListGrid decorateLiveDataGrid(List<ListGridRecord> records) {
        ListGrid liveDataGrid = new ListGrid();
        liveDataGrid.setShowAllRecords(true);
        liveDataGrid.setData(records.toArray(new ListGridRecord[records.size()]));
        liveDataGrid.setSelectionType(SelectionStyle.NONE);
        ListGridField name = new ListGridField(MeasurementDataTraitCriteria.SORT_FIELD_DISPLAY_NAME,
            MSG.dataSource_traits_field_trait());
        ListGridField value = new ListGridField("value", MSG.common_title_value());
        ListGridField resourceNameField = new ListGridField(MeasurementDataTraitCriteria.SORT_FIELD_RESOURCE_NAME,
            MSG.common_title_resource());
        resourceNameField.setCellFormatter(new CellFormatter() {
            public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
                String url = LinkManager.getResourceLink(listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
                return LinkManager.getHref(url, o.toString());
            }
        });
        resourceNameField.setShowHover(true);
        resourceNameField.setHoverCustomizer(new HoverCustomizer() {
            public String hoverHTML(Object value, ListGridRecord listGridRecord, int rowNum, int colNum) {
                return AncestryUtil.getResourceHoverHTML(listGridRecord, 0);
            }
        });
        liveDataGrid.setFields(name, value, resourceNameField, AncestryUtil.setupAncestryListGridField());

        return liveDataGrid;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.