Search in sources :

Example 6 with InvestmentPlan

use of name.abuchen.portfolio.model.InvestmentPlan in project portfolio by buchen.

the class InvestmentPlanModel method applyChanges.

@Override
public void applyChanges() {
    if (security == null)
        throw new UnsupportedOperationException(Messages.MsgMissingSecurity);
    if (portfolio == null)
        throw new UnsupportedOperationException(Messages.MsgMissingPortfolio);
    if (account == null)
        throw new UnsupportedOperationException(Messages.MsgMissingAccount);
    InvestmentPlan plan = source;
    if (plan == null) {
        plan = new InvestmentPlan();
        this.client.addPlan(plan);
    }
    plan.setName(name);
    plan.setSecurity(security);
    plan.setPortfolio(portfolio);
    plan.setAccount(account.equals(DELIVERY) ? null : account);
    plan.setAutoGenerate(autoGenerate);
    plan.setStart(start);
    plan.setInterval(interval);
    plan.setAmount(amount);
    plan.setFees(fees);
}
Also used : InvestmentPlan(name.abuchen.portfolio.model.InvestmentPlan)

Aggregations

InvestmentPlan (name.abuchen.portfolio.model.InvestmentPlan)6 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Account (name.abuchen.portfolio.model.Account)2 PortfolioTransaction (name.abuchen.portfolio.model.PortfolioTransaction)2 Security (name.abuchen.portfolio.model.Security)2 CurrencyConverterImpl (name.abuchen.portfolio.money.CurrencyConverterImpl)2 BooleanEditingSupport (name.abuchen.portfolio.ui.util.viewers.BooleanEditingSupport)2 Column (name.abuchen.portfolio.ui.util.viewers.Column)2 DateEditingSupport (name.abuchen.portfolio.ui.util.viewers.DateEditingSupport)2 ListEditingSupport (name.abuchen.portfolio.ui.util.viewers.ListEditingSupport)2 ValueEditingSupport (name.abuchen.portfolio.ui.util.viewers.ValueEditingSupport)2 NameColumn (name.abuchen.portfolio.ui.views.columns.NameColumn)2 NoteColumn (name.abuchen.portfolio.ui.views.columns.NoteColumn)2 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)2 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 Image (org.eclipse.swt.graphics.Image)2 Composite (org.eclipse.swt.widgets.Composite)2 MessageFormat (java.text.MessageFormat)1