Skip to content

Commit

Permalink
[PT-138] remove realized pnl label in Current Position view
Browse files Browse the repository at this point in the history
  • Loading branch information
yujunfeng committed Nov 9, 2015
1 parent 9f6dd63 commit c50dc88
Show file tree
Hide file tree
Showing 10 changed files with 320 additions and 23 deletions.
3 changes: 2 additions & 1 deletion CSTW/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Bundle-Activator: com.cyanspring.cstw.gui.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
CSTWjars;bundle-version="1.0.0",
org.eclipse.ui.intro
org.eclipse.ui.intro,
org.eclipse.ui.forms;bundle-version="3.6.100"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
31 changes: 31 additions & 0 deletions CSTW/src/com/cyanspring/cstw/model/admin/ExchangeAccountModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.cyanspring.cstw.model.admin;

/**
*
* @author NingXiaoFeng
* @create date 2015/06/11
*
*/
public final class ExchangeAccountModel {

private String id;

private String name;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

}
41 changes: 41 additions & 0 deletions CSTW/src/com/cyanspring/cstw/model/admin/StockPoolModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.cyanspring.cstw.model.admin;

/**
*
* @author NingXiaoFeng
* @create date 2015/05/20
*
*/
public final class StockPoolModel {

private String id;

private String name;

private SubAccountModel relativeAccount;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public SubAccountModel getRelativeAccount() {
return relativeAccount;
}

public void setRelativeAccount(SubAccountModel relativeAccount) {
this.relativeAccount = relativeAccount;
}

}
63 changes: 63 additions & 0 deletions CSTW/src/com/cyanspring/cstw/model/admin/SubAccountModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.cyanspring.cstw.model.admin;


/**
*
* @author NingXiaoFeng
* @create date 2015/05/19
*
*/
public final class SubAccountModel {

private String id;

private String name;

private ExchangeAccountModel exchangeAccountModel;

private double useableMoney;

private double commissionRate;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public ExchangeAccountModel getExchangeAccountModel() {
return exchangeAccountModel;
}

public void setExchangeAccountModel(
ExchangeAccountModel exchangeAccountModel) {
this.exchangeAccountModel = exchangeAccountModel;
}

public double getUseableMoney() {
return useableMoney;
}

public void setUseableMoney(double useableMoney) {
this.useableMoney = useableMoney;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public double getCommissionRate() {
return commissionRate;
}

public void setCommissionRate(double commissionRate) {
this.commissionRate = commissionRate;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class BRWPositionComposite extends BasicComposite {

private Label lblAllMarketCapitalization; // 总市值
private Label lblUnrealizedPL; // 浮盈
private Label lblRealizedPNL; // 实现盈利
private Label lblAllPNL; // 总盈利

public BRWPositionComposite(Composite parent, int style) {
Expand Down Expand Up @@ -64,14 +63,6 @@ private void initComponent() {
lblUnrealizedPL = new Label(composite, SWT.NONE);
lblUnrealizedPL.setLayoutData(gd2);

Label lbl3 = new Label(composite, SWT.NONE);
lbl3.setAlignment(SWT.RIGHT);
lbl3.setLayoutData(gd1);
lbl3.setText("Realized PnL: ");

lblRealizedPNL = new Label(composite, SWT.NONE);
lblRealizedPNL.setLayoutData(gd2);

Label lbl4= new Label(composite, SWT.NONE);
lbl4.setAlignment(SWT.RIGHT);
lbl4.setLayoutData(gd1);
Expand All @@ -97,7 +88,6 @@ protected void processByType(RefreshEventType type) {
tableComposite.setInput(service.getOpenPositionModelList());
lblAllMarketCapitalization.setText(service.getAllMarketCapitalization());
lblUnrealizedPL.setText(service.getUnrealizedPNL());
lblRealizedPNL.setText(service.getPNL());
lblAllPNL.setText(service.getAllPNL());
}
}
Expand Down
30 changes: 30 additions & 0 deletions CSTW/src/com/cyanspring/cstw/ui/forms/EditTreeContentProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.cyanspring.cstw.ui.forms;

import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.Viewer;

/**
* @author Junfeng
* @create 9 Nov 2015
*/
public class EditTreeContentProvider implements IContentProvider {

/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override
public void dispose() {
// TODO Auto-generated method stub

}

/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// TODO Auto-generated method stub

}

}
48 changes: 48 additions & 0 deletions CSTW/src/com/cyanspring/cstw/ui/forms/EditTreeLabelProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.cyanspring.cstw.ui.forms;

import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;

/**
* @author Junfeng
* @create 9 Nov 2015
*/
public class EditTreeLabelProvider implements IBaseLabelProvider {

/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
*/
@Override
public void addListener(ILabelProviderListener listener) {
// TODO Auto-generated method stub

}

/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
*/
@Override
public void dispose() {
// TODO Auto-generated method stub

}

/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
*/
@Override
public boolean isLabelProperty(Object element, String property) {
// TODO Auto-generated method stub
return false;
}

/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
*/
@Override
public void removeListener(ILabelProviderListener listener) {
// TODO Auto-generated method stub

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.cyanspring.cstw.ui.forms;

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.forms.DetailsPart;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.MasterDetailsBlock;
import org.eclipse.ui.forms.SectionPart;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.TableWrapData;

/**
* @author Junfeng
* @create 9 Nov 2015
*/
public class SubAccountManageMasterDetailBlock extends MasterDetailsBlock {

private FormToolkit toolkit;
private TreeViewer editTree;
private Object rootList;

@Override
protected void createMasterPart(final IManagedForm managedForm, Composite parent) {
toolkit = managedForm.getToolkit();
Section dataSection = toolkit.createSection(parent, Section.COMPACT | Section.TITLE_BAR | Section.EXPANDED);
TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB);
td.colspan = 1;
dataSection.setLayoutData(td);
dataSection.setText("Edit Tree");

Composite sectionClient = toolkit.createComposite(dataSection, SWT.WRAP);
GridLayout clientLayout = new GridLayout();
clientLayout.numColumns = 2;
sectionClient.setLayout(clientLayout);

GridData gd = new GridData();
gd.horizontalSpan = 2;
Label label = toolkit.createLabel(sectionClient, "");
label.setLayoutData(gd);

final SectionPart spart = new SectionPart(dataSection);
managedForm.addPart(spart);

GridData data = new GridData(SWT.LEFT, SWT.FILL, false, false);
Tree memberTree = toolkit.createTree(sectionClient, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER );
data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.heightHint = 200;
data.widthHint = 200;
memberTree.setLayoutData(data);
editTree = new TreeViewer(memberTree);
editTree.setContentProvider(new EditTreeContentProvider());
editTree.setLabelProvider(new EditTreeLabelProvider());
// register SelectionListener
editTree.addSelectionChangedListener(new ISelectionChangedListener() {

public void selectionChanged(SelectionChangedEvent event) {
managedForm.fireSelectionChanged(spart, event.getSelection());
}
});

editTree.addSelectionChangedListener(new ISelectionChangedListener() {

public void selectionChanged(SelectionChangedEvent event) {
changeUiElementState();

}
});
refreshTree();

dataSection.setClient(sectionClient);
}

private void refreshTree() {
editTree.setInput(rootList);
editTree.expandToLevel(3);
editTree.refresh();
}

private void changeUiElementState() {
// TODO Auto-generated method stub

}

@Override
protected void registerPages(DetailsPart detailsPart) {
// TODO Auto-generated method stub

}

@Override
protected void createToolBarActions(IManagedForm managedForm) {
// TODO Auto-generated method stub

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class RWPositionComposite extends BasicComposite {

private Label lblAllMarketCapitalization; // 总市值
private Label lblUnrealizedPL; // 浮盈
private Label lblPNL; // 实现盈利
private Label lblAllPNL; // 总盈利

/**
Expand Down Expand Up @@ -68,14 +67,6 @@ private void initComponent() {
lblUnrealizedPL = new Label(composite, SWT.NONE);
lblUnrealizedPL.setLayoutData(gd2);

Label lbl3 = new Label(composite, SWT.NONE);
lbl3.setAlignment(SWT.RIGHT);
lbl3.setLayoutData(gd1);
lbl3.setText("Realized PnL: ");

lblPNL = new Label(composite, SWT.NONE);
lblPNL.setLayoutData(gd2);

Label lbl4= new Label(composite, SWT.NONE);
lbl4.setAlignment(SWT.RIGHT);
lbl4.setLayoutData(gd1);
Expand All @@ -102,7 +93,6 @@ protected void processByType(RefreshEventType type) {
tableCompsoite.setInput(service.getOpenPositionModelList());
lblAllMarketCapitalization.setText(service.getAllMarketCapitalization());
lblUnrealizedPL.setText(service.getUnrealizedPNL());
lblPNL.setText(service.getPNL());
lblAllPNL.setText(service.getAllPNL());
}
}
Expand Down
Loading

0 comments on commit c50dc88

Please sign in to comment.