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


Java SelectionMode.SINGLE属性代码示例

本文整理汇总了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());
	}
}
 
开发者ID:subshare,项目名称:subshare,代码行数:17,代码来源:UserPane.java

示例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);
}
 
开发者ID:ChiralBehaviors,项目名称:Kramer,代码行数:39,代码来源:MultipleCellSelection.java

示例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);
        }
    }
}
 
开发者ID:ClemensFischer,项目名称:FX-Map-Control,代码行数:11,代码来源:MapItemsControl.java

示例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;
}
 
开发者ID:subshare,项目名称:subshare,代码行数:12,代码来源:SelectOwnerWizardPage.java

示例5: SelectUserPane

public SelectUserPane() {
	this(Collections.emptyList(), Collections.emptyList(), SelectionMode.SINGLE, "Bla bla header");
}
 
开发者ID:subshare,项目名称:subshare,代码行数:3,代码来源:SelectUserPane.java


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