Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mbe-tools
TTool
Commits
dba674c8
Commit
dba674c8
authored
5 years ago
by
Minh Hiep Pham
Browse files
Options
Downloads
Patches
Plain Diff
Created CPUNodeHelp class and updated cpu node help
parent
a87d74a9
No related branches found
No related tags found
2 merge requests
!142
cpu node help
,
!141
Help cpu node
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/help/CPUNodeHelp.java
+64
-0
64 additions, 0 deletions
src/main/java/help/CPUNodeHelp.java
src/main/java/ui/window/JDialogCPUNode.java
+25
-24
25 additions, 24 deletions
src/main/java/ui/window/JDialogCPUNode.java
with
89 additions
and
24 deletions
src/main/java/help/CPUNodeHelp.java
0 → 100644
+
64
−
0
View file @
dba674c8
package
help
;
import
ui.MainGUI
;
import
ui.util.IconManager
;
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
{
private
HelpEntry
he
;
private
JButton
helpBut
;
private
JEditorPane
pane
;
private
MainGUI
mgui
=
new
MainGUI
(
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
);
public
CPUNodeHelp
(
String
title
,
HelpEntry
_he
)
{
super
(
title
);
he
=
_he
;
setDefaultCloseOperation
(
JFrame
.
DISPOSE_ON_CLOSE
);
setModalExclusionType
(
Dialog
.
ModalExclusionType
.
APPLICATION_EXCLUDE
);
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
);
helpBut
.
addActionListener
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
mgui
.
openHelpFrame
(
he
);
}
});
JPanel
jp
=
new
JPanel
();
jp
.
add
(
helpBut
);
framePanel
.
add
(
jp
,
BorderLayout
.
SOUTH
);
setSize
(
400
,
400
);
setVisible
(
true
);
}
}
This diff is collapsed.
Click to expand it.
src/main/java/ui/window/JDialogCPUNode.java
+
25
−
24
View file @
dba674c8
...
...
@@ -42,12 +42,14 @@
package
ui.window
;
import
cli.Action
;
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
;
...
...
@@ -81,7 +83,7 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener {
// private static int selectedTracemode = 0;
// Panel1
protected
JTextField
nodeName
;
private
JFrameHelp
jFrameHelp
=
null
;
private
MainGUI
mgui
;
// Panel2
protected
JTextField
sliceTime
,
nbOfCores
,
byteDataSize
,
pipelineSize
,
goIdleTime
,
maxConsecutiveIdleCycles
,
...
...
@@ -99,6 +101,7 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener {
//issue 183
List
<
JButton
>
buttons
=
new
ArrayList
<>();
List
<
HelpEntry
>
helpEntries
;
CPUNodeHelp
cpuHelp
=
null
;
/* Creates new form */
public
JDialogCPUNode
(
Frame
_frame
,
String
_title
,
TMLArchiCPUNode
_node
,
ArchUnitMEC
_MECType
,
java
.
util
.
List
<
SimulationTransaction
>
_transactions
)
{
...
...
@@ -125,51 +128,48 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener {
}
//issue 183
private
void
buttonClick
(
JButton
but
,
HelpEntry
he
,
HelpManager
hm
)
{
private
void
buttonClick
(
JButton
but
,
HelpEntry
he
)
{
setModalityType
(
ModalityType
.
MODELESS
);
but
.
addActionListener
(
new
ActionListener
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
setModalityType
(
ModalityType
.
MODELESS
);
if
(
jFrameHelp
==
null
)
{
jFrameHelp
=
new
JFrameHelp
(
"help"
,
hm
,
he
);
jFrameHelp
.
setModalExclusionType
(
ModalExclusionType
.
APPLICATION_EXCLUDE
);
jFrameHelp
.
getRootPane
().
getInputMap
(
JComponent
.
WHEN_IN_FOCUSED_WINDOW
).
put
(
KeyStroke
.
getKeyStroke
(
"ESCAPE"
),
"close"
);
jFrameHelp
.
getRootPane
().
getActionMap
().
put
(
"close"
,
new
AbstractAction
()
{
if
(
cpuHelp
==
null
)
{
cpuHelp
=
new
CPUNodeHelp
(
"help"
,
he
);
cpuHelp
.
getRootPane
().
getInputMap
(
JComponent
.
WHEN_IN_FOCUSED_WINDOW
).
put
(
KeyStroke
.
getKeyStroke
(
"ESCAPE"
),
"close"
);
cpuHelp
.
getRootPane
().
getActionMap
().
put
(
"close"
,
new
AbstractAction
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(!
jFrame
Help
.
isVisible
())
if
(!
cpu
Help
.
isVisible
())
dispose
();
jFrame
Help
.
setVisible
(
false
);
cpu
Help
.
setVisible
(
false
);
}
});
}
else
{
if
(!
jFrameHelp
.
isVisible
())
{
jFrameHelp
=
new
JFrameHelp
(
"help"
,
hm
,
he
);
jFrameHelp
.
setModalExclusionType
(
ModalExclusionType
.
APPLICATION_EXCLUDE
);
setModalityType
(
ModalityType
.
MODELESS
);
jFrameHelp
.
getRootPane
().
getInputMap
(
JComponent
.
WHEN_IN_FOCUSED_WINDOW
).
put
(
KeyStroke
.
getKeyStroke
(
"ESCAPE"
),
"close"
);
jFrameHelp
.
getRootPane
().
getActionMap
().
put
(
"close"
,
new
AbstractAction
()
{
if
(!
cpuHelp
.
isVisible
())
{
cpuHelp
=
new
CPUNodeHelp
(
"help"
,
he
);
cpuHelp
.
getRootPane
().
getInputMap
(
JComponent
.
WHEN_IN_FOCUSED_WINDOW
).
put
(
KeyStroke
.
getKeyStroke
(
"ESCAPE"
),
"close"
);
cpuHelp
.
getRootPane
().
getActionMap
().
put
(
"close"
,
new
AbstractAction
()
{
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(!
jFrame
Help
.
isVisible
())
if
(!
cpu
Help
.
isVisible
())
dispose
();
jFrame
Help
.
setVisible
(
false
);
cpu
Help
.
setVisible
(
false
);
}
});
}
else
{
jFrame
Help
.
setVisible
(
false
);
jFrame
Help
=
null
;
cpu
Help
.
setVisible
(
false
);
cpu
Help
=
null
;
}
}
}
});
}
//issue 183
private
void
hardwareHelp
(){
HelpManager
helpManager
=
new
HelpManager
();
if
(
helpManager
.
loadEntries
())
{
helpEntries
=
new
ArrayList
<>();
HelpEntry
he0
=
helpManager
.
getHelpEntryWithHTMLFile
(
"cpuname.html"
);
...
...
@@ -208,17 +208,19 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener {
helpEntries
.
add
(
he16
);
}
for
(
int
i
=
0
;
i
<
17
;
i
++)
{
Icon
myIcon
=
IconManager
.
imgic32
;
JButton
but
=
new
JButton
(
myIcon
);
setButton
(
but
);
buttonClick
(
but
,
helpEntries
.
get
(
i
)
,
helpManager
);
buttonClick
(
but
,
helpEntries
.
get
(
i
));
buttons
.
add
(
but
);
}
}
private
void
initComponents
()
{
hardwareHelp
();
Container
c
=
getContentPane
();
GridBagLayout
gridbag0
=
new
GridBagLayout
();
...
...
@@ -233,7 +235,6 @@ public class JDialogCPUNode extends JDialogBase implements ActionListener {
c
.
setLayout
(
gridbag0
);
setDefaultCloseOperation
(
JFrame
.
DISPOSE_ON_CLOSE
);
setModalityType
(
ModalityType
.
APPLICATION_MODAL
);
panel2
=
new
JPanel
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment