Exemplo n.º 1
0
  /**
   * 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
      }
    }
  }
Exemplo n.º 2
0
  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
  }
Exemplo n.º 3
0
 private void close() {
   selectedAccount = null;
   model.setRoot(null);
 }
Exemplo n.º 4
0
 @Override
 public void setHiddenVisible(boolean visible) {
   p.putBoolean(HIDDEN_VISIBLE, visible);
   model.setHiddenVisible(visible);
   expand();
 }
Exemplo n.º 5
0
 @Override
 public boolean isHiddenVisible() {
   return model.getHiddenVisible();
 }
Exemplo n.º 6
0
 @Override
 public void setExpenseVisible(boolean visible) {
   p.putBoolean(EXPENSE_VISIBLE, visible);
   model.setExpenseVisible(visible);
   expand();
 }
Exemplo n.º 7
0
 @Override
 public boolean isExpenseVisible() {
   return model.getExpenseVisible();
 }
Exemplo n.º 8
0
 @Override
 public void setIncomeVisible(boolean visible) {
   p.putBoolean(INCOME_VISIBLE, visible);
   model.setIncomeVisible(visible);
   expand();
 }
Exemplo n.º 9
0
 @Override
 public boolean isIncomeVisible() {
   return model.getIncomeVisible();
 }
Exemplo n.º 10
0
 @Override
 public void setAccountVisible(boolean visible) {
   p.putBoolean(ACCOUNT_VISIBLE, visible);
   model.setAccountVisible(visible);
   expand();
 }
Exemplo n.º 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();
 }