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
0e9b2be1
Commit
0e9b2be1
authored
7 years ago
by
Fabien Tessier
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#68
: Review Filters of Diagram Elements
parent
7398b8ff
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/ui/tmldd/TMLArchiDiagramPanel.java
+41
-25
41 additions, 25 deletions
src/main/java/ui/tmldd/TMLArchiDiagramPanel.java
src/main/java/ui/tmldd/TMLArchiDiagramToolBar.java
+65
-27
65 additions, 27 deletions
src/main/java/ui/tmldd/TMLArchiDiagramToolBar.java
with
106 additions
and
52 deletions
src/main/java/ui/tmldd/TMLArchiDiagramPanel.java
+
41
−
25
View file @
0e9b2be1
...
...
@@ -60,17 +60,15 @@ import java.util.Vector;
*/
public
class
TMLArchiDiagramPanel
extends
TDiagramPanel
implements
TDPWithAttributes
{
public
static
final
int
VIEW_ALL
=
0
;
public
static
final
int
VIEW_ARCHITECTURE_ONLY
=
1
;
public
static
final
int
VIEW_TASK_MAPPING
=
2
;
public
static
final
int
VIEW_CHANNEL_MAPPING
=
3
;
public
static
final
int
VIEW_TASK_MAPPING
=
16
;
public
static
final
int
VIEW_CHANNEL_MAPPING
=
8
;
public
static
final
int
VIEW_COMM_PATTERN
=
4
;
public
static
final
int
VIEW_
COMM_PATTERN_MAPPING
=
5
;
public
static
final
int
VIEW_SECURITY_MAPPING
=
6
;
public
static
final
int
VIEW_
PORT_INTERFACE
=
2
;
public
static
final
int
VIEW_SECURITY_MAPPING
=
1
;
private
int
masterClockFrequency
=
200
;
// in MHz
protected
int
view
=
VIEW_ALL
;
protected
int
view
=
31
;
...
...
@@ -410,23 +408,41 @@ public class TMLArchiDiagramPanel extends TDiagramPanel implements TDPWithAttrib
}
public
boolean
inCurrentView
(
TGComponent
tgc
)
{
switch
(
view
)
{
case
VIEW_ALL:
return
true
;
case
VIEW_ARCHITECTURE_ONLY:
return
(
tgc
instanceof
TMLArchiElementInterface
);
case
VIEW_TASK_MAPPING:
return
(
tgc
instanceof
TMLArchiElementInterface
)
||
(
tgc
instanceof
TMLArchiTaskInterface
);
case
VIEW_CHANNEL_MAPPING:
return
(
tgc
instanceof
TMLArchiElementInterface
)
||
(
tgc
instanceof
TMLArchiChannelInterface
);
case
VIEW_COMM_PATTERN:
return
(
tgc
instanceof
TMLArchiElementInterface
)
||
(
tgc
instanceof
TMLArchiCPInterface
);
case
VIEW_COMM_PATTERN_MAPPING:
return
(
tgc
instanceof
TMLArchiElementInterface
)
||
(
tgc
instanceof
TMLArchiCPInterface
)
||
(
tgc
instanceof
TMLArchiPortInterface
);
case
VIEW_SECURITY_MAPPING:
return
(
tgc
instanceof
TMLArchiElementInterface
)
||
(
tgc
instanceof
TMLArchiSecurityInterface
)
||
(
tgc
instanceof
TMLArchiTaskInterface
);
default
:
return
true
;
}
boolean
res
=
(
tgc
instanceof
TMLArchiElementInterface
);
int
tmp
=
view
;
if
(
view
>=
VIEW_TASK_MAPPING
)
{
res
=
res
||
(
tgc
instanceof
TMLArchiTaskInterface
);
view
-=
16
;
}
if
(
view
>=
VIEW_CHANNEL_MAPPING
)
{
res
=
res
||
(
tgc
instanceof
TMLArchiChannelInterface
);
view
-=
8
;
}
if
(
view
>=
VIEW_COMM_PATTERN
)
{
res
=
res
||
(
tgc
instanceof
TMLArchiCPInterface
);
view
-=
4
;
}
if
(
view
>=
VIEW_PORT_INTERFACE
)
{
res
=
res
||
(
tgc
instanceof
TMLArchiPortInterface
);
view
-=
2
;
}
if
(
view
>=
VIEW_SECURITY_MAPPING
)
{
res
=
res
||
(
tgc
instanceof
TMLArchiSecurityInterface
);
view
-=
1
;
}
view
=
tmp
;
return
res
;
}
}
//End of class
This diff is collapsed.
Click to expand it.
src/main/java/ui/tmldd/TMLArchiDiagramToolBar.java
+
65
−
27
View file @
0e9b2be1
...
...
@@ -37,9 +37,6 @@
* knowledge of the CeCILL license and that you accept its terms.
*/
package
ui.tmldd
;
import
myutil.TraceManager
;
...
...
@@ -48,6 +45,9 @@ import ui.TGUIAction;
import
ui.TToolBar
;
import
javax.swing.*
;
import
java.awt.BorderLayout
;
import
java.awt.Dimension
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
...
...
@@ -55,14 +55,16 @@ import java.awt.event.ActionListener;
* Class TMLArchiDiagramToolBar
* Implements the toolbar to be used in conjunction with the panel of a TML Architecture diagram
* Creation: 18/09/2007
* @version 1.0
0
8/09/20
1
7
* @version 1.0
1
8/09/20
0
7
* @author Ludovic APVRILLE
* @see ui.cd.TClassDiagramPanel
*/
public
class
TMLArchiDiagramToolBar
extends
TToolBar
implements
ActionListener
{
protected
JComboBox
<
String
>
box
;
protected
static
String
[]
viewInfos
=
{
"View all"
,
"View architecture only"
,
"View task mapping"
,
"View channel mapping"
,
"View Comm. Pattern"
,
"View Comm. Pattern mapping"
,
"View security mapping"
};
protected
JMenuBar
box
;
protected
JMenu
menu
;
protected
JCheckBoxMenuItem
m1
,
m2
,
m3
,
m4
,
m5
;
protected
static
String
[]
viewInfos
=
{
"View task mapping"
,
"View channel mapping"
,
"View Comm. Pattern mapping"
,
"View Port Interface"
,
"View security mapping"
};
protected
TMLArchiDiagramPanel
panel
;
public
TMLArchiDiagramToolBar
(
MainGUI
_mgui
)
{
...
...
@@ -76,7 +78,6 @@ public class TMLArchiDiagramToolBar extends TToolBar implements ActionListener
mgui
.
actions
[
TGUIAction
.
TMLARCHI_LINK
].
setEnabled
(
b
);
mgui
.
actions
[
TGUIAction
.
TMLARCHI_CPUNODE
].
setEnabled
(
b
);
mgui
.
actions
[
TGUIAction
.
TMLARCHI_HWANODE
].
setEnabled
(
b
);
mgui
.
actions
[
TGUIAction
.
TMLARCHI_CAMSNODE
].
setEnabled
(
b
);
//ajout CD
mgui
.
actions
[
TGUIAction
.
TMLARCHI_BUSNODE
].
setEnabled
(
b
);
mgui
.
actions
[
TGUIAction
.
TMLARCHI_CPNODE
].
setEnabled
(
b
);
mgui
.
actions
[
TGUIAction
.
TMLARCHI_BRIDGENODE
].
setEnabled
(
b
);
...
...
@@ -125,8 +126,6 @@ public class TMLArchiDiagramToolBar extends TToolBar implements ActionListener
button
.
addMouseListener
(
mgui
.
mouseHandler
);
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_HWANODE
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_CAMSNODE
]);
//ajout CD
button
.
addMouseListener
(
mgui
.
mouseHandler
);
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_ARTIFACT
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
...
...
@@ -143,26 +142,27 @@ public class TMLArchiDiagramToolBar extends TToolBar implements ActionListener
button
.
addMouseListener
(
mgui
.
mouseHandler
);
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_MEMORYNODE
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
this
.
addSeparator
();
this
.
addSeparator
();
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_COMMUNICATION_ARTIFACT
]);
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_COMMUNICATION_ARTIFACT
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
/*button = this.add(mgui.actions[TGUIAction.TMLARCHI_EVENT_ARTIFACT]);
button.addMouseListener(mgui.mouseHandler);*/
if
(
MainGUI
.
experimentalOn
)
{
this
.
addSeparator
();
this
.
addSeparator
();
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_CPNODE
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_PORT_ARTIFACT
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_PORT_ARTIFACT
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
}
this
.
addSeparator
();
this
.
addSeparator
();
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_KEY
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_FIREWALL
]);
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
TMLARCHI_FIREWALL
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
...
...
@@ -175,31 +175,69 @@ public class TMLArchiDiagramToolBar extends TToolBar implements ActionListener
button
=
this
.
add
(
mgui
.
actions
[
TGUIAction
.
ACT_TOGGLE_DIPLO_ID
]);
button
.
addMouseListener
(
mgui
.
mouseHandler
);
setPluginButtons
(
"TMLArchiDiagramPanel"
);
setPluginButtons
(
"TMLArchiDiagramPanel"
);
this
.
addSeparator
();
if
(
viewInfos
==
null
)
{
TraceManager
.
addDev
(
"null viewInfos"
);
}
box
=
new
JComboBox
<>(
viewInfos
);
//Issue #68: Review Filters of Diagram Elements
box
=
new
JMenuBar
();
menu
=
new
JMenu
(
"Edit configuration view"
);
m1
=
new
JCheckBoxMenuItem
(
viewInfos
[
0
],
true
);
m1
.
addActionListener
(
this
);
m2
=
new
JCheckBoxMenuItem
(
viewInfos
[
1
],
true
);
m2
.
addActionListener
(
this
);
m3
=
new
JCheckBoxMenuItem
(
viewInfos
[
2
],
true
);
m3
.
addActionListener
(
this
);
m4
=
new
JCheckBoxMenuItem
(
viewInfos
[
3
],
true
);
m4
.
addActionListener
(
this
);
m5
=
new
JCheckBoxMenuItem
(
viewInfos
[
4
],
true
);
m5
.
addActionListener
(
this
);
menu
.
add
(
m1
);
menu
.
add
(
m2
);
menu
.
add
(
m3
);
menu
.
add
(
m4
);
menu
.
add
(
m5
);
box
.
add
(
menu
);
this
.
add
(
box
);
box
.
addActionListener
(
this
);
}
public
void
setPanel
(
TMLArchiDiagramPanel
_panel
)
{
panel
=
_panel
;
}
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
super
.
actionPerformed
(
e
);
if
(
e
.
getSource
()
==
box
)
{
super
.
actionPerformed
(
e
);
//if (e.getSource() == box) {
if
(
panel
!=
null
)
{
panel
.
setCurrentView
(
box
.
getSelectedIndex
());
int
res
=
0
;
//Check if "View Comm. Pattern mapping" is check to enable "Port Interface" option
if
(!((
JCheckBoxMenuItem
)
box
.
getMenu
(
0
).
getItem
(
2
)).
getState
())
((
JCheckBoxMenuItem
)
box
.
getMenu
(
0
).
getItem
(
3
)).
setEnabled
(
false
);
else
((
JCheckBoxMenuItem
)
box
.
getMenu
(
0
).
getItem
(
3
)).
setEnabled
(
true
);
//Verify checked options
for
(
int
i
=
0
;
i
<
box
.
getMenu
(
0
).
getItemCount
();
i
++)
{
JMenuItem
j
=
box
.
getMenu
(
0
).
getItem
(
i
);
JCheckBoxMenuItem
ci
=
(
JCheckBoxMenuItem
)
j
;
res
*=
2
;
if
(
ci
.
isEnabled
()
&&
ci
.
getState
())
res
++;
}
panel
.
setCurrentView
(
res
);
}
}
//
}
}
}
// Class
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