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


Java SingleSelectionModel.getSelectedObject方法代码示例

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


在下文中一共展示了SingleSelectionModel.getSelectedObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scrollToTheEnd

import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
public static <T extends Hierarchic> void scrollToTheEnd(T newItem, SingleSelectionModel<T> selectionModel,
        ListDataProvider<? extends Hierarchic> listDataProvider, ResizableDataGrid<? extends Hierarchic> resizableDataGrid) {
    if (selectionModel.getSelectedObject() != null) {
        T selectedObject = selectionModel.getSelectedObject();
        selectionModel.setSelected(selectedObject, false);
    }
    Long oldId = newItem.getId();
    newItem.setId(-1L);
    selectionModel.setSelected(newItem, true);
    newItem.setId(oldId);
    int provSize = listDataProvider.getList().size();
    int pageSize = resizableDataGrid.getPageSize();
    int start = provSize < pageSize ? 0 : provSize - pageSize + 1;
    resizableDataGrid.setVisibleRange(start, pageSize);
    listDataProvider.refresh();
    resizableDataGrid.getScrollPanel().scrollToBottom();
}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:18,代码来源:ClientUtils.java

示例2: trySelectionModelValue

import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
/**
 * Returns the selected object by selection model
 * 
 * @param selectionModel
 * @param failText
 *            text to throw in case of cast exception
 * @param selectedClass
 *            expected class
 * @param allowSubclasses
 *            don't throw exception if the result is a subclass of the
 *            specified class
 * @return selectionModel's selected object
 * @throws SelectionModelInvalidClassException
 *             if the object has unexpected type.
 */
public static <S, T extends S> T trySelectionModelValue(SingleSelectionModel<S> selectionModel, String failText, Class<T> selectedClass,
        boolean allowSubclasses) {
    try {
        @SuppressWarnings("unchecked")
        T result = (T) selectionModel.getSelectedObject();
        if (result == null) {
            throw new SelectionModelNullException(failText);
        }
        if (!allowSubclasses && !result.getClass().getName().equals(selectedClass.getName())) {
            throw new SelectionModelInvalidClassException(failText);
        }
        return result;
    } catch (ClassCastException e) {
        throw new SelectionModelInvalidClassException(failText);
    }
}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:32,代码来源:ClientUtils.java

示例3: setTextboxValueBySelectionModel

import com.google.gwt.view.client.SingleSelectionModel; //导入方法依赖的package包/类
public static void setTextboxValueBySelectionModel(ValueBoxBase<String> textBox,
        SingleSelectionModel<? extends HasListboxValue> selectionModel) {
    HasListboxValue selected = selectionModel.getSelectedObject();
    if (selected == null) {
        textBox.setValue("");
    } else {
        textBox.setValue(selected.getListboxValue());
    }
}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:10,代码来源:ClientUtils.java


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