/**
   * Selects the specified account
   *
   * @param account account to select
   */
  public void setSelectedAccount(final Account account) {
    if (account != null) {
      TreeNode node = model.findAccountNode(account);

      if (node != null) {
        TreePath path = new TreePath(model.getPathToRoot(node));

        tree.setSelectionPath(path); // select the path
        tree.scrollPathToVisible(path); // ensure selected path is visible
      }
    }
  }
  private void buildUI() {
    setMinimumSize(new Dimension(100, 100));

    setViewportView(createModelAndView());

    // visibility must be set after createModelAndView has been called
    model.setAccountVisible(p.getBoolean(ACCOUNT_VISIBLE, true));
    model.setExpenseVisible(p.getBoolean(EXPENSE_VISIBLE, true));
    model.setHiddenVisible(p.getBoolean(HIDDEN_VISIBLE, true));
    model.setIncomeVisible(p.getBoolean(INCOME_VISIBLE, true));

    refresh(); // load the tree up with data
    _expand(); // expand the tree
  }
 private void close() {
   selectedAccount = null;
   model.setRoot(null);
 }
 @Override
 public void setHiddenVisible(boolean visible) {
   p.putBoolean(HIDDEN_VISIBLE, visible);
   model.setHiddenVisible(visible);
   expand();
 }
 @Override
 public boolean isHiddenVisible() {
   return model.getHiddenVisible();
 }
 @Override
 public void setExpenseVisible(boolean visible) {
   p.putBoolean(EXPENSE_VISIBLE, visible);
   model.setExpenseVisible(visible);
   expand();
 }
 @Override
 public boolean isExpenseVisible() {
   return model.getExpenseVisible();
 }
 @Override
 public void setIncomeVisible(boolean visible) {
   p.putBoolean(INCOME_VISIBLE, visible);
   model.setIncomeVisible(visible);
   expand();
 }
 @Override
 public boolean isIncomeVisible() {
   return model.getIncomeVisible();
 }
Beispiel #10
0
 @Override
 public void setAccountVisible(boolean visible) {
   p.putBoolean(ACCOUNT_VISIBLE, visible);
   model.setAccountVisible(visible);
   expand();
 }
Beispiel #11
0
 /* The preference is saved immediately because this UI component may only
  * be a weak listener and could be ready to be removed at any time.
  */
 @Override
 public boolean isAccountVisible() {
   return model.getAccountVisible();
 }