Package com.gwtext.client.widgets.grid

Examples of com.gwtext.client.widgets.grid.ColumnConfig


    private static ColumnModel createColumnModel(TableConfig conf) {
        ColumnConfig[] cfgs = new ColumnConfig[conf.headers.length + 1];

        //first the UUID
        cfgs[0] = new ColumnConfig() {
            {
                setHidden( true );
                setHeader( "uuid" );
                setDataIndex( "uuid" );   //NON-NLS
            }
        };

        //now the visible headers
        for ( int i = 0; i < conf.headers.length; i++ ) {
            final String header = conf.headers[i];
            final String headerType = conf.headerTypes[i];

            cfgs[i + 1] = new ColumnConfig() {
                {
                        setupHeader();
                        setSortable( true );
                        setDataIndex( header );
                        if ( header.equals( "Name" ) ) { //name is special !
View Full Code Here


    Store store = new Store(proxy, reader);
    store.setDefaultSort("timestamp", SortDir.DESC);
    store.load();

    ColumnModel cm = new ColumnModel(new ColumnConfig[] {
        new ColumnConfig() {
          {
              setDataIndex("severity")//NON-NLS
            setHeader(constants.Severity());
            setSortable(true);
            setRenderer(new Renderer() {
              public String render(Object value,
                  CellMetadata cellMetadata, Record record,
                  int rowIndex, int colNum, Store store) {
                Integer i = (Integer) value;
                if (i.intValue() == 0) {
                  return "<img src='images/error.gif'/>";
                } else if (i.intValue() == 1) {
                  return "<img src='images/information.gif'/>";
                } else {
                  return "";
                }
              }
            });
            setWidth(50);
          }
        }, new ColumnConfig() {
          {
            setHeader(constants.Timestamp());
            setSortable(true);
            setDataIndex("timestamp");
            setWidth(180);
          }
        }, new ColumnConfig() {
          {
            setHeader(constants.Message());
            setSortable(true);
            setDataIndex("message"); //NON-NLS
            setWidth(580);
View Full Code Here

        ArrayReader reader = new ArrayReader( recordDef );
        Store store = new Store( proxy,
                                 reader );
        store.load();

        ColumnModel cm = new ColumnModel( new ColumnConfig[]{new ColumnConfig() {
            {
                setHidden( true );
                setDataIndex( "uuid" ); //NON-NLS
            }
        }, new ColumnConfig() {
            {
                setHeader( constants.Name() );
                setSortable( true );
                setDataIndex( "assetName" ); //NON-NLS
                setRenderer( new Renderer() {
                    public String render(Object value,
                                         CellMetadata cellMetadata,
                                         Record record,
                                         int rowIndex,
                                         int colNum,
                                         Store store) {
                        return "<img src='images/error.gif'/>" + value; //NON-NLS
                    }

                } );
            }
        }, new ColumnConfig() {
            {
                setHeader( constants.Format() );
                setSortable( true );
                setDataIndex( "assetFormat" ); //NON-NLS
            }
        }, new ColumnConfig() {
            {
                setHeader( constants.Message1() );
                setSortable( true );
                setDataIndex( "message" ); //NON-NLS
                setWidth( 300 );
View Full Code Here

                                 reader );
        store.setDefaultSort( "left",
                              SortDir.DESC );
        store.load();

        ColumnModel cm = new ColumnModel( new ColumnConfig[]{new ColumnConfig() {
            {
                setHidden( true );
                setHeader( "uuid" );
                setSortable( true );
            }
        }, new ColumnConfig() {
            {
                setHeader( Format.format( constants.Older0(),
                                          leftHeader ) );
                setDataIndex( "left" ); //NON-NLS
                setSortable( true );
                setWidth( 200 );
            }
        }, new ColumnConfig() {
            {
                setHeader( constants.Type() );
                setSortable( true );
                setDataIndex( "type" );
                setWidth( 100 );
                setAlign( TextAlign.CENTER );
                setRenderer( new Renderer() {
                    public String render(Object value,
                                         CellMetadata cellMetadata,
                                         Record record,
                                         int rowIndex,
                                         int colNum,
                                         Store store) {
                        String type = (String) value;

                        if ( type.equals( SnapshotDiff.TYPE_ADDED ) ) {
                            cellMetadata.setHtmlAttribute( "style=\"background:blue;color:white;font-weight: bold;\"" );
                            type = constants.TypeAdded();
                        } else if ( type.equals( SnapshotDiff.TYPE_ARCHIVED ) ) {
                            cellMetadata.setHtmlAttribute( "style=\"background:purple;color:white;font-weight: bold;\"" );
                            type = constants.TypeArchived();
                        } else if ( type.equals( SnapshotDiff.TYPE_DELETED ) ) {
                            cellMetadata.setHtmlAttribute( "style=\"background:red;color:white;font-weight: bold;\"" );
                            type = constants.TypeDeleted();
                        } else if ( type.equals( SnapshotDiff.TYPE_RESTORED ) ) {
                            cellMetadata.setHtmlAttribute( "style=\"background:orange;color:white;font-weight: bold;\"" );
                            type = constants.TypeRestored();
                        } else if ( type.equals( SnapshotDiff.TYPE_UPDATED ) ) {
                            cellMetadata.setHtmlAttribute( "style=\"background:green;color:white;font-weight: bold;\"" );
                            type = constants.TypeUpdated();
                        }

                        return type;
                    }
                } );
            }
        }, new ColumnConfig() {
            {
                setHeader( Format.format( constants.Newer0(),
                                          rightHeader ) );
                setSortable( true );
                setDataIndex( "right" ); //NON-NLS
View Full Code Here

        fds[1] = new StringFieldDef( "desc" ); //NON-NLS

        int colCount = 0;

        BaseColumnConfig[] cols = new BaseColumnConfig[fds.length]; //its +1 as we have the separator -> thing.
        cols[0] = new ColumnConfig() {
            {
                setDataIndex( "num" ); //NON-NLS
                setWidth( 60 );
                setSortable( false );
                setHeader( "Row Number" );
                setRenderer( new Renderer() {
                    public String render(Object value,
                                         CellMetadata cellMetadata,
                                         Record record,
                                         int rowIndex,
                                         int colNum,
                                         Store store) {
                        return "<span class='x-grid3-cell-inner x-grid3-td-numberer'>" + (rowIndex + 1) + "</span>"; //NON-NLS
                    }
                } );
            }
        };
        colCount++;
        cols[1] = new ColumnConfig() {
            {
                setDataIndex( "desc" ); //NON-NLS
                setSortable( true );
                setHeader( constants.Description() );
                if ( dt.descriptionWidth != -1 ) {
                    setWidth( dt.descriptionWidth );
                }
            }
        };
        colCount++;

        //now to metadata
        for ( int i = 0; i < dt.getMetadataCols().size(); i++ ) {
            final MetadataCol attr = dt.getMetadataCols().get( i );
            fds[colCount] = new StringFieldDef( attr.attr );
            cols[colCount] = new ColumnConfig() {
                {
                    setHeader( attr.attr );
                    setDataIndex( attr.attr );
                    setSortable( true );
                    if ( attr.width != -1 ) {
                        setWidth( attr.width );
                    }
                    if ( attr.hideColumn ) {
                        setHidden( true );
                    }

                }
            };
            colMap.put( attr.attr, attr );
            colCount++;
        }

        //now to attributes
        for ( int i = 0; i < dt.attributeCols.size(); i++ ) {
            final AttributeCol attr = dt.attributeCols.get( i );
            fds[colCount] = new StringFieldDef( attr.attr );
            cols[colCount] = new ColumnConfig() {
                {
                    setHeader( attr.attr );
                    setDataIndex( attr.attr );
                    setSortable( true );
                    if ( attr.width != -1 ) {
                        setWidth( attr.width );
                    }

                    if ( attr.hideColumn ) {
                        setHidden( true );
                    }

                }
            };
            colMap.put( attr.attr,
                        attr );
            colCount++;
        }

        //do all the condition cols
        for ( int i = 0; i < dt.conditionCols.size(); i++ ) {
            //here we could also deal with numeric type?
            final ConditionCol c = dt.conditionCols.get( i );
            fds[colCount] = new StringFieldDef( c.header );
            cols[colCount] = new ColumnConfig() {
                {
                    setHeader( c.header );
                    setDataIndex( c.header );
                    setSortable( true );
                    if ( c.width != -1 ) {
                        setWidth( c.width );
                    }

                    if ( c.hideColumn ) {
                        setHidden( true );
                    }
                }
            };
            colMap.put( c.header,
                        c );
            colCount++;
        }

        //the split thing
        //The separator column causes confusion, see GUVNOR-498. Remove this column for now until 
        //we find a better way to represent a column for the purpose of separator.
/*        cols[colCount] = new ColumnConfig() {
            {
                setDataIndex( "x" );
                setHeader( "x" );
                //setFixed(true);
                setSortable( false );
                setResizable( false );
                //setWidth(60);
                setRenderer( new Renderer() {
                    public String render(Object value,
                                         CellMetadata cellMetadata,
                                         Record record,
                                         int rowIndex,
                                         int colNum,
                                         Store store) {
                        return "<image src='images/production.gif'/>"; //NON-NLS
                    }
                } );
                setWidth( 20 );
            }
        };
        colCount++;*/

        for ( int i = 0; i < dt.actionCols.size(); i++ ) {
            //here we could also deal with numeric type?
            final ActionCol c = dt.actionCols.get( i );
            fds[colCount] = new StringFieldDef( c.header );

            cols[colCount] = new ColumnConfig() {
                {
                    setHeader( c.header );
                    setDataIndex( c.header );
                    //and here we do the appropriate editor
                    setSortable( true );
View Full Code Here

        store.load();
    }

    protected void createColumns() {
        ColumnConfig propCol = new ColumnConfig();
        propCol.setHeader("Property");
        propCol.setId("prop");
        propCol.setDataIndex("prop");
        propCol.setResizable(true);
        propCol.setSortable(true);

        ColumnConfig valueCol = new ColumnConfig();
        valueCol.setHeader("Value");
        valueCol.setId("value");
        valueCol.setDataIndex("value");
        valueCol.setResizable(true);
        valueCol.setSortable(true);

        ColumnConfig cardCol = new ColumnConfig();
        cardCol.setHeader("Cardinality");
        cardCol.setId("card");
        cardCol.setDataIndex("card");
        cardCol.setResizable(true);
        cardCol.setSortable(true);

        ColumnConfig[] columns = new ColumnConfig[] { propCol, valueCol, cardCol};

        ColumnModel columnModel = new ColumnModel(columns);
        propGrid.setColumnModel(columnModel);
View Full Code Here

    protected void onEntityDblClick() {
    }

    protected void createGrid() {
        ColumnConfig browserTextCol = new ColumnConfig();
        browserTextCol.setHeader("Results");
        browserTextCol.setId("browserText");
        browserTextCol.setDataIndex("browserText");
        browserTextCol.setResizable(true);
        browserTextCol.setSortable(true);
        browserTextCol.setTooltip("Double click search result to select in tree.");

        ColumnConfig[] columns = new ColumnConfig[] { browserTextCol };

        ColumnModel columnModel = new ColumnModel(columns);
        setColumnModel(columnModel);
View Full Code Here

    this.projectId = projectId;
    createGrid();
  }
 
  protected void createGrid() {
    ColumnConfig propCol = new ColumnConfig();
    propCol.setHeader("Property");
    propCol.setDataIndex("prop");
    propCol.setResizable(true);
    propCol.setSortable(true);

    ColumnConfig valueCol = new ColumnConfig();
    valueCol.setHeader("Value");
    valueCol.setId("AnnotationsGrid_ValueColumn");
    valueCol.setDataIndex("val");
    valueCol.setResizable(true);
    valueCol.setSortable(true);
   
    ColumnConfig langCol = new ColumnConfig();
    langCol.setHeader("Language");
    langCol.setDataIndex("lang");
    langCol.setResizable(true);
    langCol.setSortable(true);
   
    ColumnConfig[] columns = new ColumnConfig[]{propCol, valueCol, langCol};
    columnModel = new ColumnModel(columns)
    setColumnModel(columnModel);
   
View Full Code Here

        reload();
     }

    private void createColumns() {
        ColumnConfig authorCol = new ColumnConfig("Author", "author");
        authorCol.setResizable(true);
        authorCol.setSortable(true);

        ColumnConfig changeDescCol = new ColumnConfig("Change Description", "desc");
        changeDescCol.setResizable(true);
        changeDescCol.setSortable(true);
        changeDescCol.setId("changeDesc");
        setAutoExpandColumn("changeDesc");

        ColumnConfig appliesToCol = new ColumnConfig("Applies to", "applies");
        appliesToCol.setResizable(true);
        appliesToCol.setSortable(true);
        appliesToCol.setHidden(true);

        ColumnConfig timestampCol = new ColumnConfig("Timestamp", "timestamp");
        timestampCol.setResizable(true);
        timestampCol.setSortable(true);

        ColumnConfig entityCol = new ColumnConfig("Entity", "entity");
        entityCol.setResizable(true);
        entityCol.setSortable(true);
        entityCol.setHidden(true);

        ColumnConfig[] columns = new ColumnConfig[] { authorCol, changeDescCol, appliesToCol, timestampCol, entityCol };
        ColumnModel columnModel = new ColumnModel(columns);
        setColumnModel(columnModel);
    }
View Full Code Here

    //TODO: Uncomment this code after the patch to set entityName for a newly created portlet is set
    //reload();
  }

  private void createColumns() {
    ColumnConfig changeDescCol = new ColumnConfig("Description", "desc");
    changeDescCol.setId("ChangesGrid_ChangeDescCol");
    changeDescCol.setResizable(true);
    changeDescCol.setSortable(true);

    ColumnConfig authorCol = new ColumnConfig("Author", "author");
    authorCol.setResizable(true);
    authorCol.setSortable(true);

    ColumnConfig timestampCol = new ColumnConfig("Timestamp", "timestamp");
    timestampCol.setResizable(true);
    timestampCol.setSortable(true);

    ColumnConfig appliesToCol = new ColumnConfig("Applies to", "applies");
    appliesToCol.setResizable(true);
    appliesToCol.setSortable(true);
    appliesToCol.setHidden(true);

    ColumnConfig[] columns = new ColumnConfig[] { changeDescCol, authorCol,
        timestampCol, appliesToCol };
    ColumnModel columnModel = new ColumnModel(columns);
    changesGrid.setColumnModel(columnModel);
View Full Code Here

TOP

Related Classes of com.gwtext.client.widgets.grid.ColumnConfig

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.