Browse Source

Merge pull request #52 in BA/design from ~XIAXIANG/design:dev to dev

* commit 'b4fa651d4ca172d737028f1a4e19284c271db58a':
  文件目录树的快速选择
master
richie 9 years ago
parent
commit
e5fa3215fc
  1. 40
      designer_base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java

40
designer_base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -1,15 +1,15 @@
package com.fr.design.gui.itree.filetree;
import java.util.ArrayList;
import java.util.List;
import javax.swing.tree.TreePath;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.file.filetree.FileNode;
import com.fr.stable.ArrayUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.text.Position;
import javax.swing.tree.TreePath;
import java.util.ArrayList;
import java.util.List;
/*
* 显示Env下的reportlets目录下面的所有cpt文件
*/
@ -66,4 +66,34 @@ public class TemplateFileTree extends EnvFileTree {
return selectedPathList.toArray(new String[0]);
}
public TreePath getNextMatch(String prefix, int startingRow,
Position.Bias bias) {
int max = getRowCount();
if (prefix == null) {
throw new IllegalArgumentException();
}
if (startingRow < 0 || startingRow >= max) {
throw new IllegalArgumentException();
}
prefix = prefix.toUpperCase();
// start search from the next/previous element froom the
// selected element
int increment = (bias == Position.Bias.Forward) ? 1 : -1;
int row = startingRow;
do {
TreePath path = getPathForRow(row);
String text = convertValueToText(
path.getLastPathComponent(), isRowSelected(row),
isExpanded(row), true, row, false);
if (text.toUpperCase().startsWith(prefix)) {
return path;
}
row = (row + increment + max) % max;
} while (row != startingRow);
return null;
}
}
Loading…
Cancel
Save