Dukascopy
 
 
Wiki JStore Search Login

Demo Platform for TraderContest
 Post subject: Demo Platform for TraderContest Post rating: 0   New post Posted: Mon 25 May, 2015, 14:36 
User avatar

User rating: 7
Joined: Tue 28 Feb, 2012, 09:45
Posts: 45
Location: JapanJapan
About the Demo Platform of Trader-Contest.
Dukascopy Bank ver. 2.45.2
JForex API ver. 2.12.15

@CentOS 6.6 (32 bit)
I couldn't open all popup menus (Custom Indicators, Plugins, and Charts) of Workspace by right-click.
Image

P.S.
@Window7 (64 bit)
I couldn't open a popup menu (Custom Indicators) of Workspace by right-click.
Image

regards.


Attachments:
windows7.png [2.28 KiB]
Downloaded 305 times
centos6.png [6.06 KiB]
Downloaded 264 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Demo Platform for TraderContest Post rating: 0   New post Posted: Tue 26 May, 2015, 16:50 
JForex Master
User avatar

User rating:
Joined: Wed 16 Sep, 2009, 18:23
Posts: 1045
Location: Geneva, Switzerland
Could you please provide your workspace xml file?


 
 Post subject: Re: Demo Platform for TraderContest Post rating: 0   New post Posted: Thu 28 May, 2015, 12:02 
User avatar

User rating: 7
Joined: Tue 28 Feb, 2012, 09:45
Posts: 45
Location: JapanJapan
About Demo-Platform.
Dukascopy Bank ver. 2.45.3
JForex API ver. 2.12.17

After Restore Default (Workspace >> Right Click >> Restore Default)...

@Window7 (64 bit)
It seems to be no problem.

But,
@Linux(CentOS 6.6 32 bit)
It seems to be there is still bug.

Workspace >> Right-Click is OK.
Image

Workspace Node >> Left-Click and Left-Double-Click are working.
Could select a node.
Could expand or collapse a node.

But, Workspace Node >> Right-Click is Not working.
Couldn't show popup menu.
Image

I think, there is something wrong code in mouse listener (WorkspaceJTreeMouseListener.class???)).
Especially, method mousePressed(MouseEvent event) is suspiciously...


Attachments:
workspace.png [7.49 KiB]
Downloaded 283 times
WorkspaceTreeNode.png [8.33 KiB]
Downloaded 322 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Demo Platform for TraderContest Post rating: 0   New post Posted: Mon 01 Jun, 2015, 12:48 
User avatar

User rating: 7
Joined: Tue 28 Feb, 2012, 09:45
Posts: 45
Location: JapanJapan
The mouse listener for the workspace JTree was not designed for some OS which like as linux.

So, I made a temporary strategy myself. It adjust a popup trigger timing.
Sample strategy is as below.

package jforex;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.lang.reflect.Field;

import javax.swing.JOptionPane;
import javax.swing.JTree;

import com.dukascopy.api.IAccount;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IConsole;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IMessage;
import com.dukascopy.api.IStrategy;
import com.dukascopy.api.ITick;
import com.dukascopy.api.Instrument;
import com.dukascopy.api.JFException;
import com.dukascopy.api.Period;
import com.dukascopy.api.RequiresFullAccess;

@RequiresFullAccess
public class BugFixSample implements IStrategy{

    @Override
    public void onStart(final IContext context) throws JFException {
        int option = JOptionPane.showConfirmDialog(null,
                "<html><b>Bug fix for DDS2-jCLient-JForex-2.45.3<br>Would you like to replace the WorkspaceJTreeMouseListener?</b></html>",
                "Bug fix for DDS2-jCLient-JForex-2.45.3",
                JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        if(option == JOptionPane.OK_OPTION){
            bugfix(context);
        }
        context.stop();
    }
   
    private void bugfix(IContext context) throws JFException {
        IConsole console = context.getConsole();
        console.getNotif().println("start: Bug fix for the WorkspaceJTreeMouseListener");
        Object obj = context.getUserInterface().getMainFrame();
        obj = getField(obj.getClass(), obj, "dealPanel");
        obj = getField(obj.getClass(), obj, "workspaceTreePanel");
        JTree tree = (JTree) getField(obj.getClass(), obj, "workspaceJTree");
        for(final MouseListener ml: tree.getMouseListeners()){
            if(ml.getClass().getName().equals("com.dukascopy.dds2.greed.gui.component.tree.a.p")){
                tree.removeMouseListener(ml);
                tree.addMouseListener(new MouseListener() {
                   
                    @Override
                    public void mouseReleased(MouseEvent event) {
                        MouseEvent me = event.getButton() == MouseEvent.BUTTON3 && !event.isPopupTrigger()?
                            new MouseEvent(event.getComponent(), event.getID(), event.getWhen(), event.getModifiers(), event.getX(), event.getY(), event.getClickCount(), true, event.getButton()):
                                event;
                        ml.mouseReleased(me);
                    }
                   
                    @Override
                    public void mousePressed(MouseEvent event) {
                        MouseEvent me = event.getButton() == MouseEvent.BUTTON3 && event.isPopupTrigger()?
                                new MouseEvent(event.getComponent(), event.getID(), event.getWhen(), event.getModifiers(), event.getX(), event.getY(), event.getClickCount(), false, event.getButton()):
                                    event;
                        ml.mousePressed(me);
                    }
                   
                    @Override
                    public void mouseExited(MouseEvent event) {
                        ml.mouseExited(event);
                    }
                   
                    @Override
                    public void mouseEntered(MouseEvent event){
                        ml.mouseEntered(event);
                    }
                   
                    @Override
                    public void mouseClicked(MouseEvent event) {
                        ml.mouseClicked(event);
                    }
                });
                console.getWarn().println("replaced the mouse listener!!");
                break;
            }
        }
        console.getNotif().println("end: Bug fix for the WorkspaceJTreeMouseListener");
    }
   
    private Object getField(Class<?> calzz, Object obj, String name){
        Field field;
        try {
            field = calzz.getDeclaredField(name);
            field.setAccessible(true);
            return field.get(obj);
        } catch (Exception e) {
            return null;
        }
    }
   
    @Override
    public void onMessage(IMessage message) throws JFException {
    }
   
    @Override
    public void onStop() throws JFException {
    }
   
    @Override
    public void onTick(Instrument instrument, ITick tick) throws JFException {
    }

    @Override
    public void onBar(Instrument instrument, Period period, IBar askBar,
            IBar bidBar) throws JFException {
    }

    @Override
    public void onAccount(IAccount account) throws JFException {
    }
}


(How to use that without right click menu of the Worlspace,
Main menu Tools >> Strategies >> Open >> Local Run)

The popup trigger timing of the Linux OS is not same as Windows.
Please tell that to a programer of the WorkspaceJTreeMouseListener.
Best Regards.


Attachments:
BugFixSample.java [4.46 KiB]
Downloaded 165 times
File comment: Can't delete!!
BugFixSt.java [4.45 KiB]
Downloaded 113 times
File comment: Can't delete!!
BugFixSt.java [4.45 KiB]
Downloaded 88 times
File comment: Can't delete!!
BugFixSt.java [4.45 KiB]
Downloaded 166 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

Jump to:  

  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com