当前位置: 首页>>代码示例>>Java>>正文


Java Range类代码示例

本文整理汇总了Java中com.google.gwt.view.client.Range的典型用法代码示例。如果您正苦于以下问题:Java Range类的具体用法?Java Range怎么用?Java Range使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Range类属于com.google.gwt.view.client包,在下文中一共展示了Range类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateRowCount

import com.google.gwt.view.client.Range; //导入依赖的package包/类
protected void updateRowCount(HasData<T> display, int rowCount) {
	Range range = display.getVisibleRange();
	
	if(display.getRowCount() != rowCount) {
		display.setRowCount(rowCount);
	}
			
	if(range.getStart() >= rowCount 
			|| range.getStart() % range.getLength() > 0) {
		int length = range.getLength();
		int start = length * (rowCount/length);
		if(rowCount > 0 && start == rowCount) {
			start -= length;
		}
		display.setVisibleRange(start, length);
	}
}
 
开发者ID:Novartis,项目名称:ontobrowser,代码行数:18,代码来源:EntityListDataProvider.java

示例2: createProvider

import com.google.gwt.view.client.Range; //导入依赖的package包/类
private void createProvider() {
    dataProvider = new AsyncDataProvider<DataGridFilterSummary>() {

        @Override
        protected void onRangeChanged(HasData<DataGridFilterSummary> display) {

            final Range visibleRange = display.getVisibleRange();
            List<DataGridFilterSummary> currentCustomFilters = getData();
            dataProvider.updateRowCount(currentCustomFilters.size(),
                                        true);
            int endRange;
            if (visibleRange.getStart() + 5 < currentCustomFilters.size()) {

                endRange = visibleRange.getStart() + 5;
            } else {
                endRange = currentCustomFilters.size();
            }
            dataProvider.updateRowData(visibleRange.getStart(),
                                       currentCustomFilters.subList(visibleRange.getStart(),
                                                                    endRange));
        }
    };
    existingFiltersGrid.setDataProvider(dataProvider);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:NewFilterPopup.java

示例3: setPageStart

import com.google.gwt.view.client.Range; //导入依赖的package包/类
@Override
public void setPageStart(int index) {
    if (getDisplay() != null) {
        Range range = getDisplay().getVisibleRange();
        int displayPageSize = range.getLength();
        if (!isRangeLimited() && getDisplay().isRowCountExact()) {
            index = Math.min(index,
                             getDisplay().getRowCount() - displayPageSize);
        }
        index = Math.max(0,
                         index);
        if (index != range.getStart()) {
            getDisplay().setVisibleRange(index,
                                         displayPageSize);
        }
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:UberfireSimplePager.java

示例4: onRangeChanged

import com.google.gwt.view.client.Range; //导入依赖的package包/类
@Override
protected void onRangeChanged(HasData<JarListPageRow> display) {
    final Range range = display.getVisibleRange();
    JarListPageRequest request = new JarListPageRequest(range.getStart(),
                                                        range.getLength(),
                                                        filter,
                                                        fileFormats,
                                                        getSortColumnDataStoreName(),
                                                        isSortColumnAscending());

    m2RepoService.call(new RemoteCallback<PageResponse<JarListPageRow>>() {
        @Override
        public void callback(final PageResponse<JarListPageRow> response) {
            updateRowCount(response.getTotalRowSize(),
                           response.isTotalRowSizeExact());
            updateRowData(response.getStartRowIndex(),
                          response.getPageRowList());
        }
    }).listArtifacts(request);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:ArtifactListPresenterImpl.java

示例5: onRangeChanged

import com.google.gwt.view.client.Range; //导入依赖的package包/类
@Override
protected void onRangeChanged(HasData<PacketChatMessage> display) {
	final Range range = display.getVisibleRange();

	Service.Util.getInstance().getChatLog(range.getStart(),
			new AsyncCallback<List<PacketChatMessage>>() {
				@Override
				public void onSuccess(List<PacketChatMessage> result) {
					updateRowData(range.getStart(), result);
					if (result.isEmpty()) {
						return;
					}
					final PacketChatMessage first = result.get(0);
					panelPast.setValue(new Date(first.date), false);
				}

				@Override
				public void onFailure(Throwable caught) {
					logger.log(Level.WARNING, "チャット過去ログの取得に失敗しました", caught);
				}
			});
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:23,代码来源:PastChatDataProvider.java

示例6: setVisibleRange

import com.google.gwt.view.client.Range; //导入依赖的package包/类
public void setVisibleRange(Range range) {
    if (range.getStart() == rangeStart && rangeEnd - rangeStart == range.getLength()) {
        return;
    }
    presenter.getState().setVisibleDirty(true);
    rangeStart = range.getStart();
    rangeEnd = range.getStart() + range.getLength();
    presenter.draw();
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:10,代码来源:TwoDayViewPager.java

示例7: setVisibleRange

import com.google.gwt.view.client.Range; //导入依赖的package包/类
protected void setVisibleRange(Range range, boolean forceRangeChangeEvent) {
    final int start = range.getStart();
    final int length = range.getLength();
    if (start < 0) {
        throw new IllegalArgumentException("Range start cannot be less than 0");
    }
    if (length < 0) {
        throw new IllegalArgumentException("Range length cannot be less than 0");
    }

    // Update the page start.
    final int pageStart = this.range.getStart();
    final int pageSize = this.range.getLength();
    final boolean pageStartChanged = (pageStart != start);
    if (pageStartChanged) {
        // Update the range start
        this.range = new Range(start, this.range.getLength());
    }

    // Update the page size
    final boolean pageSizeChanged = (pageSize != length);
    if (pageSizeChanged) {
        this.range = new Range(this.range.getStart(), length);
    }

    // Clear the rows
    rows.clear();

    // Update the pager and data source if the range changed
    if (pageStartChanged || pageSizeChanged || forceRangeChangeEvent) {
        RangeChangeEvent.fire(this, getVisibleRange());
    }
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material-table,代码行数:34,代码来源:AbstractDataView.java

示例8: testSetup

import com.google.gwt.view.client.Range; //导入依赖的package包/类
@Override
public void testSetup() throws Exception {
    // given / when
    super.testSetup();

    InfiniteDataView<Person> dataView = (InfiniteDataView<Person>) table.getView();

    // then
    assertFalse(dataView.isDynamicView());
    assertEquals(new Range(0, 100), dataView.getVisibleRange());
    assertEquals(1, $(dataView.getContainer()).find(".bufferTop").length());
    assertEquals(1, $(dataView.getContainer()).find(".bufferBottom").length());
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material-table,代码行数:14,代码来源:InfiniteDataViewTest.java

示例9: addDialogWidgets

import com.google.gwt.view.client.Range; //导入依赖的package包/类
private void addDialogWidgets() {
	VerticalPanel vertPanel = new VerticalPanel();					
	SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
	SimplePager pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true) {
		@Override
		public void setPageStart(int index) {
			HasRows display = getDisplay();
			if (display != null) {
				Range range = display.getVisibleRange();
				int pageSize = range.getLength();
				if (isRangeLimited() && display.isRowCountExact()) {
					index = Math.min(index, display.getRowCount() - 1);
				}
				index = Math.max(0, index);
				if (index != range.getStart()) {
					display.setVisibleRange(index, pageSize);
				}
			}
		}
	};
			
	vertPanel.addStyleName("dialog-vpanel");
					
	
	vertPanel.add(table);
	vertPanel.add(pager);
    
	pager.setDisplay(table);
	pager.addStyleName("centered-hortz");    
    				
	dialogBox.setWidget(vertPanel);
}
 
开发者ID:Novartis,项目名称:ontobrowser,代码行数:33,代码来源:ControlledVocabularyTermLinksView.java

示例10: createDataProvider

import com.google.gwt.view.client.Range; //导入依赖的package包/类
/**
 * Create DataProvider for the DataSources table
 * @return the data provider
 */
private AsyncDataProvider<QueryResultPageRow> createDataProvider(final String source, final String sql) {
	AsyncDataProvider<QueryResultPageRow> dataProvider = new AsyncDataProvider<QueryResultPageRow>() {
		protected void onRangeChanged( HasData<QueryResultPageRow> display ) {
			final Range range = display.getVisibleRange();
			PageRequest request = new PageRequest( range.getStart(), range.getLength() );

			queryService.getQueryResults(request, source, sql, new IRpcServiceInvocationHandler<PageResponse<QueryResultPageRow>>() {
				@Override
				public void onReturn(final PageResponse<QueryResultPageRow> response) {
					updateRowCount( response.getTotalRowSize(), response.isTotalRowSizeExact() );
					updateRowData( response.getStartRowIndex(), response.getPageRowList() );
					if(response.getTotalRowSize()==0) {
						refreshCompleteEvent.fire(new UiEvent(UiEventType.QUERY_RESULT_DISPLAYER_REFRESHED_NOROWS));
					} else {
						refreshCompleteEvent.fire(new UiEvent(UiEventType.QUERY_RESULT_DISPLAYER_REFRESHED_OK));
					}
				}
				@Override
				public void onError(Throwable error) {
			    	errorMessage = error.getMessage();
					refreshCompleteEvent.fire(new UiEvent(UiEventType.QUERY_RESULT_DISPLAYER_REFRESHED_ERROR));
				}
			});
		}
	};

	return dataProvider;
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:33,代码来源:QueryResultPagedTableDisplayer.java

示例11: nextPage

import com.google.gwt.view.client.Range; //导入依赖的package包/类
@Override
public void nextPage() {
    if ( getDisplay() != null ) {
        Range range = getDisplay().getVisibleRange();
        setPageStart( range.getStart()
                              + getPageSize() );
    }
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:9,代码来源:TeiidSimplePager.java

示例12: previousPage

import com.google.gwt.view.client.Range; //导入依赖的package包/类
@Override
public void previousPage() {
    if ( getDisplay() != null ) {
        Range range = getDisplay().getVisibleRange();
        setPageStart( range.getStart()
                              - getPageSize() );
    }
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:9,代码来源:TeiidSimplePager.java

示例13: setPageStart

import com.google.gwt.view.client.Range; //导入依赖的package包/类
@Override
public void setPageStart( int index ) {
    if (getDisplay() != null) {
      Range range = getDisplay().getVisibleRange();
      int displayPageSize = range.getLength();
      if (!isRangeLimited() && getDisplay().isRowCountExact()) {
        index = Math.min(index, getDisplay().getRowCount() - displayPageSize);
      }
      index = Math.max(0, index);
      if (index != range.getStart()) {
        getDisplay().setVisibleRange(index, displayPageSize);
      }
    }  
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:15,代码来源:TeiidSimplePager.java

示例14: createText

import com.google.gwt.view.client.Range; //导入依赖的package包/类
protected String createText() {
    NumberFormat formatter = NumberFormat.getFormat( "#,###" );
    HasRows display = getDisplay();
    Range range = display.getVisibleRange();
    int pageStart = range.getStart() + 1;
    int pageSize = range.getLength();
    int dataSize = display.getRowCount();
    int endIndex = Math.min( dataSize,
                             pageStart
                                     + pageSize
                                     - 1 );
    endIndex = Math.max( pageStart,
                         endIndex );
    boolean exact = display.isRowCountExact();
    if ( dataSize == 0 ) {
        return "0 of 0";
    } else if ( pageStart == endIndex ) {
        return formatter.format( pageStart )
                + " of "
                + formatter.format( dataSize );
    }
    return formatter.format( pageStart )
            + "-"
            + formatter.format( endIndex )
            + ( exact ? " of " : " of over " )
            + formatter.format( dataSize );
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:28,代码来源:TeiidSimplePager.java

示例15: createText

import com.google.gwt.view.client.Range; //导入依赖的package包/类
/**
 * Get the text to display in the pager that reflects the state of the pager.
 * 
 * @return the text
 */
protected String createText () {
	// Default text is 1 based.
	NumberFormat formatter = NumberFormat.getFormat("#,###");
	HasRows display = getDisplay();
	Range range = display.getVisibleRange();
	int pageStart = range.getStart() + 1;
	int pageSize = range.getLength();
	int dataSize = display.getRowCount();
	int endIndex = Math.min(dataSize, pageStart + pageSize - 1);
	endIndex = Math.max(pageStart, endIndex);
	boolean exact = display.isRowCountExact();
	return formatter.format(pageStart) + "-" + formatter.format(endIndex)
			+ (exact ? " of " : " of over ") + formatter.format(dataSize);
}
 
开发者ID:billy1380,项目名称:blogwt,代码行数:20,代码来源:SimplePager.java


注:本文中的com.google.gwt.view.client.Range类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。