Skip to content
Snippets Groups Projects
Commit 331f9a88 authored by Minh Hiep Pham's avatar Minh Hiep Pham :speech_balloon:
Browse files

Updated and brought JframeHwNodeHelp class to ui.window package

parent 0cc08aeb
No related branches found
No related tags found
1 merge request!142cpu node help
package help;
import ui.MainGUI;
import ui.util.IconManager;
import ui.window.JFrameHelp;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Class JFrameHelp
* Creation: 03/04/2019
* version 1.0 03/04/2019
* @author Minh Hiep PHAM
*/
public class CPUNodeHelp extends JFrame implements ActionListener{
private HelpEntry he;
private JButton helpBut;
private JEditorPane pane;
private MainGUI mgui = new MainGUI(false, true, true, true,
true, true, true, true, true, true,
true, false, true);
public CPUNodeHelp(String title, HelpEntry _he) {
super(title);
he = _he;
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Container framePanel = getContentPane();
framePanel.setLayout(new BorderLayout());
Font f = new Font("Courrier", Font.BOLD, 12);
JPanel helpPanel = new JPanel();
helpPanel.setLayout(new BorderLayout());
helpPanel.setBorder(new javax.swing.border.TitledBorder("Help of " + he.getMasterKeyword()));
pane = new JEditorPane("text/html;charset=UTF-8", "");
pane.setEditable(false);
pane.setText(he.getHTMLContent());
JScrollPane jsp = new JScrollPane(pane);
jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
helpPanel.add(jsp, BorderLayout.CENTER);
framePanel.add(helpPanel, BorderLayout.CENTER);
helpBut = new JButton("Help", IconManager.imgic32);
HelpManager hm = new HelpManager();
if(hm.loadEntries()) {
mgui.setHelpManager(hm);
}
helpBut.addActionListener(this);
JPanel jp = new JPanel();
jp.add(helpBut);
framePanel.add(jp, BorderLayout.SOUTH);
setSize(400, 400);
setVisible(true);
pack();
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == helpBut) {
mgui.openHelpFrame(he);
}
}
}
......@@ -192,7 +192,7 @@ public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent,
int tmp;
String tmpName;
JDialogCPUNode dialog = new JDialogCPUNode(frame, "Setting CPU attributes", this, MECType, transactions);
JDialogCPUNode dialog = new JDialogCPUNode(getTDiagramPanel().getMainGUI(), frame, "Setting CPU attributes", this, MECType, transactions);
dialog.setSize(500, 450);
GraphicLib.centerOnParent(dialog, 500, 450);
// dialog.show(); // blocked until dialog has been closed
......
......@@ -41,13 +41,13 @@
package ui.window;
import help.CPUNodeHelp;
import help.HelpEntry;
import help.HelpManager;
import myutil.GraphicLib;
import myutil.TraceManager;
import tmltranslator.modelcompiler.ArchUnitMEC;
import ui.ColorManager;
import ui.MainGUI;
import ui.util.IconManager;
import ui.interactivesimulation.SimulationTransaction;
import ui.tmldd.TMLArchiCPUNode;
......@@ -70,6 +70,7 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener {
//private static String[] tracemodeTab = {"vcd trace", "VCI logger", "VCI stats"};
// private static String[] tracemodeTab = {"VCI logger"};
private boolean regularClose;
MainGUI mainGUI;
private JPanel panel2, panel4, panel5;
// private Frame frame;
......@@ -98,11 +99,13 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener {
//issue 183
List<JButton> buttons = new ArrayList<>();
List<HelpEntry> helpEntries;
CPUNodeHelp cpuHelp;
JFrameHWNodeHelp cpuHelp;
/* Creates new form */
public JDialogCPUNode(Frame _frame, String _title, TMLArchiCPUNode _node, ArchUnitMEC _MECType, java.util.List<SimulationTransaction> _transactions) {
public JDialogCPUNode(MainGUI _mainGUI, Frame _frame, String _title, TMLArchiCPUNode _node, ArchUnitMEC _MECType,
java.util.List<SimulationTransaction> _transactions) {
super(_frame, _title, true);
mainGUI = _mainGUI;
// frame = _frame;
node = _node;
MECType = _MECType;
......@@ -131,11 +134,11 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
if(cpuHelp == null ) {
cpuHelp = new CPUNodeHelp("Help",he);
cpuHelp = new JFrameHWNodeHelp(mainGUI,"Help",he);
cpuHelp.setLocationRelativeTo(but);
}else{
if(!cpuHelp.isVisible()) {
cpuHelp = new CPUNodeHelp("Help",he);
cpuHelp = new JFrameHWNodeHelp(mainGUI,"Help",he);
cpuHelp.setLocationRelativeTo(but);
}else{
cpuHelp.setVisible(false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment