* true if this item was just expanded from a mouse click or keypress.
*/
@Override
- public void onExpand() {
+ public final void onExpand() {
// System.err.printf("onExpand() %s\n", file);
if (file == null) {
assert (file.isDirectory());
setExpandable(true);
- if ((isExpanded() == false) || (isExpandable() == false)) {
+ if (!isExpanded() || !isExpandable()) {
getTreeView().reflow();
return;
}
* @throws IllegalArgumentException if this function is called
*/
@Override
- public final TTreeItem addChild(final String text, final boolean expanded) {
+ public final TTreeItem addChild(final String text,
+ final boolean expanded) throws IllegalArgumentException {
+
throw new IllegalArgumentException("Do not call addChild(), use onExpand() instead");
}
*
* @param view root TTreeView
* @param text text for this item
+ * @throws IOException if a java.io operation throws
*/
public TDirectoryTreeItem(final TTreeView view,
final String text) throws IOException {
* @param view root TTreeView
* @param text text for this item
* @param expanded if true, have it expanded immediately
+ * @throws IOException if a java.io operation throws
*/
public TDirectoryTreeItem(final TTreeView view, final String text,
final boolean expanded) throws IOException {
* @param expanded if true, have it expanded immediately
* @param openParents if true, expand all paths up the root path and
* return the root path entry
+ * @throws IOException if a java.io operation throws
*/
public TDirectoryTreeItem(final TTreeView view, final String text,
final boolean expanded, final boolean openParents) throws IOException {
File rootFile = new File(text);
rootFile = rootFile.getCanonicalFile();
- if (openParents == true) {
+ if (openParents) {
setExpanded(true);
// Go up the directory tree
} else {
// This is a relative path. We got here because openParents was
// false.
- assert (openParents == false);
+ assert (!openParents);
setText(rootFile.getName());
}
onExpand();
- if (openParents == true) {
+ if (openParents) {
TDirectoryTreeItem childFile = this;
Collections.reverse(parentFiles);
for (String p: parentFiles) {