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;
 import java.util.List;
 
 
Widget with a table of repository query results.
 
 
     private static final int    PAGE_SIZE = 10;
     private final ClientFactory clientFactory;
 
     public QueryPagedTable(final List<MetaDataQuerymetadata,
                            final Date createdAfter,
                            final Date createdBefore,
                            final Date lastModifiedAfter,
                            final Date lastModifiedBefore,
                            final Boolean searchArchived,
                            ClientFactory clientFactory) {
         super,
                 clientFactory );
         this. = clientFactory;
 
         setDataProvidernew AsyncDataProvider<QueryPageRow>() {
             protected void onRangeChanged(HasData<QueryPageRowdisplay) {
                 QueryMetadataPageRequest request = new QueryMetadataPageRequest();
                 request.setMetadatametadata );
                 request.setCreatedAftercreatedAfter );
                 request.setCreatedBeforecreatedBefore );
                 request.setLastModifiedAfterlastModifiedAfter );
                 request.setLastModifiedBeforelastModifiedBefore );
                 request.setSearchArchivedsearchArchived );
                 request.setStartRowIndex.getPageStart() );
                 request.setPageSize );
                 .queryMetaDatarequest,
                                                   new GenericCallback<PageResponse<QueryPageRow>>() {
                                                       public void onSuccess(PageResponse<QueryPageRowresponse) {
                                                           updateRowCountresponse.getTotalRowSize(),
                                                                           response.isTotalRowSizeExact() );
                                                           updateRowDataresponse.getStartRowIndex(),
                                                                          response.getPageRowList() );
                                                       }
                                                   } );
             }
         } );
     }
 
     public QueryPagedTable(final String searchText,
                            final Boolean searchArchived,
                            ClientFactory clientFactory) {
         super,
                 clientFactory );
         this. = clientFactory;
 
         setDataProvidernew AsyncDataProvider<QueryPageRow>() {
             protected void onRangeChanged(HasData<QueryPageRowdisplay) {
                 QueryPageRequest request = new QueryPageRequest();
                 request.setSearchTextsearchText );
                 request.setSearchArchivedsearchArchived );
                 request.setStartRowIndex.getPageStart() );
                 request.setPageSize );
                 .queryFullTextrequest,
                                                   new GenericCallback<PageResponse<QueryPageRow>>() {
                                                       public void onSuccess(PageResponse<QueryPageRowresponse) {
                                                          updateRowCountresponse.getTotalRowSize(),
                                                                          response.isTotalRowSizeExact() );
                                                          updateRowDataresponse.getStartRowIndex(),
                                                                         response.getPageRowList() );
                                                      }
                                                  } );
            }
        } );
    }

    
Constructor

Parameters:
searchText
searchArchived
isCaseSensitive
    public QueryPagedTable(final String searchText,
                           final Boolean searchArchived,
                           final Boolean isCaseSensitive,
                           ClientFactory clientFactory) {
        super,
                clientFactory );
        this. = clientFactory;
            protected void onRangeChanged(HasData<QueryPageRowdisplay) {
                QueryPageRequest request = new QueryPageRequest();
                request.setSearchTextsearchText );
                request.setSearchArchivedsearchArchived );
                request.setIsCaseSensitiveisCaseSensitive );
                request.setStartRowIndex.getPageStart() );
                request.setPageSize );
                .quickFindAssetrequest,
                                                  new GenericCallback<PageResponse<QueryPageRow>>() {
                                                      public void onSuccess(PageResponse<QueryPageRowresponse) {
                                                          updateRowCountresponse.getTotalRowSize(),
                                                                          response.isTotalRowSizeExact() );
                                                          updateRowDataresponse.getStartRowIndex(),
                                                                         response.getPageRowList() );
                                                      }
                                                  } );
            }
        } );
    }
    @Override
    protected void addAncillaryColumns(ColumnPicker<QueryPageRowcolumnPicker,
                                       SortableHeaderGroup<QueryPageRowsortableHeaderGroup) {
            public ComparableImageResource getValue(QueryPageRow row) {
                AssetEditorFactory factory = .getAssetEditorFactory();
                return new ComparableImageResourcerow.getFormat(),
                                                    factory.getAssetEditorIconrow.getFormat() ) );
            }
        };
        columnPicker.addColumnformatColumn,
                                new SortableHeader<QueryPageRowComparableImageResource>(
                                                                                           sortableHeaderGroup,
                                                                                           .Format(),
                                                                                           formatColumn ),
                                true );
        TitledTextColumn<QueryPageRowtitleColumn = new TitledTextColumn<QueryPageRow>() {
            public TitledText getValue(QueryPageRow row) {
                return new TitledTextrow.getName(),
                                                row.getAbbreviatedDescription() );
            }
        };
        columnPicker.addColumntitleColumn,
                                new SortableHeader<QueryPageRowTitledText>(
                                                                              sortableHeaderGroup,
                                                                              .Name(),
                                                                              titleColumn ),
                                true );
        TextColumn<QueryPageRowpackageNameColumn = new TextColumn<QueryPageRow>() {
            public String getValue(QueryPageRow row) {
                return row.getPackageName();
            }
        };
        columnPicker.addColumnpackageNameColumn,
                                new SortableHeader<QueryPageRowString>(
                                                                          sortableHeaderGroup,
                                                                          .PackageName(),
                                                                          packageNameColumn ),
                                false );
        Column<QueryPageRowDatecreatedDateColumn = new Column<QueryPageRowDate>( new
                                                                                       DateCell(
                                                                                                 DateTimeFormat.getFormat(
                                                                                                         .. ) ) ) {
            public Date getValue(QueryPageRow row) {
                return row.getCreatedDate();
            }
        };
        columnPicker.addColumncreatedDateColumn,
                                new SortableHeader<QueryPageRowDate>(
                                                                        sortableHeaderGroup,
                                                                        .CreatedDate(),
                                                                        createdDateColumn ),
                                false );
        Column<QueryPageRowDatelastModifiedColumn = new Column<QueryPageRowDate>( new
                                                                                        DateCell(
                                                                                                  DateTimeFormat.getFormat(
                                                                                                          .. ) ) ) {
            public Date getValue(QueryPageRow row) {
                return row.getLastModified();
            }
        };
        columnPicker.addColumnlastModifiedColumn,
                                new SortableHeader<QueryPageRowDate>(
                                                                        sortableHeaderGroup,
                                                                        .LastModified(),
                                                                        lastModifiedColumn ),
                                true );
    }
New to GrepCode? Check out our FAQ X