[eclipsefinance-subversion] SF.net SVN: eclipsefinance: [36] trunk/net.sf.eclipsefinance.core
Status: Pre-Alpha
Brought to you by:
yukio7
|
From: <yu...@us...> - 2006-10-09 14:36:27
|
Revision: 36
http://svn.sourceforge.net/eclipsefinance/?rev=36&view=rev
Author: yukio7
Date: 2006-10-09 07:35:49 -0700 (Mon, 09 Oct 2006)
Log Message:
-----------
transaction and account views viewable
Modified Paths:
--------------
trunk/net.sf.eclipsefinance.core/plugin.xml
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ObservableList.java
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/Account.java
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/AccountGroup.java
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/Bank.java
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/AccountSelection.java
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/CoreFinanceAdapterFactory.java
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/actions/NewBankAction.java
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/views/AccountsView.java
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/views/TransactionsView.java
Added Paths:
-----------
trunk/net.sf.eclipsefinance.core/icons/etool16/
trunk/net.sf.eclipsefinance.core/icons/etool16/book_add.png
trunk/net.sf.eclipsefinance.core/icons/etool16/coins_add.png
trunk/net.sf.eclipsefinance.core/icons/eview16/
trunk/net.sf.eclipsefinance.core/icons/eview16/book.png
trunk/net.sf.eclipsefinance.core/icons/eview16/coins.png
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/AccountGroupSelection.java
trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/actions/NewAccountGroupAction.java
Added: trunk/net.sf.eclipsefinance.core/icons/etool16/book_add.png
===================================================================
(Binary files differ)
Property changes on: trunk/net.sf.eclipsefinance.core/icons/etool16/book_add.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/net.sf.eclipsefinance.core/icons/etool16/coins_add.png
===================================================================
(Binary files differ)
Property changes on: trunk/net.sf.eclipsefinance.core/icons/etool16/coins_add.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/net.sf.eclipsefinance.core/icons/eview16/book.png
===================================================================
(Binary files differ)
Property changes on: trunk/net.sf.eclipsefinance.core/icons/eview16/book.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/net.sf.eclipsefinance.core/icons/eview16/coins.png
===================================================================
(Binary files differ)
Property changes on: trunk/net.sf.eclipsefinance.core/icons/eview16/coins.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/net.sf.eclipsefinance.core/plugin.xml
===================================================================
--- trunk/net.sf.eclipsefinance.core/plugin.xml 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/plugin.xml 2006-10-09 14:35:49 UTC (rev 36)
@@ -2,12 +2,24 @@
<?eclipse version="3.2"?>
<plugin>
<extension
- point="org.eclipse.ui.perspectives">
- <perspective
- name="Core"
- class="net.sf.eclipsefinance.core.ui.perspectives.CorePerspective"
- id="net.sf.eclipsefinance.core.perspectives.CorePerspective">
- </perspective>
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension targetID="net.sf.eclipsefinance.core.perspectives.CorePerspective">
+ <view
+ closeable="true"
+ id="net.sf.eclipsefinance.core.ui.views.Accountsiew"
+ moveable="true"
+ relationship="stack"
+ relative="left"
+ visible="true"/>
+ <view
+ closeable="true"
+ id="net.sf.eclipsefinance.core.ui.views.TransactionsView"
+ moveable="true"
+ ratio="0.7"
+ relationship="stack"
+ relative="center"
+ visible="true"/>
+ </perspectiveExtension>
</extension>
<extension
point="org.eclipse.ui.views">
@@ -19,15 +31,16 @@
allowMultiple="false"
category="net.sf.eclipsefinance.core"
class="net.sf.eclipsefinance.core.ui.views.AccountsView"
- icon="icons/sample.gif"
+ icon="icons/eview16/coins.png"
id="net.sf.eclipsefinance.core.ui.views.Accountsiew"
name="%view.name.accounts">
</view>
- <view
- category="net.sf.eclipsefinance.core"
- class="net.sf.eclipsefinance.core.ui.views.TransactionsView"
- icon="icons/sample.gif"
- id="net.sf.eclipsefinance.core.ui.views.TransactionsView"
+ <view
+ allowMultiple="true"
+ category="net.sf.eclipsefinance.core"
+ class="net.sf.eclipsefinance.core.ui.views.TransactionsView"
+ icon="icons/eview16/book.png"
+ id="net.sf.eclipsefinance.core.ui.views.TransactionsView"
name="%view.name.transactions"/>
</extension>
<extension
@@ -51,12 +64,33 @@
label="%actionSet.label.core"
visible="true">
<action
+ icon="icons/etool16/book_add.png"
id="net.sf.eclipsefinance.core.ui.action.newTransaction"
label="%action.label.newTransaction"
menubarPath="file/newWizards/newTransaction"
style="push"
toolbarPath="core"/>
+ <action
+ icon="icons/etool16/coins_add.png"
+ id="net.sf.eclipsefinance.core.ui.action.newAccount"
+ label="New Account"
+ menubarPath="file/newWizards/newAccount"
+ style="push"
+ toolbarPath="core"/>
</actionSet>
</extension>
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ class="net.sf.eclipsefinance.core.ui.perspectives.CorePerspective"
+ id="net.sf.eclipsefinance.core.perspectives.CorePerspective"
+ name="CorePerspective"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.activities">
+ <activityPatternBinding
+ activityId="net.sf.eclipsefinance.core/net.sf.eclipsefinance.views.transactions"
+ pattern="net.sf.eclipsefinance.core/net.sf.eclipsetrader.views.transactions"/>
+ </extension>
</plugin>
Modified: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ObservableList.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ObservableList.java 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ObservableList.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -15,20 +15,18 @@
import java.util.Collection;
import java.util.List;
-
-/**
- */
public class ObservableList extends ArrayList
{
private static final long serialVersionUID = 7282371672763711235L;
private List originalList;
- private List observers = new ArrayList();
+ private List<ICollectionObserver> observers = new ArrayList<ICollectionObserver>();
public ObservableList()
{
}
- public ObservableList(List list)
+ @SuppressWarnings("unchecked")
+ public ObservableList(List list)
{
super(list);
this.originalList = list;
@@ -72,7 +70,8 @@
/* (non-Javadoc)
* @see java.util.ArrayList#add(java.lang.Object)
*/
- public boolean add(Object o)
+ @SuppressWarnings("unchecked")
+ public boolean add(Object o)
{
boolean result = super.add(o);
if (originalList != null)
@@ -84,7 +83,8 @@
/* (non-Javadoc)
* @see java.util.ArrayList#add(int, java.lang.Object)
*/
- public void add(int index, Object element)
+ @SuppressWarnings("unchecked")
+ public void add(int index, Object element)
{
super.add(index, element);
if (originalList != null)
Modified: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/Account.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/Account.java 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/Account.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -14,7 +14,8 @@
private Currency currency = null;
private String IBAN = null;
private BigDecimal balance = new BigDecimal("0.0");
- private Bank bank = null;
+// private Bank bank = null;
+ private AccountGroup group = null;
List transactionList = new ArrayList();
Account(String name){
@@ -54,12 +55,20 @@
this.balance = balance;
}
- public Bank getBank() {
- return this.bank;
+// public Bank getBank() {
+// return this.bank;
+// }
+//
+// public void setBank(Bank bank) {
+// this.bank = bank;
+// }
+
+ public AccountGroup getGroup() {
+ return this.group;
}
- public void setBank(Bank bank) {
- this.bank = bank;
+ public void setGroup(AccountGroup group) {
+ this.group = group;
}
public List getTransactionList() {
Modified: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/AccountGroup.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/AccountGroup.java 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/AccountGroup.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004-2006 Marco Maccaferri and others.
+ * Copyright (c) 2006 Eclipse Finance.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,12 +7,11 @@
*
* Contributors:
* Marco Maccaferri - initial API and implementation
+ * Francois Cottet - adaptation for Eclipse Finance
*/
package net.sf.eclipsefinance.core.model;
-import java.util.Iterator;
-
import net.sf.eclipsefinance.core.ObservableList;
import net.sf.eclipsefinance.core.persistence.PersistentObject;
Modified: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/Bank.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/Bank.java 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/model/Bank.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -45,12 +45,14 @@
public void addAccount(Account newAccount){
this.accountList.add(newAccount);
- newAccount.setBank(this);
+// newAccount.setBank(this);
+ newAccount.setGroup(this);
}
public void removeAccount(Account oldAccount){
this.accountList.remove(oldAccount);
- oldAccount.setBank(null);
+// oldAccount.setBank(null);
+ oldAccount.setGroup(null);
}
public Integer getId() {
Added: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/AccountGroupSelection.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/AccountGroupSelection.java (rev 0)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/AccountGroupSelection.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2004-2006 Marco Maccaferri and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marco Maccaferri - initial API and implementation
+ */
+
+package net.sf.eclipsefinance.core.ui;
+
+import net.sf.eclipsefinance.core.model.AccountGroup;
+
+import org.eclipse.jface.viewers.ISelection;
+
+public class AccountGroupSelection implements ISelection
+{
+ private AccountGroup group;
+
+ public AccountGroupSelection(AccountGroup group)
+ {
+ this.group = group;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelection#isEmpty()
+ */
+ public boolean isEmpty()
+ {
+ return (group == null);
+ }
+
+ public AccountGroup getGroup()
+ {
+ return group;
+ }
+}
Modified: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/AccountSelection.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/AccountSelection.java 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/AccountSelection.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -13,13 +13,13 @@
import net.sf.eclipsefinance.core.model.Account;
-public class AccountSelection extends BankSelection
+public class AccountSelection extends AccountGroupSelection
{
private Account account;
public AccountSelection(Account account)
{
- super(account.getBank());
+ super(account.getGroup());
this.account = account;
}
Modified: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/CoreFinanceAdapterFactory.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/CoreFinanceAdapterFactory.java 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/CoreFinanceAdapterFactory.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -81,7 +81,7 @@
private IWorkbenchAdapter accountAdapter = new IWorkbenchAdapter(){
public Object getParent(Object o){
- return ((Account)o).getBank();
+ return ((Account)o).getGroup();
}
public String getLabel(Object o){
Added: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/actions/NewAccountGroupAction.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/actions/NewAccountGroupAction.java (rev 0)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/actions/NewAccountGroupAction.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2006 Eclipse Finance.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marco Maccaferri - initial API and implementation
+ * Francois Cottet - adaptation for Eclipse Finance
+ */
+
+
+package net.sf.eclipsefinance.core.ui.actions;
+
+import net.sf.eclipsefinance.core.model.AccountGroup;
+import net.sf.eclipsefinance.core.ui.AccountGroupSelection;
+import net.sf.eclipsefinance.core.ui.AccountSelection;
+import net.sf.eclipsefinance.core.ui.views.AccountsView;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.ISelection;
+
+public class NewAccountGroupAction extends Action
+{
+ private AccountsView view;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+ */
+ public NewAccountGroupAction(AccountsView view)
+ {
+ this.view = view;
+ setText("Create Group");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ InputDialog dlg = new InputDialog(view.getViewSite().getShell(), getText(), "Enter the name of the group to create:", null, null);
+ if (dlg.open() == InputDialog.OK && dlg.getValue() != null)
+ {
+ AccountGroup group = new AccountGroup();
+ group.setDescription(dlg.getValue());
+
+ ISelection selection = view.getSite().getSelectionProvider().getSelection();
+ if (selection instanceof AccountSelection)
+ group.setParent(((AccountSelection)selection).getAccount().getGroup());
+ else if (selection instanceof AccountGroupSelection)
+ group.setParent(((AccountGroupSelection)selection).getGroup());
+
+// CorePlugin.getRepository().save(group);
+ }
+ }
+}
Modified: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/actions/NewBankAction.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/actions/NewBankAction.java 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/actions/NewBankAction.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -19,7 +19,6 @@
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.viewers.ISelection;
public class NewBankAction extends Action
{
Modified: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/views/AccountsView.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/views/AccountsView.java 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/views/AccountsView.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -349,7 +349,7 @@
for (Iterator iter = list.iterator(); iter.hasNext(); )
{
Account account = (Account)iter.next();
- if (account.getBank() == null)
+ if (account.getGroup() == null)
new AccountTreeItem(account, tree, SWT.NONE);
}
@@ -439,7 +439,7 @@
if (o instanceof Account)
{
Account account = (Account)o;
- if (account.getBank() != null)
+ if (account.getGroup() != null)
return;
TreeItem items[] = tree.getItems();
Modified: trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/views/TransactionsView.java
===================================================================
--- trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/views/TransactionsView.java 2006-09-22 12:52:57 UTC (rev 35)
+++ trunk/net.sf.eclipsefinance.core/src/net/sf/eclipsefinance/core/ui/views/TransactionsView.java 2006-10-09 14:35:49 UTC (rev 36)
@@ -168,7 +168,9 @@
table.setMenu(menuMgr.createContextMenu(table));
getSite().registerContextMenu(menuMgr, getSite().getSelectionProvider());
- account = (Account)Fortune.getInstance().getAccount(new Integer(Integer.parseInt(getViewSite().getSecondaryId())));
+ String id = getViewSite().getSecondaryId();
+ if(id!=null)
+ account = (Account)Fortune.getInstance().getAccount(new Integer(Integer.parseInt(id)));
if (account != null)
{
setTitleToolTip(account.getName());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|