Skip to content

Commit

Permalink
normal
Browse files Browse the repository at this point in the history
  • Loading branch information
wyq committed Sep 29, 2014
1 parent bc0e771 commit 0b43f71
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/nbproject/private/
/nbproject/private/
/build/
/dist/
31 changes: 24 additions & 7 deletions src/trajstat/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.meteoinfo.data.mapdata.Field;
import org.meteoinfo.global.GenericFileFilter;
import org.meteoinfo.global.MIMath;
import org.meteoinfo.global.table.DataTypes;
import org.meteoinfo.table.DataTypes;
import org.meteoinfo.ui.CheckBoxListEntry;
import org.meteoinfo.global.util.GlobalUtil;
import org.meteoinfo.layer.LayerDrawType;
Expand All @@ -66,6 +66,7 @@
import trajstat.forms.FrmMultiSel;
import trajstat.forms.FrmPSCF;
import trajstat.forms.FrmTrajMonth;
import trajstat.help.Help;
import trajstat.trajectory.TrajUtil;

/**
Expand Down Expand Up @@ -271,12 +272,18 @@ public void actionPerformed(ActionEvent e) {
trajMenu.add(mi);

mi = new JMenuItem("Help");
HelpSet hs = getHelpSet("/trajstat/help/mi.hs");
HelpBroker hb = hs.createHelpBroker();
//Assign help to components
CSH.setHelpIDString(mi, "top");
//Handle events
mi.addActionListener(new CSH.DisplayHelpFromSource(hb));
// HelpSet hs = getHelpSet("/trajstat/help/mi.hs");
// HelpBroker hb = hs.createHelpBroker();
// //Assign help to components
// CSH.setHelpIDString(mi, "top");
// //Handle events
// mi.addActionListener(new CSH.DisplayHelpFromSource(hb));
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e){
onHelpClick();
}
});
trajMenu.add(mi);
}

Expand Down Expand Up @@ -879,6 +886,16 @@ private void onAboutClick() {
frm.setLocationRelativeTo((JFrame) app);
frm.setVisible(true);
}

private void onHelpClick() {
IApplication app = this.getApplication();
Help help = new Help();
help.setTitle("TrajStat - Help");
help.setIconImage("/trajstat/resources/TrajStat_Logo.png");
help.setSize(800, 700);
help.setLocationRelativeTo((JFrame) app);
help.setVisible(true);
}

/**
* find the helpset file and create a HelpSet object
Expand Down
2 changes: 1 addition & 1 deletion src/trajstat/forms/FrmAddData.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import javax.swing.JOptionPane;
import org.meteoinfo.data.mapdata.Field;
import org.meteoinfo.global.GenericFileFilter;
import org.meteoinfo.global.table.DataTypes;
import org.meteoinfo.table.DataTypes;
import org.meteoinfo.ui.CheckBoxListEntry;
import org.meteoinfo.layer.VectorLayer;
import org.meteoinfo.legend.GroupNode;
Expand Down
2 changes: 1 addition & 1 deletion src/trajstat/forms/FrmClusterCal.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.meteoinfo.shape.PolylineZShape;
import org.meteoinfo.geoprocess.analysis.DistanceType;
import org.meteoinfo.global.GenericFileFilter;
import org.meteoinfo.global.table.DataTypes;
import org.meteoinfo.table.DataTypes;
import org.meteoinfo.layer.LayerDrawType;
import org.meteoinfo.legend.LegendManage;
import org.meteoinfo.legend.LegendScheme;
Expand Down
2 changes: 2 additions & 0 deletions src/trajstat/forms/FrmClusterStat.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class FrmClusterStat extends javax.swing.JDialog {

/**
* Creates new form FrmClusterStat
* @param parent
* @param modal
*/
public FrmClusterStat(java.awt.Frame parent, boolean modal) {
super(parent, modal);
Expand Down
4 changes: 2 additions & 2 deletions src/trajstat/forms/FrmCreateGridLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.meteoinfo.global.GenericFileFilter;
import org.meteoinfo.global.MIMath;
import org.meteoinfo.global.PointD;
import org.meteoinfo.global.table.DataTypes;
import org.meteoinfo.table.DataTypes;
import org.meteoinfo.layer.LayerDrawType;
import org.meteoinfo.layer.MapLayer;
import org.meteoinfo.layer.VectorLayer;
Expand Down Expand Up @@ -283,7 +283,7 @@ private void jComboBox_SameAsLayerActionPerformed(java.awt.event.ActionEvent evt
if (this.jComboBox_SameAsLayer.getItemCount() > 0) {
String layerName = this.jComboBox_SameAsLayer.getSelectedItem().toString();
if (!layerName.equals("None")) {
MapLayer layer = app.getMapDocument().getActiveMapFrame().getMapView().getLayerFromName(layerName);
MapLayer layer = app.getMapDocument().getActiveMapFrame().getMapView().getLayer(layerName);
Extent extent = layer.getExtent();
this.jTextField_Bottom.setText(String.valueOf(extent.minY));
this.jTextField_Left.setText(String.valueOf(extent.minX));
Expand Down
49 changes: 49 additions & 0 deletions src/trajstat/help/Help.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package trajstat.help;

import java.net.URL;
import javax.help.HelpSet;
import javax.help.JHelp;
import javax.swing.ImageIcon;
import javax.swing.JFrame;

/**
*
* @author yaqiang
*/
public class Help extends JFrame{

JHelp helpViewer = null;

public Help() {
try {
ClassLoader cl = Help.class.getClassLoader();
URL hsURL = this.getClass().getResource("mi.hs");
HelpSet hs = new HelpSet(cl, hsURL);
//URL url = HelpSet.findHelpSet(cl, "mi.hs");
helpViewer = new JHelp(hs);
helpViewer.setCurrentID("top");
} catch (Exception e) {
System.err.println("API Help Set not found");
}

this.getContentPane().add(helpViewer);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}

public void setIconImage(String imagePath) {
this.setIconImage(new ImageIcon(getClass().getResource(imagePath)).getImage());
}

public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new Help();
}
});
}
}
4 changes: 3 additions & 1 deletion src/trajstat/help/TrajStatHelp.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Yaqiang Wang
*/
public class TrajStatHelp {
public final class TrajStatHelp {

JFrame f;
JMenuItem topics;
Expand Down Expand Up @@ -65,6 +65,8 @@ public TrajStatHelp() {

/**
* find the helpset file and create a HelpSet object
* @param helpsetfile The help set file
* @return The help set
*/
public HelpSet getHelpSet(String helpsetfile) {
HelpSet hs = null;
Expand Down
6 changes: 3 additions & 3 deletions src/trajstat/help/mi.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<helpset version="1.0">

<!-- title -->
<title>MeteoInfo Help</title>
<title>TrajStat Help</title>

<!-- maps -->
<maps>
Expand All @@ -22,7 +22,7 @@
<data>miTOC.xml</data>
</view>

<view>
<!-- <view>
<name>Index</name>
<label>Index</label>
<type>javax.help.IndexView</type>
Expand All @@ -36,7 +36,7 @@
<data engine="com.sun.java.help.search.DefaultSearchEngine">
JavaHelpSearch
</data>
</view>
</view>-->

<presentation default="true" displayviewimages="true">
<name>main window</name>
Expand Down
2 changes: 1 addition & 1 deletion src/trajstat/trajectory/TrajUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.List;
import javax.swing.JOptionPane;
import org.meteoinfo.global.MIMath;
import org.meteoinfo.global.table.DataTypes;
import org.meteoinfo.table.DataTypes;
import org.meteoinfo.global.util.GlobalUtil;
import org.meteoinfo.layer.LayerDrawType;
import org.meteoinfo.layer.VectorLayer;
Expand Down

0 comments on commit 0b43f71

Please sign in to comment.