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 Archived Assets.
 
 
     // UI
     interface AdminArchivedPagedTableBinder
         extends
         UiBinder<WidgetAdminArchivedPagedTable> {
     }
 
     @UiField()
     protected Button                             restoreSelectedAssetButton;
 
     @UiField()
     protected Button                             deleteSelectedAssetButton;
 
     private static AdminArchivedPagedTableBinder uiBinder  = GWT.createAdminArchivedPagedTableBinder.class );
 
     // Commands for UI
     private Command                              restoreSelectedAssetCommand;
     private Command                              deleteSelectedAssetCommand;
 
     // Other stuff
     private static final int                     PAGE_SIZE = 10;    
     private final ClientFactory clientFactory;
 
     public AdminArchivedPagedTable(Command restoreSelectedAssetCommand,
                                    Command deleteSelectedAssetCommand,
                                    ClientFactory clientFactory) {
         super,
                 clientFactory);
         this. = restoreSelectedAssetCommand;
         this. = deleteSelectedAssetCommand;
         this. = clientFactory;
             protected void onRangeChanged(HasData<AdminArchivedPageRowdisplay) {
                 PageRequest request = new PageRequest.getPageStart(),
                                                                   );
                 .loadArchivedAssetsrequest,
                                                       new GenericCallback<PageResponse<AdminArchivedPageRow>>() {
                                                           public void onSuccess(PageResponse<AdminArchivedPageRowresponse) {
                                                               updateRowCountresponse.getTotalRowSize(),
                                                                               response.isTotalRowSizeExact() );
                                                               updateRowDataresponse.getStartRowIndex(),
                                                                              response.getPageRowList() );
                                                           }
                                                       } );
             }
         } );
 
     }
 
     @Override
     protected void addAncillaryColumns(ColumnPicker<AdminArchivedPageRowcolumnPicker,
                                        SortableHeaderGroup<AdminArchivedPageRowsortableHeaderGroup) {
            public ComparableImageResource getValue(AdminArchivedPageRow row) {
                AssetEditorFactory factory = .getAssetEditorFactory();
                return new ComparableImageResource(row.getFormat(), factory.getAssetEditorIcon(row.getFormat()));
            }
        };
        columnPicker.addColumnformatColumn,
                                new SortableHeader<AdminArchivedPageRowComparableImageResource>(
                                                                                                   sortableHeaderGroup,
                                                                                                   .Format(),
                                                                                                   formatColumn ),
                                true );
        TextColumn<AdminArchivedPageRownameColumn = new TextColumn<AdminArchivedPageRow>() {
            public String getValue(AdminArchivedPageRow row) {
                return row.getName();
            }
        };
        columnPicker.addColumnnameColumn,
                                new SortableHeader<AdminArchivedPageRowString>(
                                                                                  sortableHeaderGroup,
                                                                                  .Name(),
                                                                                  nameColumn ),
                                true );
        TextColumn<AdminArchivedPageRowpackageNameColumn = new TextColumn<AdminArchivedPageRow>() {
            public String getValue(AdminArchivedPageRow row) {
                return row.getPackageName();
            }
        };
        columnPicker.addColumnpackageNameColumn,
                                new SortableHeader<AdminArchivedPageRowString>(
                                                                                  sortableHeaderGroup,
                                                                                  .PackageName(),
                                                                                  packageNameColumn ),
                                false );
        TextColumn<AdminArchivedPageRowlastContributorColumn = new TextColumn<AdminArchivedPageRow>() {
            public String getValue(AdminArchivedPageRow row) {
                return row.getLastContributor();
            }
        };
        columnPicker.addColumnlastContributorColumn,
                                new SortableHeader<AdminArchivedPageRowString>(
                                                                                  sortableHeaderGroup,
                                                                                  .LastContributor(),
                                                                                  lastContributorColumn ),
                                true );
        Column<AdminArchivedPageRowDatelastModifiedColumn = new Column<AdminArchivedPageRowDate>( new
                                                                                                        DateCell(
                                                                                                                  DateTimeFormat.getFormat(
                                                                                                                          .. ) ) ) {
            public Date getValue(AdminArchivedPageRow row) {
                return row.getLastModified();
            }
        };
        columnPicker.addColumnlastModifiedColumn,
                                new SortableHeader<AdminArchivedPageRowDate>(
                                                                                sortableHeaderGroup,
                                                                                .LastModified(),
                                                                                lastModifiedColumn ),
                                true );
    }
    @Override
    protected Widget makeWidget() {
        return .createAndBindUithis );
    }
    @UiHandler("restoreSelectedAssetButton")
    void restoreSelectedAsset(ClickEvent e) {
    }
    @UiHandler("deleteSelectedAssetButton")
    void deleteSelectedAsset(ClickEvent e) {
    }
New to GrepCode? Check out our FAQ X