Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.Account


        }

        @Override
        public void execute()
        {
            Account from = null;
            Account to = null;

            if (transaction.getType() == AccountTransaction.Type.TRANSFER_IN)
            {
                from = crossAccount;
                to = account;
View Full Code Here


        Action action = new Action()
        {
            @Override
            public void run()
            {
                Account account = new Account();
                account.setName(Messages.LabelNoName);

                getClient().addAccount(account);
                markDirty();

                resetInput();
View Full Code Here

    @Override
    public void notifyModelUpdated()
    {
        resetInput();

        Account account = (Account) ((IStructuredSelection) accounts.getSelection()).getFirstElement();
        if (getClient().getAccounts().contains(account))
            accounts.setSelection(new StructuredSelection(account));
        else
            accounts.setSelection(StructuredSelection.EMPTY);
    }
View Full Code Here

        accounts.addSelectionChangedListener(new ISelectionChangedListener()
        {
            public void selectionChanged(SelectionChangedEvent event)
            {
                Account account = (Account) ((IStructuredSelection) event.getSelection()).getFirstElement();
                transactions.setData(Account.class.toString(), account);
                transactions.setInput(account != null ? account.getTransactions()
                                : new ArrayList<AccountTransaction>(0));
                transactions.refresh();
            }
        });
View Full Code Here

        });
    }

    private void fillAccountsContextMenu(IMenuManager manager)
    {
        final Account account = (Account) ((IStructuredSelection) accounts.getSelection()).getFirstElement();
        if (account == null)
            return;

        accountMenu.menuAboutToShow(manager, account);
        manager.add(new Separator());

        manager.add(new Action(account.isRetired() ? Messages.AccountMenuActivate : Messages.AccountMenuDeactivate)
        {
            @Override
            public void run()
            {
                account.setRetired(!account.isRetired());
                markDirty();
                resetInput();
            }

        });
View Full Code Here

            return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
    }

    private void fillTransactionsContextMenu(IMenuManager manager)
    {
        Account account = (Account) transactions.getData(Account.class.toString());
        if (account == null)
            return;

        accountMenu.menuAboutToShow(manager, account);

        boolean hasTransactionSelected = ((IStructuredSelection) transactions.getSelection()).getFirstElement() != null;
        if (hasTransactionSelected)
        {
            manager.add(new Separator());
            manager.add(new Action(Messages.AccountMenuDeleteTransaction)
            {
                @Override
                public void run()
                {
                    AccountTransaction transaction = (AccountTransaction) ((IStructuredSelection) transactions
                                    .getSelection()).getFirstElement();
                    Account account = (Account) transactions.getData(Account.class.toString());

                    if (transaction == null || account == null)
                        return;

                    if (transaction.getCrossEntry() != null)
                    {
                        transaction.getCrossEntry().delete();

                        // possibly remove from investment plan
                        Transaction t = transaction.getCrossEntry().getCrossTransaction(transaction);
                        if (t instanceof PortfolioTransaction)
                        {
                            for (InvestmentPlan plan : getClient().getPlans())
                                plan.removeTransaction((PortfolioTransaction) t);
                        }
                    }
                    else
                    {
                        account.getTransactions().remove(transaction);
                    }
                    markDirty();

                    accounts.refresh();
                    transactions.setInput(account.getTransactions());
                }
            });
        }
    }
View Full Code Here

        }

        @Override
        public void execute()
        {
            Account account = new Account();
            account.setName(nameProposal);
            client.addAccount(account);
            portfolio.setReferenceAccount(account);
        }
View Full Code Here

                        throws ParseException
        {
            if (!(target instanceof Account))
                throw new IllegalArgumentException();

            Account account = (Account) target;

            Date date = convertDate(Messages.CSVColumn_Date, rawValues, field2column);
            if (date == null)
                throw new ParseException(MessageFormat.format(Messages.CSVImportMissingField, Messages.CSVColumn_Date),
                                0);

            Long amount = convertAmount(Messages.CSVColumn_Value, rawValues, field2column);
            if (amount == null)
                throw new ParseException(
                                MessageFormat.format(Messages.CSVImportMissingField, Messages.CSVColumn_Value), 0);

            AccountTransaction.Type type = convertEnum(Messages.CSVColumn_Type, AccountTransaction.Type.class,
                            rawValues, field2column);

            AccountTransaction transaction = new AccountTransaction();
            transaction.setDate(date);
            transaction.setAmount(Math.abs(amount));

            String isin = getTextValue(Messages.CSVColumn_ISIN, rawValues, field2column);
            String tickerSymbol = getTextValue(Messages.CSVColumn_TickerSymbol, rawValues, field2column);
            String wkn = getTextValue(Messages.CSVColumn_WKN, rawValues, field2column);

            if (isin != null || tickerSymbol != null || wkn != null)
            {
                Security security = lookupSecurity(client, isin, tickerSymbol, wkn, true);
                transaction.setSecurity(security);
            }

            if (type != null)
                transaction.setType(type);
            else if (transaction.getSecurity() != null)
                transaction.setType(amount < 0 ? AccountTransaction.Type.FEES : AccountTransaction.Type.DIVIDENDS);
            else
                transaction.setType(amount < 0 ? AccountTransaction.Type.REMOVAL : AccountTransaction.Type.DEPOSIT);

            account.addTransaction(transaction);
        }
View Full Code Here

        item.configure(series);
    }

    private void addAccount(DataSeries item, List<Exception> warnings)
    {
        Account account = (Account) item.getInstance();
        PerformanceIndex accountIndex = (PerformanceIndex) dataCache.get(account);
        if (accountIndex == null)
        {
            accountIndex = PerformanceIndex.forAccount(getClient(), account, getReportingPeriod(), warnings);
            dataCache.put(account, accountIndex);
        }

        ILineSeries series = chart.addDateSeries(accountIndex.getDates(), //
                        toDouble(accountIndex.getTotals(), Values.Amount.divider()), //
                        account.getName());
        item.configure(series);
    }
View Full Code Here

TOP

Related Classes of name.abuchen.portfolio.model.Account

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.