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 State" query results.
 
 
     private static final int PAGE_SIZE = 10;
     private final ClientFactory clientFactory;
     
     public StatePagedTable(
             final String stateName,
             ClientFactory clientFactory ) {
         super,
                 clientFactory );
         this. = clientFactory;
         
         setDataProvider(new AsyncDataProvider<StatePageRow>() {
             protected void onRangeChanged(HasData<StatePageRowdisplay) {
                 StatePageRequest request = new StatePageRequest();
                 request.setStateNamestateName );
                 request.setStartRowIndex.getPageStart() );
                 request.setPageSize );
                 .loadRuleListForStaterequest,
                                                         new GenericCallback<PageResponse<StatePageRow>>() {
                                                             public void onSuccess(PageResponse<StatePageRowresponse) {
                                                                 updateRowCountresponse.getTotalRowSize(),
                                                                                 response.isTotalRowSizeExact() );
                                                                 updateRowDataresponse.getStartRowIndex(),
                                                                                response.getPageRowList() );
                                                             }
                                                         } );
             }
         } );
     }
 
     @Override
     protected void addAncillaryColumns(ColumnPicker<StatePageRowcolumnPicker,
                                        SortableHeaderGroup<StatePageRowsortableHeaderGroup) {
 
 
             public ComparableImageResource getValue(StatePageRow row) {
                 AssetEditorFactory factory = .getAssetEditorFactory();
                 return new ComparableImageResource(row.getFormat(), factory.getAssetEditorIcon(row.getFormat()));
             }
         };
         columnPicker.addColumnformatColumn,
                                 new SortableHeader<StatePageRowComparableImageResource>(
                                                                                            sortableHeaderGroup,
                                                                                            .Format(),
                                                                                            formatColumn ),
                                 true );
 
         TitledTextColumn<StatePageRowtitleColumn = new TitledTextColumn<StatePageRow>() {
             public TitledText getValue(StatePageRow row) {
                 return new TitledTextrow.getName(),
                                                 row.getAbbreviatedDescription() );
             }
         };
         columnPicker.addColumntitleColumn,
                                 new SortableHeader<StatePageRowTitledText>(
                                                                               sortableHeaderGroup,
                                                                               .Name(),
                                                                               titleColumn ),
                                true );
        TextColumn<StatePageRowpackageNameColumn = new TextColumn<StatePageRow>() {
            public String getValue(StatePageRow row) {
                return row.getPackageName();
            }
        };
        columnPicker.addColumnpackageNameColumn,
                                new SortableHeader<StatePageRowString>(
                                                                          sortableHeaderGroup,
                                                                          .PackageName(),
                                                                          packageNameColumn ),
                                true );
        TextColumn<StatePageRowstatusNameColumn = new TextColumn<StatePageRow>() {
            public String getValue(StatePageRow row) {
                return row.getStateName();
            }
        };
        columnPicker.addColumnstatusNameColumn,
                                new SortableHeader<StatePageRowString>(
                                                                          sortableHeaderGroup,
                                                                          .Status(),
                                                                          statusNameColumn ),
                                true );
        Column<StatePageRowDatelastModifiedColumn = new Column<StatePageRowDate>( new
                                                                                        DateCell(
                                                                                                  DateTimeFormat.getFormat(
                                                                                                          .. ) ) ) {
            public Date getValue(StatePageRow row) {
                return row.getLastModified();
            }
        };
        columnPicker.addColumnlastModifiedColumn,
                                new SortableHeader<StatePageRowDate>(
                                                                        sortableHeaderGroup,
                                                                        .LastModified(),
                                                                        lastModifiedColumn ),
                                true );
    }
New to GrepCode? Check out our FAQ X