Need help with JDraw to display a Trend for Scalar Attribute when mouse press

Need help with JDraw to display a Trend for Scalar Attribute when mouse press

I have a SimpleScalarViewer in JDraw and want to display a pop up Trend when a mouse press in the SimpleScalarViewer area.
I tried to configure className and classParam under Extensions tab with className = fr.esrf.tangoatk.widget.attribute.Trend but it has no effect?

Please help.
Thanks in advance.
Tac.
Hello,
The click on JDSwingObject was not possible so I fixed this in the last ATK release (9.3.8).
I also added a simple panel to display a trend on a NumberScalar but It is a simple panel and if you want something more sophisticated you need to write your own. You can take fr.esrf.tangoatk.widget.util.SimpleTrend as an example.
Jean-Luc
Thank you Jean-Luc.
Where do I can download fr.esrf.tangoatk.widget.util.SimpleTrend, or it is already part of the ATK 9.3.8?
Tac
Edited 4 years ago
Yes it is included in ATK 9.3.8.
Thanks Jean-Luc:
It worked.
Another question is: Can I pass the Dataview options, Smoothing, Flat, Neighbors = 50 to the fr.esrf.tangoatk.widget.util.SimpleTrend?
If so, how do I set them?
Tac.
No, as I said the SimpleTrend is a very simple panel.
You can write your own class and set-up option by code.
Here is an example of a Panel that do want you want:


package MyPanels;

import fr.esrf.tangoatk.core.*;
import fr.esrf.tangoatk.widget.attribute.Trend;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
* Simple trend frame (number scalar only)
*/
public class SimpleTrend extends JFrame {

AttributePolledList attList;
Trend trend;

public SimpleTrend(String attName) {

setTitle(attName);
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
trend = new Trend(this);
trend.setPreferredSize(new Dimension(800,600));
setContentPane(trend);

addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
exitPanel();
}
});
IEntity att;
attList = new AttributePolledList();
try {
att = attList.add(attName);
} catch (ConnectionException e1) {
ErrorPane.showErrorMessage(this,attName,e1);
return;
}

if(! (att instanceof INumberScalar) ) {
JOptionPane.showMessageDialog(this,"SimpleTrend supports only number scalar");
return;
}

trend.setModel(attList);
trend.setSelectionTreeVisible(false);
trend.addToAxis(attName,Trend.SEL_Y1,false);

JLDataView v = trend.getDataViewForAttribute(attName);
v.setSmoothingMethod(JLDataView.SMOOTH_FLAT);
v.setSmoothingNeighbors(50);

attList.startRefresher();
ATKGraphicsUtils.centerFrameOnScreen(this);
setVisible(true);

}

private void exitPanel() {
attList.clear();
attList.stopRefresher();
dispose();
}

}



Then you just have to add this class to your CLASSPATH and set up the className to MyPabnels.SimpleTrend.
 
Register or login to create to post a reply.