本文整理汇总了Java中javax.swing.tree.TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION属性的典型用法代码示例。如果您正苦于以下问题:Java TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION属性的具体用法?Java TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION怎么用?Java TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.tree.TreeSelectionModel
的用法示例。
在下文中一共展示了TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CheckoutWizard
public CheckoutWizard(final Project project) {
super(CvsBundle.message("dialog.tittle.check.out.from.cvs.repository"), project);
mySelectCVSConfigurationStep = new SelectCVSConfigurationStep(project, this);
mySelectCvsElementStep = new SelectCvsElementStep(CvsBundle.message("dialog.title.select.cvs.element.to.check.out"),
this, project, mySelectCVSConfigurationStep, false,
TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION, true, true);
mySelectLocationStep = new MySelectLocationStep(project);
myChooseModeStep = new ChooseCheckoutMode(project, this);
addStep(mySelectCVSConfigurationStep);
addStep(mySelectCvsElementStep);
addStep(mySelectLocationStep);
addStep(myChooseModeStep);
init();
}
示例2: ModuleChooser
public ModuleChooser(Project project,
boolean allowFileSelection,
boolean allowMultipleSelection,
boolean allowRootSelection,
String expertTitle,
String selectModulePageTitle) {
super(expertTitle, project);
mySelectCVSConfigurationStep = new SelectCVSConfigurationStep(project, this);
mySelectCvsElementStep = new SelectCvsElementStep(selectModulePageTitle,
this,
project,
mySelectCVSConfigurationStep, allowRootSelection, allowMultipleSelection ?
TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION :
TreeSelectionModel.SINGLE_TREE_SELECTION, true,
allowFileSelection);
addStep(mySelectCVSConfigurationStep);
addStep(mySelectCvsElementStep);
init();
}
示例3: isSelectionModeBroken
/** Check if selection of the nodes could break the selection mode set in TreeSelectionModel.
* @param nodes the nodes for selection
* @return true if the selection mode is broken */
private boolean isSelectionModeBroken(Node[] nodes) {
// if nodes are empty or single the everthing is ok
// or if discontiguous selection then everthing ok
if ((nodes.length <= 1) || (getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)) {
return false;
}
// if many nodes
// brakes single selection mode
if (getSelectionMode() == TreeSelectionModel.SINGLE_TREE_SELECTION) {
return true;
}
// check the contiguous selection mode
TreePath[] paths = new TreePath[nodes.length];
RowMapper rowMapper = tree.getSelectionModel().getRowMapper();
// if rowMapper is null then tree bahaves as discontiguous selection mode is set
if (rowMapper == null) {
return false;
}
ArrayList<Node> toBeExpaned = new ArrayList<Node>(3);
for (int i = 0; i < nodes.length; i++) {
toBeExpaned.clear();
Node n = nodes[i];
while (n.getParentNode() != null) {
if (!isExpanded(n)) {
toBeExpaned.add(n);
}
n = n.getParentNode();
}
for (int j = toBeExpaned.size() - 1; j >= 0; j--) {
expandNode(toBeExpaned.get(j));
}
paths[i] = getTreePath(nodes[i]);
}
int[] rows = rowMapper.getRowsForPaths(paths);
// check selection's rows
Arrays.sort(rows);
for (int i = 1; i < rows.length; i++) {
if (rows[i] != (rows[i - 1] + 1)) {
return true;
}
}
// all is ok
return false;
}
示例4: setSingleSelectionOnly
@Override
public void setSingleSelectionOnly(boolean b)
{
int mode = b ? TreeSelectionModel.SINGLE_TREE_SELECTION : TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION;
tree.getSelectionModel().setSelectionMode(mode);
}
示例5: setMultiSelect
@Override
public void setMultiSelect(boolean multiselect) {
int mode = multiselect ?
TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION : TreeSelectionModel.SINGLE_TREE_SELECTION;
impl.getSelectionModel().setSelectionMode(mode);
}
示例6: getSelectionMode
@Override
protected int getSelectionMode() {
return TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION;
}