Package com.gwtext.client.widgets.grid

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


    super(TextProvider.get().identities_panel_title());
    setLayout(new BorderLayout());
    setBorder(false);

    ColumnModel columnModel = new ColumnModel(COLUMN_CONFIG);
    columnModel.setRenderer(0, new Renderer() {

      public String render( Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
          Store store ) {

        boolean checked = ((Boolean) value).booleanValue();
View Full Code Here


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

                setRenderer( new Renderer() {
                    public String render(Object value,
                                         CellMetadata cellMetadata,
                                         Record record,
                                         int rowIndex,
                                         int colNum,
View Full Code Here

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

        }, 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,
View Full Code Here

                    setHidden( true ); //don't want to show a separate description
                }

                private void handleCalendar() {
                    setWidth( 120 );
                    setRenderer( new Renderer() {
                        public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum, Store store) {
                            DateTimeFormat format = DateTimeFormat.getFormat( "yyyy/MM/dd HH:mm" );
                            return format.format( (Date) value );
                        }
                    } );
                }

                private void handleName() {
                    setWidth( 220 );
                    setRenderer( new Renderer() {
                        public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum, Store store) {
                            String fmtIcon = new Image( EditorLauncher.getAssetFormatIcon( record.getAsString( "format" ) ) ).getUrl();
                            String desc = record.getAsString( "Description" );
                            if ( desc == null ) {
                                desc = "";
View Full Code Here

                        setupHeader();
                        setSortable( true );
                        setDataIndex( header );
                        if ( header.equals( "Name" ) ) { //name is special !
                            setWidth( 220 );
                            setRenderer( new Renderer() {
                                public String render(Object value,
                                                     CellMetadata cellMetadata,
                                                     Record record,
                                                     int rowIndex,
                                                     int colNum,
                                                     Store store) {
                                    String fmtIcon = "images/" + EditorLauncher.getAssetFormatIcon( record.getAsString( "format" ) );
                                    String desc = record.getAsString( "Description" );
                                    if ( desc == null ) {
                                        desc = "";
                                    }
                                    return Format.format( "<img src='{0}'/>&nbsp;<b>{1}</b><br/><small>{2}</small>",
                                                          new String[]{fmtIcon, (String) value, desc} );
                                }
                            } );
                        } else if ( headerType.equals( "class java.util.Calendar" ) ) {
                            setRenderer( new Renderer() {
                                public String render(Object value,
                                                     CellMetadata cellMetadata,
                                                     Record record,
                                                     int rowIndex,
                                                     int colNum,
View Full Code Here

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

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

    ColumnModel cm = new ColumnModel(new ColumnConfig[] {
        new ColumnConfig() {
          {
            setDataIndex("severity")//NON-NLS
            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(25);
          }
        }, new ColumnConfig() {
          {
            setHeader(constants.Timestamp());
            setSortable(true);
            setDataIndex("timestamp");
            setWidth(180);
          }
        }, new ColumnConfig() {
          {
            setHeader(constants.Message());
            setSortable(true);
            setDataIndex("message"); //NON-NLS
            setWidth(580);

            setRenderer(new Renderer() {
              public String render(Object value,
                  CellMetadata cellMetadata, Record record,
                  int rowIndex, int colNum, Store store) {

                if (value != null) {
View Full Code Here

TOP

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

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.