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


Java SingleSelectionModel类代码示例

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


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

示例1: postConstruct

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
/**
 * Called after construction.
 */
@PostConstruct
protected void postConstruct() {
	// SelectionModel to handle Source selection 
	dsSelectionModel = new SingleSelectionModel<String>();
	viewSourceNamesTable.setSelectionModel(dsSelectionModel); 
	dsSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
		public void onSelectionChange( SelectionChangeEvent event) { 
			String selectedRow = dsSelectionModel.getSelectedObject();
			selectedSource = selectedRow;
			if(selectedSource!=null) {
				deleteButton.setEnabled(true);
			} else {
				deleteButton.setEnabled(false);
			}
		} });
	
	// Initially disabled.  Enables when user makes a selection
	deleteButton.setEnabled(false);
	
	// Tooltips
	addButton.setTitle(i18n.format("viewsource-panel.addButton.tooltip"));
	addButton.setIcon(IconType.PLUS);
	deleteButton.setTitle(i18n.format("viewsource-panel.deleteButton.tooltip"));
	deleteButton.setIcon(IconType.MINUS);
	viewSourceNamesTable.setTitle(i18n.format("viewsource-panel.viewSourceNamesTable.tooltip"));
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:30,代码来源:ViewSourcePanel.java

示例2: ListView

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
public ListView(final ListPresenter<LISTITEM> presenter, Cell<LISTITEM> itemDisplayCell) {
	this.presenter = presenter;	
	this.cellList = new CellList<LISTITEM>(itemDisplayCell);
	
	cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);

    // Add a selection model to handle user selection.
    final SingleSelectionModel<LISTITEM> selectionModel = new SingleSelectionModel<LISTITEM>();
    cellList.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
      public void onSelectionChange(SelectionChangeEvent event) {
        LISTITEM selected = selectionModel.getSelectedObject();
        if (selected != null) {
          presenter.onSelectionChanged(event, selectionModel);
        }
      }
    });
	this.pagerTop = new SimplePager();
	this.pagerTop.setDisplay(this.cellList);
	this.pagerBottom = new SimplePager();
	this.pagerBottom.setDisplay(this.cellList);
	
	initWidget((Widget)uiBinder.createAndBindUi(this));		
}
 
开发者ID:jkonert,项目名称:socom,代码行数:25,代码来源:ListView.java

示例3: SearchControl

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
public SearchControl(final SearchConsumer searchConsumer, final MarkerContainer markerContainer, final SearchOptions options) {
    super(JSObject.createJSObject());
    setJSObject(SearchControlImpl.create(this, options.getJSObject()));
    VConsole.log("new SearchControl()");
    m_searchConsumer = searchConsumer;
    m_markerContainer = markerContainer;
    m_selectionModel = new SingleSelectionModel<NodeMarker>();

    m_historyWrapper = new HistoryWrapper();

    initializeContainerWidget();
    initializeInputWidget();
    initializeSubmitWidget();
    initializeCellAutocompleteWidget();
    initializeSearchStateManager();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:17,代码来源:SearchControl.java

示例4: getNodeInfo

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
@Override
public <T> NodeInfo<?> getNodeInfo(T value) {
	if (value == null) {
		return new DefaultNodeInfo<PacketTheme>(themeProvider = new ThemeProvider(presenter),
				new ThemeCell(), new SingleSelectionModel<PacketTheme>(),
				themeCellPreviewEventHandler, null);

	} else if (value instanceof PacketTheme) {
		PacketTheme theme = (PacketTheme) value;
		return new DefaultNodeInfo<PacketThemeQuery>(
				themeQueryProvider = new ThemeQueryProvider(presenter, theme.getName()),
				new ThemeQueryCell(), new SingleSelectionModel<PacketThemeQuery>(),
				themeQueryCellPreviewEventHandler, null);

	} else {
		throw new IllegalArgumentException("Unsupported object type: "
				+ value.getClass().getName());
	}
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:20,代码来源:ThemeQueryTreeViewModel.java

示例5: 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

示例6: 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

示例7: initialize

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
private void initialize() {
	Resources resources = GWT.create(Resources.class);
	EventCell eventCell = new EventCell(resources.tux());
	cellList = new CellList<EventProxy>(eventCell);
	cellList.setPageSize(10);
	cellList.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
	cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION);

	final SingleSelectionModel<EventProxy> selectionModel = new SingleSelectionModel<EventProxy>();
	cellList.setSelectionModel(selectionModel);
	selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

		@Override
		public void onSelectionChange(SelectionChangeEvent event) {
			presenter.goEventDetailView(selectionModel.getSelectedObject().getId());
		}
	});

	eventPagerPanel.setDisplay(cellList);
}
 
开发者ID:burakince,项目名称:open-course-organizer,代码行数:21,代码来源:EventsView.java

示例8: StudentEditorPresenter

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
public StudentEditorPresenter(final GwtPreferences preferences) {
    this.preferences = preferences;
    initWidget(uiBinder.createAndBindUi(this));
    TextCell textCell = new TextCell();
    studentDisplay = new CellList<String>(textCell);
    studentList = new ListDataProvider<>(preferences.getStudentNames());
    studentList.addDataDisplay(studentDisplay);
    selectionModel = new SingleSelectionModel<>();
    studentDisplay.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
            updateSelectedStudent();
            oldStudentName = selectionModel.getSelectedObject();
            studentName.setText(oldStudentName);
        }
    });
    studentPanel.add(studentDisplay);
    selectionModel.setSelected(studentList.getList().get(0), true);
}
 
开发者ID:donkirkby,项目名称:vograbulary,代码行数:21,代码来源:StudentEditorPresenter.java

示例9: initialiseAvailablePatterns

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
private void initialiseAvailablePatterns() {
    availablePatternsContainer.add(availablePatternsWidget);
    availablePatternsWidget.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
    availablePatternsWidget.setMinimumWidth(170);

    final Label lstEmpty = new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoAvailablePatterns());
    lstEmpty.setStyleName(WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem());
    availablePatternsWidget.setEmptyListWidget(lstEmpty);

    final SingleSelectionModel<Pattern52> selectionModel = new SingleSelectionModel<Pattern52>();
    availablePatternsWidget.setSelectionModel(selectionModel);

    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange(final SelectionChangeEvent event) {
            availablePatternsSelection = selectionModel.getSelectedObject();
            presenter.selectPattern(availablePatternsSelection);
        }
    });
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:22,代码来源:FactPatternConstraintsPageViewImpl.java

示例10: initialiseAvailablePatterns

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
private void initialiseAvailablePatterns() {
    availablePatternsContainer.add( availablePatternsWidget );
    availablePatternsWidget.setKeyboardSelectionPolicy( KeyboardSelectionPolicy.ENABLED );
    availablePatternsWidget.setMinimumWidth( 170 );

    final Label lstEmpty = GWT.create(Label.class);
    lstEmpty.setText( GuidedDecisionTableConstants.INSTANCE.DecisionTableWizardNoAvailablePatterns() );
    lstEmpty.setStyleName( WizardCellListResources.INSTANCE.cellListStyle().cellListEmptyItem() );
    availablePatternsWidget.setEmptyListWidget( lstEmpty );

    final SingleSelectionModel<Pattern52> selectionModel = new SingleSelectionModel<Pattern52>();
    availablePatternsWidget.setSelectionModel( selectionModel );

    selectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() {

        @Override
        public void onSelectionChange( final SelectionChangeEvent event ) {
            availablePatternsSelection = selectionModel.getSelectedObject();
            presenter.selectPattern( availablePatternsSelection );
        }

    } );
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:24,代码来源:ActionSetFieldsPageViewImpl.java

示例11: ManifestView

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
public ManifestView() {
	CellList.Resources cell_res = GWT.create(CellListResources.class);
	
	Panel main = new FlowPanel();
    top = new ScrollPanel(main);
    top.setStylePrimaryName("View");
    
    this.cell_list = new CellList<Reference<Sequence>>(new ReferenceCell<Sequence>(), cell_res);
    this.selection_model = new SingleSelectionModel<Reference<Sequence>>();
    
    cell_list.addStyleName("CellList");
    cell_list.setSelectionModel(selection_model);

    Label panel_title = new Label(Messages.INSTANCE.manifestInstruction());
    panel_title.setStylePrimaryName("PanelTitle");

    this.manifest_label = new Label();
    manifest_label.setStylePrimaryName("PanelHeader");

    main.add(panel_title);
    main.add(manifest_label);
    main.add(cell_list);

    addContent(top);
}
 
开发者ID:jhu-digital-manuscripts,项目名称:rosa,代码行数:26,代码来源:ManifestView.java

示例12: makeTemplateSelector

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
/**
 * Creates the scrollable list of cells each of which serves as a link to a template.
 *
 * @param list an ArrayList of TemplateInfo
 * @return A CellList widget
 */
public CellList<TemplateInfo> makeTemplateSelector(ArrayList<TemplateInfo> list) {
  TemplateCell templateCell = new TemplateCell(list.get(0), templateHostUrl);

  CellList<TemplateInfo> templateCellList = new CellList<TemplateInfo>(templateCell,TemplateInfo.KEY_PROVIDER);
  templateCellList.setPageSize(list.size() + 10);
  templateCellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
  templateCellList.setWidth("250px");
  templateCellList.setHeight("400px");
  templateCellList.setVisible(true);

  // Add a selection model to handle user selection.
  final SingleSelectionModel<TemplateInfo> selectionModel =
    new SingleSelectionModel<TemplateInfo>(TemplateInfo.KEY_PROVIDER);
  templateCellList.setSelectionModel(selectionModel);
  selectionModel.setSelected(list.get(0), true);
  final TemplateUploadWizard wizard = this;
  selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
      public void onSelectionChange(SelectionChangeEvent event) {
        TemplateInfo selected = selectionModel.getSelectedObject();
        if (selected != null) {
          selectedTemplateNAME = selected.name;
          TemplateWidget.setTemplate(selected, wizard.getTemplateUrlHost());
        }
      }
    });

  // Set the total row count. This isn't strictly necessary, but it affects
  // paging calculations, so its good habit to keep the row count up to date.
  templateCellList.setRowCount(list.size(), true);

  // Push the data into the widget.
  templateCellList.setRowData(0, list);
  return templateCellList;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:41,代码来源:TemplateUploadWizard.java

示例13: ExtensionManagerViewImpl

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
@Inject
public ExtensionManagerViewImpl(
    ToolbarPresenter toolbarPresenter, ActionManager actionManager, Resources resources) {
  dataGrid = new DataGrid<>(100, resources);
  rootElement = ourUiBinder.createAndBindUi(this);
  DefaultActionGroup actionGroup =
      new DefaultActionGroup("extensionManager", false, actionManager);
  actionManager.registerAction("extensionManagerGroup", actionGroup);
  toolbarPresenter.bindMainGroup(actionGroup);
  UIObject.ensureDebugId(descriptionArea, "window-preferences-extensions-descriptionArea");

  Column<ExtensionDescription, String> titleColumn =
      new Column<ExtensionDescription, String>(new TextCell()) {
        @Override
        public String getValue(ExtensionDescription object) {
          return object.getTitle();
        }
      };
  titleColumn.setCellStyleNames(style.titleColumn());

  dataGrid.addColumn(titleColumn);
  SingleSelectionModel<ExtensionDescription> selectionModel =
      new SingleSelectionModel<ExtensionDescription>();
  dataGrid.setSelectionModel(selectionModel);
  selectionModel.addSelectionChangeHandler(
      new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {}
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:ExtensionManagerViewImpl.java

示例14: ProjectsAndPackagesModel

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
public ProjectsAndPackagesModel(
    List<JavaProject> projects,
    RefactorInfo refactorInfo,
    SingleSelectionModel<Object> selectionModel,
    JavaResources resources) {
  this.projects = projects;
  this.refactorInfo = refactorInfo;
  this.selectionModel = selectionModel;
  this.resources = resources;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:ProjectsAndPackagesModel.java

示例15: setTreeOfDestinations

import com.google.gwt.view.client.SingleSelectionModel; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void setTreeOfDestinations(RefactorInfo refactorInfo, List<JavaProject> projects) {
  final SingleSelectionModel<Object> selectionModel = new SingleSelectionModel<>();
  selectionModel.addSelectionChangeHandler(
      new SelectionChangeEvent.Handler() {
        @Override
        public void onSelectionChange(SelectionChangeEvent event) {
          Object object = selectionModel.getSelectedObject();

          if (object instanceof JavaProject) {
            JavaProject project = (JavaProject) object;
            delegate.setMoveDestinationPath(project.getPath(), project.getPath());
          }
          if (object instanceof PackageFragmentRoot) {
            PackageFragmentRoot fragmentRoot = (PackageFragmentRoot) object;
            delegate.setMoveDestinationPath(
                fragmentRoot.getPath(), fragmentRoot.getProjectPath());
          }

          if (object instanceof PackageFragment) {
            PackageFragment fragment = (PackageFragment) object;
            delegate.setMoveDestinationPath(fragment.getPath(), fragment.getProjectPath());
          }
        }
      });
  CellTree tree =
      new CellTree(
          new ProjectsAndPackagesModel(projects, refactorInfo, selectionModel, resources),
          null,
          cellTreeResources);
  tree.setAnimationEnabled(true);
  treePanel.clear();
  treePanel.add(tree);
}
 
开发者ID:eclipse,项目名称:che,代码行数:36,代码来源:MoveViewImpl.java


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