本文整理汇总了Java中javafx.scene.control.SelectionMode.SINGLE属性的典型用法代码示例。如果您正苦于以下问题:Java SelectionMode.SINGLE属性的具体用法?Java SelectionMode.SINGLE怎么用?Java SelectionMode.SINGLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.scene.control.SelectionMode
的用法示例。
在下文中一共展示了SelectionMode.SINGLE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assignPgpKeyToOtherUserButtonClicked
@FXML
private void assignPgpKeyToOtherUserButtonClicked(final ActionEvent event) {
final SelectUserDialog dialog = new SelectUserDialog(getScene().getWindow(),
new ArrayList<>(getUserRegistry().getUsers()), null, SelectionMode.SINGLE,
"Please select the user to whom you want to 'push' the selected PGP key(s).");
dialog.showAndWait();
final List<User> selectedUsers = dialog.getSelectedUsers();
if (selectedUsers == null || selectedUsers.isEmpty())
return;
final User targetUser = selectedUsers.get(0);
final Set<PgpKey> selectedPgpKeys = getSelectedPgpKeys();
for (final PgpKey pgpKey : selectedPgpKeys) {
user.getPgpKeyIds().remove(pgpKey.getPgpKeyId());
targetUser.getPgpKeyIds().add(pgpKey.getPgpKeyId());
}
}
示例2: select
@Override
public void select(T obj) {
if (obj == null && getSelectionMode() == SelectionMode.SINGLE) {
clearSelection();
return;
}
// We have no option but to iterate through the model and select the
// first occurrence of the given object. Once we find the first one, we
// don't proceed to select any others.
Object rowObj = null;
for (int i = 0, max = getItemCount(); i < max; i++) {
rowObj = getModelItem(i);
if (rowObj == null) {
continue;
}
if (rowObj.equals(obj)) {
if (isSelected(i)) {
return;
}
if (getSelectionMode() == SINGLE) {
quietClearSelection();
}
select(i);
return;
}
}
// if we are here, we did not find the item in the entire data model.
// Even still, we allow for this item to be set to the give object.
// We expect that in concrete subclasses of this class we observe the
// data model such that we check to see if the given item exists in it,
// whilst SelectedIndex == -1 && SelectedItem != null.
setSelectedIndex(-1);
setSelectedItem(obj);
}
示例3: addSelectedItem
private void addSelectedItem(T item) {
if (getItems().contains(item) && !selectedItems.contains(item)) {
if (getSelectionMode() == SelectionMode.SINGLE) {
selectedItems.clear();
}
selectedItems.add(item);
if (getSelectedItem() == null || getSelectionMode() == SelectionMode.SINGLE) {
setSelectedItem(item);
}
}
}
示例4: createContent
@Override
protected Parent createContent() {
selectUserPane = new SelectUserPane(
getUsersWithUnlockedPgpKeys(), createRepoData.getOwners(), SelectionMode.SINGLE,
Messages.getString("SelectOwnerWizardPage.selectUserPane.headerText")) { //$NON-NLS-1$
@Override
protected void updateComplete() {
SelectOwnerWizardPage.this.setComplete(! createRepoData.getOwners().isEmpty());
}
};
return selectUserPane;
}
示例5: SelectUserPane
public SelectUserPane() {
this(Collections.emptyList(), Collections.emptyList(), SelectionMode.SINGLE, "Bla bla header");
}