Package com.gwtext.client.widgets.grid

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


        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);
        setColumnModel(columnModel);
    }
View Full Code Here


        FieldDef[] fds = new FieldDef[vars.length];
        ColumnConfig[] cols = new ColumnConfig[fds.length];

        int idx = 0;
        for ( String var : vars ) {
            cols[idx] = new ColumnConfig();
            cols[idx].setHeader( var );
            cols[idx].setDataIndex( var );
            cols[idx].setSortable( false );
            cols[idx].setWidth( 50 );
            cols[idx].setResizable( true );
View Full Code Here

        store.setDataProxy( proxy );
        store.setGroupField( "isAdmin" ); //NON-NLS
        store.setSortInfo( new SortState( "userName", SortDir.ASC ) ); //NON-NLS
        store.load();

        ColumnModel cm = new ColumnModel( new ColumnConfig[]{new ColumnConfig() {
            {
                setDataIndex( "userName" ); //NON-NLS
                setSortable( true );
                setHeader( constants.UserName1() );
            }
        }, new ColumnConfig() {
            {
                setHeader( constants.Administrator() );
                setSortable( true );
                setDataIndex( "isAdmin" ); //NON-NLS
            }
        }, new ColumnConfig() {
            {
                setHeader( constants.HasPackagePermissions() );
                setSortable( true );
                setDataIndex( "isPackage" ); //NON-NLS
            }
        }, new ColumnConfig() {
            {
                setHeader( constants.HasCategoryPermissions() );
                setSortable( true );
                setDataIndex( "isCategory" ); //NON-NLS
            }
View Full Code Here

                                 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='" + new Image( images.error() ).getUrl() + "'/>";
                        } else if ( i.intValue() == 1 ) {
                            return "<img src='" + new Image( images.information() ).getUrl() + "'/>";
                        } 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

                                 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

        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() + "'/>" + 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

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

        ColumnConfig keyCol = new ColumnConfig( "Key?",
                                                "key",
                                                100,
                                                true,
                                                null,
                                                "key" ); //NON-NLS
        keyCol.setEditor( new GridEditor( new TextField() ) );
        keyCol.setFixed( false );

        ColumnConfig valueCol = new ColumnConfig( "Value?",
                                                  "value",
                                                  100,
                                                  true,
                                                  null,
                                                  "value" ); //NON-NLS
        valueCol.setEditor( new GridEditor( new TextField() ) );
        valueCol.setFixed( false );

        ColumnConfig[] columnConfigs = {keyCol, valueCol};

        ColumnModel columnModel = new ColumnModel( columnConfigs );
        columnModel.setDefaultSortable( true );
View Full Code Here

    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

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

        //first the UUID
        cfgs[0] = new ColumnConfig() {
            {
                setHidden( true );
                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() {
                {
                    if ( !header.equals( "Description" ) ) {

                        setupHeader();
                        setSortable( true );
View Full Code Here

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

    int colCount = 0;

    BaseColumnConfig[] cols = new BaseColumnConfig[fds.length + 1]; //its +1 as we have the separator -> thing.
    cols[0] = new ColumnConfig() {
        {
          setDataIndex("num");              //NON-NLS
          setWidth(20);
          setSortable(true);
          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'>" + value + "</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);
          }

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

        }
      };
      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);
          }
        }
      };
      colMap.put(c.header, c);
      colCount++;
    }

    //the split thing
    cols[colCount] = new ColumnConfig() {
      {
          setDataIndex("x");
          setHeader("");
          //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-1] = 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

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.