Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2011 JBoss Inc
   * 
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   * use this file except in compliance with the License. You may obtain a copy of
   * the License at
   * 
   * http://www.apache.org/licenses/LICENSE-2.0
   * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  * License for the specific language governing permissions and limitations under
  * the License.
  */
 
 package org.drools.guvnor.client.widgets.tables;
 
 import java.util.Date;
 
 
Widget with a table of "By Category" query results.
 
 
     private static final int PAGE_SIZE = 10;
     private final ClientFactory clientFactory;
    
Constructor

Parameters:
categoryName
feedURL
 
     public CategoryPagedTable(final String categoryName,
                               final String feedURL,
                               ClientFactory clientFactory) {
         super,
                feedURL,
                 clientFactory);
         this. = clientFactory;
         
         setDataProvidernew AsyncDataProvider<CategoryPageRow>() {
             protected void onRangeChanged(HasData<CategoryPageRowdisplay) {
                 CategoryPageRequest request = new CategoryPageRequest();
                 request.setCategoryPathcategoryName );
                 request.setStartRowIndex.getPageStart() );
                 request.setPageSize );
                 .loadRuleListForCategoriesrequest,
                                                              new GenericCallback<PageResponse<CategoryPageRow>>() {
                                                                  public void onSuccess(PageResponse<CategoryPageRowresponse) {
                                                                      updateRowCountresponse.getTotalRowSize(),
                                                                                      response.isTotalRowSizeExact() );
                                                                      updateRowDataresponse.getStartRowIndex(),
                                                                                     response.getPageRowList() );
                                                                  }
                                                              } );
             }
         } );
     }
 
     @Override
     protected void addAncillaryColumns(ColumnPicker<CategoryPageRowcolumnPicker,
                                        SortableHeaderGroup<CategoryPageRowsortableHeaderGroup) {
 
 
             public ComparableImageResource getValue(CategoryPageRow row) {
                 AssetEditorFactory factory = .getAssetEditorFactory();
                 return new ComparableImageResource(row.getFormat(), factory.getAssetEditorIcon(row.getFormat()));
             }
         };
         columnPicker.addColumnformatColumn,
                                 new SortableHeader<CategoryPageRowComparableImageResource>(
                                                                                               sortableHeaderGroup,
                                                                                               .Format(),
                                                                                               formatColumn ),
                                 true );
 
         TitledTextColumn<CategoryPageRowtitleColumn = new TitledTextColumn<CategoryPageRow>() {
             public TitledText getValue(CategoryPageRow row) {
                 return new TitledTextrow.getName(),
                                                 row.getAbbreviatedDescription() );
            }
        };
        columnPicker.addColumntitleColumn,
                                new SortableHeader<CategoryPageRowTitledText>(
                                                                                 sortableHeaderGroup,
                                                                                 .Name(),
                                                                                 titleColumn ),
                                true );
        TextColumn<CategoryPageRowpackageNameColumn = new TextColumn<CategoryPageRow>() {
            public String getValue(CategoryPageRow row) {
                return row.getPackageName();
            }
        };
        columnPicker.addColumnpackageNameColumn,
                                new SortableHeader<CategoryPageRowString>(
                                                                             sortableHeaderGroup,
                                                                             .PackageName(),
                                                                             packageNameColumn ),
                                true );
        TextColumn<CategoryPageRowstatusNameColumn = new TextColumn<CategoryPageRow>() {
            public String getValue(CategoryPageRow row) {
                return row.getStateName();
            }
        };
        columnPicker.addColumnstatusNameColumn,
                                new SortableHeader<CategoryPageRowString>(
                                                                             sortableHeaderGroup,
                                                                             .Status(),
                                                                             statusNameColumn ),
                                true );
        Column<CategoryPageRowDatelastModifiedColumn = new Column<CategoryPageRowDate>( new
                                                                                              DateCell(
                                                                                                        DateTimeFormat.getFormat(
                                                                                                                .. ) ) ) {
            public Date getValue(CategoryPageRow row) {
                return row.getLastModified();
            }
        };
        columnPicker.addColumnlastModifiedColumn,
                                new SortableHeader<CategoryPageRowDate>(
                                                                           sortableHeaderGroup,
                                                                           .LastModified(),
                                                                           lastModifiedColumn ),
                                true );
    }
    @Override
    protected void onUnload() {
        super.onUnload();
        for ( Command unloadListener :  ) {
            unloadListener.execute();
        }
    }
New to GrepCode? Check out our FAQ X