work on chart menus

This commit is contained in:
7u83 2017-11-26 21:53:07 +01:00
parent 24d12530da
commit 044badb4d9
5 changed files with 94 additions and 26 deletions

View File

@ -261,7 +261,7 @@ made subject to such option by the copyright holder.
<macrodef name="extend-manifest" uri="http://www.netbeans.org/ns/j2se-project/jnlp">
<element name="customize"/>
<sequential>
<manifest file="${tmp.manifest.file}" mode="update" encoding="UTF-8">
<manifest file="${tmp.manifest.file}" mode="update">
<customize/>
</manifest>
</sequential>
@ -306,7 +306,7 @@ made subject to such option by the copyright holder.
<target name="-copy-tmp-manifest" if="manifest.file">
<property name="tmp.manifest.file" value="${build.dir}/manifest.mf"/>
<copy file="${manifest.file}" tofile="${build.dir}/manifest.mf" encoding="${manifest.encoding}" outputencoding="UTF-8"/>
<copy file="${manifest.file}" tofile="${build.dir}/manifest.mf"/>
</target>
<target name="-set-mixed-code-properties" depends="-check-signing-possible" if="jnlp.signed.true+signjars.task.available">

View File

@ -261,7 +261,7 @@ made subject to such option by the copyright holder.
<macrodef name="extend-manifest" uri="http://www.netbeans.org/ns/j2se-project/jnlp">
<element name="customize"/>
<sequential>
<manifest file="${tmp.manifest.file}" mode="update">
<manifest file="${tmp.manifest.file}" mode="update" encoding="UTF-8">
<customize/>
</manifest>
</sequential>
@ -306,7 +306,7 @@ made subject to such option by the copyright holder.
<target name="-copy-tmp-manifest" if="manifest.file">
<property name="tmp.manifest.file" value="${build.dir}/manifest.mf"/>
<copy file="${manifest.file}" tofile="${build.dir}/manifest.mf"/>
<copy file="${manifest.file}" tofile="${build.dir}/manifest.mf" encoding="${manifest.encoding}" outputencoding="UTF-8"/>
</target>
<target name="-set-mixed-code-properties" depends="-check-signing-possible" if="jnlp.signed.true+signjars.task.available">

View File

@ -1,4 +1,4 @@
#Sun, 26 Nov 2017 09:17:02 +0100
#Sun, 26 Nov 2017 21:52:41 +0100
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=

View File

@ -1,8 +1,30 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Container class="javax.swing.JPopupMenu" name="ctxMenu">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Menu class="javax.swing.JMenu" name="jMenu1">
<Properties>
<Property name="text" type="java.lang.String" value="jMenu1"/>
</Properties>
</Menu>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem1">
<Properties>
<Property name="text" type="java.lang.String" value="jMenuItem1"/>
</Properties>
</MenuItem>
</SubComponents>
</Container>
</NonVisualComponents>
<Events>
<EventHandler event="mouseWheelMoved" listener="java.awt.event.MouseWheelListener" parameters="java.awt.event.MouseWheelEvent" handler="formMouseWheelMoved"/>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMouseReleased"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
@ -34,11 +56,8 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="yLegend" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="52" max="32767" attributes="0"/>
</Group>
<Component id="chart" max="32767" attributes="0"/>
<Component id="yLegend" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="xLegend" min="-2" max="-2" attributes="0"/>
@ -61,6 +80,7 @@
</Properties>
<Events>
<EventHandler event="mouseMoved" listener="java.awt.event.MouseMotionListener" parameters="java.awt.event.MouseEvent" handler="chartMouseMoved"/>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="chartMousePressed"/>
</Events>
<Layout>
@ -71,7 +91,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<EmptySpace min="0" pref="314" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@ -86,7 +106,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="264" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>

View File

@ -54,7 +54,6 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
private ChartDef chartDef;
class CompressionVal {
public final String text;
@ -82,15 +81,14 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
new CompressionVal("2 d", 2 * 24 * 3660 * 1000),
new CompressionVal("3 d", 3 * 3660 * 1000),};
private void initCtxMenu() {
private void initCtxMenu() {
ButtonGroup group = new ButtonGroup();
for (int i = 0; i < this.cvalues.length; i++) {
JRadioButtonMenuItem item = new JRadioButtonMenuItem(this.cvalues[i].text);
}
}
SMAIndicator sma1, sma2;
class MyOHLCData extends OHLCData {
@ -210,16 +208,33 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
ctxMenu = new javax.swing.JPopupMenu();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
chart = new sesim.ChartPanel();
yLegend = new sesim.ChartPanel();
xLegend = new sesim.ChartPanel();
xScrollBar = new javax.swing.JScrollBar();
jMenu1.setText("jMenu1");
ctxMenu.add(jMenu1);
jMenuItem1.setText("jMenuItem1");
ctxMenu.add(jMenuItem1);
addMouseWheelListener(new java.awt.event.MouseWheelListener() {
public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
formMouseWheelMoved(evt);
}
});
addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
formMousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
formMouseReleased(evt);
}
});
chart.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
chart.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
@ -227,6 +242,11 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
chartMouseMoved(evt);
}
});
chart.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
chartMousePressed(evt);
}
});
javax.swing.GroupLayout chartLayout = new javax.swing.GroupLayout(chart);
chart.setLayout(chartLayout);
@ -236,7 +256,7 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
);
chartLayout.setVerticalGroup(
chartLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
.addGap(0, 314, Short.MAX_VALUE)
);
javax.swing.GroupLayout yLegendLayout = new javax.swing.GroupLayout(yLegend);
@ -247,7 +267,7 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
);
yLegendLayout.setVerticalGroup(
yLegendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 264, Short.MAX_VALUE)
.addGap(0, 0, Short.MAX_VALUE)
);
xLegend.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
@ -286,10 +306,8 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(yLegend, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 52, Short.MAX_VALUE))
.addComponent(chart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(chart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(yLegend, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(xLegend, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -297,9 +315,31 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
);
}// </editor-fold>//GEN-END:initComponents
private void chartMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_chartMouseMoved
private void xScrollBarAdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {//GEN-FIRST:event_xScrollBarAdjustmentValueChanged
repaint();
}//GEN-LAST:event_xScrollBarAdjustmentValueChanged
}//GEN-LAST:event_chartMouseMoved
private void showCtxMenu(java.awt.event.MouseEvent evt) {
this.ctxMenu.setVisible(true);
this.ctxMenu.show(this, evt.getX(), evt.getY());
invalidate();
repaint();
}
private void formMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMousePressed
if (!evt.isPopupTrigger()) {
return;
}
System.out.printf("ctx menu pressed\n");
showCtxMenu(evt);
}//GEN-LAST:event_formMousePressed
private void formMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseReleased
formMousePressed(evt);
}//GEN-LAST:event_formMouseReleased
private void formMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {//GEN-FIRST:event_formMouseWheelMoved
double n = evt.getPreciseWheelRotation() * (-1.0);
@ -316,13 +356,21 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
this.repaint();
}//GEN-LAST:event_formMouseWheelMoved
private void xScrollBarAdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {//GEN-FIRST:event_xScrollBarAdjustmentValueChanged
repaint();
}//GEN-LAST:event_xScrollBarAdjustmentValueChanged
private void chartMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_chartMouseMoved
}//GEN-LAST:event_chartMouseMoved
private void chartMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_chartMousePressed
System.out.printf("Mauspress\n");
this.formMousePressed(evt);
}//GEN-LAST:event_chartMousePressed
// Variables declaration - do not modify//GEN-BEGIN:variables
private sesim.ChartPanel chart;
private javax.swing.JPopupMenu ctxMenu;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuItem jMenuItem1;
private sesim.ChartPanel xLegend;
private javax.swing.JScrollBar xScrollBar;
private sesim.ChartPanel yLegend;