diff --git a/src/main/java/ui/MainGUI.java b/src/main/java/ui/MainGUI.java index fef7fd3ded0e238801f124269521b56e32c6657d..5ae38485afe175adf68776f12b850a25c21d2d9a 100644 --- a/src/main/java/ui/MainGUI.java +++ b/src/main/java/ui/MainGUI.java @@ -1152,6 +1152,26 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per return index; } + private int addVerificationPropertyPanel(String name, int index, boolean addDefaultElements) { + if (index == -1) { + index = tabs.size(); + } + //TraceManager.addDev("New SysMLSec Methodopanel"); + VerificationPanel dp = new VerificationPanel(this); + tabs.add(index, dp); + mainTabbedPane.add(dp.tabbedPane, index); + mainTabbedPane.setToolTipTextAt(index, "Open Verification Tracking"); + mainTabbedPane.setTitleAt(index, name); + mainTabbedPane.setIconAt(index, IconManager.imgic99); + //mainTabbedPane.addTab(name, IconManager.imgic14, dp.tabbedPane, "Opens design diagrams"); + dp.init(name); + if (addDefaultElements) { + dp.initElements(); + } + //ystem.out.println("Design added"); + return index; + } + private int addTMLComponentDesignPanel(String name, int index) { if (index == -1) { @@ -1609,6 +1629,12 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per return index; } + public int createVerificationProperty(String name) { + int index = addVerificationPropertyPanel(name, -1, false); + mainTabbedPane.setSelectedIndex(index); + return index; + } + public int createTMLDesign(String name) { int index = addTMLDesignPanel(name, -1); mainTabbedPane.setSelectedIndex(index); @@ -2022,6 +2048,15 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per //frame.repaint(); } + public void newVerificationPropertyPanel() { + //TraceManager.addDev("NEW DESIGN"); + addVerificationPropertyPanel("Verification Tracking", -1, true); + tabs.elementAt(tabs.size() - 1).tabbedPane.setSelectedIndex(0); + mainTabbedPane.setSelectedIndex(tabs.size() - 1); + //paneAction(null); + //frame.repaint(); + } + public void newTMLComponentDesign() { //TraceManager.addDev("NEW DESIGN"); addTMLComponentDesignPanel("Application", -1); @@ -6642,6 +6677,11 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per tp.tabbedPane.setTitleAt(0, name); } + public void setVerificationPropertyDiagramName(int indexDesign, String name) { + TURTLEPanel tp = tabs.elementAt(indexDesign); + tp.tabbedPane.setTitleAt(0, name); + } + public void setTMLTaskDiagramName(int indexDesign, String name) { TURTLEPanel tp = tabs.elementAt(indexDesign); tp.tabbedPane.setTitleAt(0, name); @@ -9288,7 +9328,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per private JPopupMenu menu; private JMenuItem rename, remove, moveRight, moveLeft, newDesign, newAnalysis, newDeployment, newRequirement/*, newTMLDesign*/, newTMLComponentDesign, newTMLArchi, newProactiveDesign, newTURTLEOSDesign, - newNCDesign, sort, clone, newAttackTree, newFaultTree, newAVATARBD, newAVATARRequirement, newMAD, newTMLCP, newTMLMethodo, newAvatarMethodo, newAVATARDD, newSysmlsecMethodo, newSysCAMS, newELN; + newNCDesign, sort, clone, newAttackTree, newFaultTree, newAVATARBD, newAVATARRequirement, newMAD, newTMLCP, newTMLMethodo, + newAvatarMethodo, newAVATARDD, newSysmlsecMethodo, newSysCAMS, newELN, newVerificationProperty; private JMenuItem newAVATARAnalysis; public PopupListener(MainGUI _mgui) { @@ -9358,6 +9399,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per newAVATARDD = createMenuItem("New Deployment Diagram"); newAvatarMethodo = createMenuItem("New AVATAR Methodology"); newSysmlsecMethodo = createMenuItem("New SysML-Sec Methodology"); + newVerificationProperty = createMenuItem("New Verification Tracking"); + menu = new JPopupMenu("Views"); menu.add(moveLeft); @@ -9455,6 +9498,10 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per } } + menu.addSeparator(); + menu.add(newVerificationProperty); + + } @@ -9589,6 +9636,9 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per } else if (e.getSource() == newELN) { ModeManager.setMode(CREATE_NEW_PANEL, actions, mainBar, mgui); mgui.newELN(); + } else if (e.getSource() == newVerificationProperty) { + ModeManager.setMode(CREATE_NEW_PANEL, actions, mainBar, mgui); + mgui.newVerificationPropertyPanel(); } } }; diff --git a/src/main/java/ui/verificationpd/VerificationPropertyDiagramPanel.java b/src/main/java/ui/verificationpd/VerificationPropertyDiagramPanel.java new file mode 100755 index 0000000000000000000000000000000000000000..565aae6d11e2f949fb329024dda71dc3440361f9 --- /dev/null +++ b/src/main/java/ui/verificationpd/VerificationPropertyDiagramPanel.java @@ -0,0 +1,134 @@ +/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + * + * ludovic.apvrille AT enst.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + + + +package ui.verificationpd; + +import myutil.TraceManager; +import org.w3c.dom.Element; +import ui.*; + +/** + * Class VerificationPropertyDiagramPanel + * Panel for tracking verifications + * Creation: 10/04/2019 + * @version 1.0 10/04/2019 + * @author Ludovic APVRILLE + */ +public class VerificationPropertyDiagramPanel extends TDiagramPanel implements TDPWithAttributes { + //public Vector validated, ignored; + + public VerificationPropertyDiagramPanel(MainGUI mgui, TToolBar _ttb) { + super(mgui, _ttb); + + //TraceManager.addDev("Sysmlsec metho diagram created"); + /*TDiagramMouseManager tdmm = new TDiagramMouseManager(this); + addMouseListener(tdmm); + addMouseMotionListener(tdmm);*/ + } + + public boolean actionOnDoubleClick(TGComponent tgc) { + return true; + } + + public boolean actionOnAdd(TGComponent tgc) { + /*if (tgc instanceof TCDTClass) { + TCDTClass tgcc = (TCDTClass)(tgc); + mgui.addTClass(tgcc.getClassName()); + return true; + }*/ + return false; + } + + public boolean actionOnRemove(TGComponent tgc) { + /*if (tgc instanceof TCDTClass) { + TCDTClass tgcc = (TCDTClass)(tgc); + mgui.removeTClass(tgcc.getClassName()); + resetAllInstancesOf(tgcc); + return true; + }*/ + return false; + } + + public boolean actionOnValueChanged(TGComponent tgc) { + /*if (tgc instanceof TCDTClass) { + return actionOnDoubleClick(tgc); + }*/ + return false; + } + + public String getXMLHead() { + return "<VerificationPropertyDiagramPanel name=\"" + name + "\"" + sizeParam() + zoomParam() + " >"; + } + + public String getXMLTail() { + return "</VerificationPropertyDiagramPanel>"; + } + + public String getXMLSelectedHead() { + return "<VerificationPropertyDiagramPanelCopy name=\"" + name + "\" xSel=\"" + xSel + "\" ySel=\"" + ySel + "\" widthSel=\"" + widthSel + + "\" heightSel=\"" + heightSel + "\" >"; + } + + public String getXMLSelectedTail() { + return "</VerificationPropertyDiagramPanelCopy>"; + } + + public String getXMLCloneHead() { + return "<VerificationPropertyDiagramPanelCopy name=\"" + name + "\" xSel=\"" + 0 + "\" ySel=\"" + 0 + "\" widthSel=\"" + 0 + "\" heightSel=\"" + + 0 + "\" >"; + } + + public String getXMLCloneTail() { + return "</VerificationPropertyDiagramPanelCopy>"; + } + + + public void makePostLoadingProcessing() throws MalformedModelingException { + + } + + public void enhance() { + autoAdjust(); + } + + public void loadExtraParameters(Element elt) { + } +} diff --git a/src/main/java/ui/verificationpd/VerificationPropertyDiagramToolbar.java b/src/main/java/ui/verificationpd/VerificationPropertyDiagramToolbar.java new file mode 100755 index 0000000000000000000000000000000000000000..b45c6a03e8cb5fc1c0f85b380ed50bfccfbe340b --- /dev/null +++ b/src/main/java/ui/verificationpd/VerificationPropertyDiagramToolbar.java @@ -0,0 +1,111 @@ +/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + * + * ludovic.apvrille AT enst.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + + + +package ui.verificationpd; + +import ui.MainGUI; +import ui.TGUIAction; +import ui.TToolBar; + +import javax.swing.*; + +//import java.awt.*; +//import java.awt.event.*; + +/** + * Class VerificationPropertyDiagramToolbar + * Implements the toolbar to be used in conjunction with the tracking verification + * Creation: 10/04/2019 + * @version 1.0 10/04/2019 + * @author Ludovic APVRILLE + */ +public class VerificationPropertyDiagramToolbar extends TToolBar { + + public VerificationPropertyDiagramToolbar(MainGUI _mgui) { + super(_mgui); + + } + + protected void setActive(boolean b) { + mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(b); + mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(b); + + mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(b); + mgui.updateZoomInfo(); + + //mgui.actions[TGUIAction.ARD_EDIT].setEnabled(b); + mgui.actions[TGUIAction.UML_NOTE].setEnabled(b); + mgui.actions[TGUIAction.CONNECTOR_COMMENT].setEnabled(b); + /*mgui.actions[TGUIAction.ARD_REQUIREMENT].setEnabled(b); + mgui.actions[TGUIAction.ARD_PROPERTY].setEnabled(b); + mgui.actions[TGUIAction.ARD_VERIFY_CONNECTOR].setEnabled(b); + mgui.actions[TGUIAction.ARD_DERIVE_CONNECTOR].setEnabled(b); + mgui.actions[TGUIAction.ARD_REFINE_CONNECTOR].setEnabled(b); + mgui.actions[TGUIAction.ARD_COPY_CONNECTOR].setEnabled(b); + mgui.actions[TGUIAction.ARD_COMPOSITION_CONNECTOR].setEnabled(b); + + mgui.actions[TGUIAction.ACT_TOGGLE_ATTR].setEnabled(b); + + mgui.actions[TGUIAction.ACT_ENHANCE].setEnabled(b);*/ + + //mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(!b); + + } + + protected void setButtons() { + JButton button; + + /*button = this.add(mgui.actions[TGUIAction.ARD_EDIT]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator();*/ + + button = this.add(mgui.actions[TGUIAction.UML_NOTE]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.CONNECTOR_COMMENT]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + } + +} // Class diff --git a/src/main/java/ui/verificationpd/VerificationPropertyGeneric.java b/src/main/java/ui/verificationpd/VerificationPropertyGeneric.java new file mode 100755 index 0000000000000000000000000000000000000000..d123cdb88525ecc4e8dac07c9859633ae4265864 --- /dev/null +++ b/src/main/java/ui/verificationpd/VerificationPropertyGeneric.java @@ -0,0 +1,493 @@ +/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + * + * ludovic.apvrille AT enst.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + + + +package ui.verificationpd; + + +import myutil.GraphicLib; +import myutil.TraceManager; +import ui.*; +import ui.util.IconManager; +import ui.window.JDialogManageListOfString; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Vector; + +/** + * Class SysmlsecMethodologyDiagramReference + * Diagram reference requirement: Used to reference diagrams from the + * Sysmlsec methodology + * Creation: 26/01/2016 + * @version 1.0 26/01/2016 + * @author Ludovic APVRILLE + */ +public abstract class VerificationPropertyGeneric extends TGCScalableWithInternalComponent { + public String oldValue; + protected int textX = 5; + protected int textY = 22; + protected int lineHeight = 30; + protected double dlineHeight = 0.0; + //protected int reqType = 0; + // 0: normal, 1: formal, 2: security + //protected int startFontSize = 10; + protected Graphics graphics; + protected int iconSize = 30; + + protected Font myFont, myFontB; + protected int maxFontSize = 30; + protected int minFontSize = 4; + protected int currentFontSize = -1; + protected boolean displayText = true; + + protected int typeOfReference; + + protected final static String[] TYPE_STR = {"Assumptions", "Requirements", + "Analysis", "Design", "Properties", "Prototyping", "Functional view", + "Architecture view", "Mapping", "Communication pattern", "Attacks", "Faults"}; + protected final static int NB_TYPE = 6; + + protected final static int ASSUMPTIONS = 0; + protected final static int REQUIREMENT = 1; + protected final static int ANALYSIS = 2; + protected final static int DESIGN = 3; + protected final static int PROPERTY = 4; + protected final static int PROTOTYPING = 5; + protected final static int FUNCTIONAL_VIEW = 6; + protected final static int ARCHITECTURE_VIEW = 7; + protected final static int MAPPING_VIEW = 8; + protected final static int CP_VIEW = 9; + protected final static int ATTACK = 10; + protected final static int FAULT = 11; + + + protected JMenuItem diagramReference; + + + + // Icon + //private int iconSize = 18; + //private boolean iconIsDrawn = false; + + public VerificationPropertyGeneric(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { + super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); + + initScaling(200, 120); + oldScaleFactor = tdp.getZoom(); + dlineHeight = lineHeight * oldScaleFactor; + lineHeight = (int)dlineHeight; + dlineHeight = dlineHeight - lineHeight; + + minWidth = 10; + minHeight = lineHeight; + + addTGConnectingPointsCommentTop(); + + nbInternalTGComponent = 0; + //tgcomponent = new TGComponent[nbInternalTGComponent]; + + //int h = 1; + //TAttributeRequirement tgc0; + //tgc0 = new TAttributeRequirement(x, y+height+h, 0, 0, height + h, height+h, true, this, _tdp); + //tgcomponent[0] = tgc0; + + moveable = true; + editable = true; + removable = false; + userResizable = true; + multieditable = true; + + + + oldValue = value; + + myImageIcon = IconManager.imgic5006; + + + actionOnAdd(); + } + + + public void internalDrawing(Graphics g) { + Font f = g.getFont(); +// Font fold = f; +// int w, c; + int size; + + value = TYPE_STR[typeOfReference]; + + if (!tdp.isScaled()) { + graphics = g; + } + + if (((rescaled) && (!tdp.isScaled())) || myFont == null) { + currentFontSize = tdp.getFontSize(); + // + myFont = f.deriveFont((float)currentFontSize); + myFontB = myFont.deriveFont(Font.BOLD); + + if (rescaled) { + rescaled = false; + } + } + + displayText = currentFontSize >= minFontSize; + + // int h = g.getFontMetrics().getHeight(); + + g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); + g.fillRect(x, y, width, height); + ColorManager.setColor(g, getState(), 0); + g.drawRect(x, y, width, height); + + //g.drawLine(x, y+lineHeight, x+width, y+lineHeight); + //g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); + //g.fillRect(x+1, y+1, width-1, lineHeight-1); + //g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); + //g.fillRect(x+1, y+1+lineHeight, width-1, height-1-lineHeight); + ColorManager.setColor(g, getState(), 0); + if ((lineHeight > 23) && (width > 23)){ + g.drawImage(IconManager.img5100, x + width - iconSize + 1, y + 3, Color.yellow, null); + } + + if (displayText) { + size = currentFontSize - 2; + g.setFont(myFontB); + + drawLimitedString(g, value, x, y + size + 3, width, 1); + g.setFont(f); + } + + /*if (displayText) { + size = currentFontSize - 2; + g.setFont(myFont.deriveFont((float)(myFont.getSize() - 2))); + + drawLimitedString(g, REQ_TYPE_STR[reqType], x, y + size, width, 1); + + size += currentFontSize; + g.setFont(myFontB); + w = g.getFontMetrics().stringWidth(value); + drawLimitedString(g, value, x, y + size, width, 1); + + } + + if (verified) { + if (satisfied) { + Color tmp = g.getColor(); + GraphicLib.setMediumStroke(g); + g.setColor(Color.green); + g.drawLine(x+width-2, y-6+lineHeight, x+width-6, y-2+lineHeight); + g.drawLine(x+width-6, y-3+lineHeight, x+width-8, y-6+lineHeight); + g.setColor(tmp); + GraphicLib.setNormalStroke(g); + } else { + //g.drawString("acc", x + width - 10, y+height-10); + Color tmp = g.getColor(); + GraphicLib.setMediumStroke(g); + g.setColor(Color.red); + g.drawLine(x+width-2, y-2+lineHeight, x+width-8, y-8+lineHeight); + g.drawLine(x+width-8, y-2+lineHeight, x+width-2, y-8+lineHeight); + g.setColor(tmp); + GraphicLib.setNormalStroke(g); + } + } + + g.setFont(myFont); + String texti = "Text"; + String s ; + int i; + size = lineHeight + currentFontSize; + + //ID + if (size < (height - 2)) { + drawLimitedString(g, "ID=" + id, x + textX, y + size, width, 0); + } + size += currentFontSize; + + //text + for(i=0; i<texts.length; i++) { + if (size < (height - 2)) { + s = texts[i]; + if (i == 0) { + s = texti + "=\"" + s; + } + if (i == (texts.length - 1)) { + s = s + "\""; + } + drawLimitedString(g, s, x + textX, y + size, width, 0); + } + size += currentFontSize; + + } + // Type and risk + if (size < (height - 2)) { + drawLimitedString(g, "Kind=\"" + kind + "\"", x + textX, y + size, width, 0); + size += currentFontSize; + if (size < (height - 2)) { + drawLimitedString(g, "Risk=\"" + criticality + "\"", x + textX, y + size, width, 0); + size += currentFontSize; + if (size < (height - 2)) { + + drawLimitedString(g, "Reference elements=\"" + referenceElements + "\"", x + textX, y + size, width, 0); + + size += currentFontSize; + if (size < (height - 2)) { + + if (reqType == SECURITY_REQ) { + drawLimitedString(g, "Targeted attacks=\"" + attackTreeNode + "\"", x + textX, y + size, width, 0); + } + + if (reqType == SAFETY_REQ) { + drawLimitedString(g, "Violated action=\"" + violatedAction + "\"", x + textX, y + size, width, 0); + } + } + } + } + } + + + g.setFont(f);*/ + } + + public boolean editOndoubleClick(JFrame frame, int _x, int _y) { + addDiagramReference(frame); + return true; + // On the name ? + /*oldValue = value; + + if ((displayText) && (_y <= (y + lineHeight))) { + String text = getName() + ": "; + if (hasFather()) { + text = getTopLevelName() + " / " + text; + } + String s = (String)JOptionPane.showInputDialog(frame, text, + "setting value", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101, + null, + getValue()); + + if ((s != null) && (s.length() > 0) && (!s.equals(oldValue))) { + //boolean b; + if (!TAttribute.isAValidId(s, false, false)) { + JOptionPane.showMessageDialog(frame, + "Could not change the name of the Requirement: the new name is not a valid name", + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + if (!tdp.isRequirementNameUnique(s)) { + JOptionPane.showMessageDialog(frame, + "Could not change the name of the Requirement: the new name is already in use", + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + + int size = graphics.getFontMetrics().stringWidth(s) + iconSize + 5; + minDesiredWidth = Math.max(size, minWidth); + if (minDesiredWidth != width) { + newSizeForSon(null); + } + setValue(s); + + if (tdp.actionOnDoubleClick(this)) { + return true; + } else { + JOptionPane.showMessageDialog(frame, + "Could not change the name of the Requirement: this name is already in use", + "Error", + JOptionPane.INFORMATION_MESSAGE); + setValue(oldValue); + } + } + return false; + } + + return editAttributes();*/ + + } + + + public void rescale(double scaleFactor){ + dlineHeight = (lineHeight + dlineHeight) / oldScaleFactor * scaleFactor; + lineHeight = (int)(dlineHeight); + dlineHeight = dlineHeight - lineHeight; + + minHeight = lineHeight; + + super.rescale(scaleFactor); + } + + + public TGComponent isOnOnlyMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { + return this; + } + return null; + } + + + + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { + + componentMenu.addSeparator(); + + diagramReference = new JMenuItem("Add diagram reference"); + diagramReference.addActionListener(menuAL); + + componentMenu.add(diagramReference); + } + + public boolean eventOnPopup(ActionEvent e) { + // String s = e.getActionCommand(); + + if (e.getSource() == diagramReference) { + // DB: Issue #53: Pass the frame on which the dialog should be centered + addDiagramReference( getTDiagramPanel().getMGUI().frame ); +// addDiagramReference(null); + } + + return true; + } + + public void addDiagramReference(JFrame frame) { + + } + + /*spublic abstract void makeValidationInfos(SysmlsecMethodologyDiagramName dn); + + public boolean hasSysmlsecMethodologyDiagramName(String s) { + for(int i=0; i<nbInternalTGComponent; i++) { + if (tgcomponent[i].getValue().compareTo(s) == 0) { + return true; + } + } + return false; + } + + + public void fillIgnoredSelectedFromInternalComponents(Vector<String> ignored, Vector<String>selected) { + // Get from mgui the list of all diagrams with type depends from the subclass + // If diagrams have the same name -> we do not see the difference + + // TURTLEPanel tp; + Vector<TURTLEPanel> tabs = getTDiagramPanel().getMGUI().getTabs(); + + for( final TURTLEPanel panel : tabs) { + // tp = (TURTLEPanel)o; + if (isAValidPanelType( panel )) { + ignored.add(getTDiagramPanel().getMGUI().getTitleAt( panel )); + } + } + + Vector<String> newSelected = new Vector<String>(); + TGComponent tgc; + //Consider internal components (text) to figure out the ones that are selected + for(int i=0; i<nbInternalTGComponent; i++) { + tgc = tgcomponent[i]; + if (tgc instanceof SysmlsecMethodologyDiagramName) { + newSelected.add(tgc.getValue()); + } + } + + // Remove from selected the one that do not exist anymore + Vector<String> toBeRemoved = new Vector<String>(); + boolean found; + for(String s: newSelected) { + found = false; + for(String ss: ignored) { + if (ss.compareTo(s) == 0) { + toBeRemoved.add(ss); + found = true; + } + } + if (found) { + selected.add(s); + } + } + + for(String s: toBeRemoved) { + ignored.remove(s); + } + + } + + public abstract boolean isAValidPanelType(TURTLEPanel panel); + + public boolean acceptSwallowedTGComponent(TGComponent tgc) { + return tgc instanceof SysmlsecMethodologyDiagramName; + } + + public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) { + tgc.setFather(this); + addInternalComponent(tgc, 0); + //tgc.setDrawingZone(true); + return true; + } + + public void removeSwallowedTGComponent(TGComponent tgc) { + removeInternalComponent(tgc); + } + + public abstract boolean makeCall(String diagramName, int index); + + protected boolean openDiagram(String tabName) { + if (!tdp.getMGUI().selectMainTab(tabName)) { + TraceManager.addDev("Diagram removed?"); + return false; + } + return true; + } + + protected void giveInformation(String info) { + tdp.getMGUI().setStatusBarText(info); + } + + + + /*public String getDiagramReferences() { + return referenceElements; + }*/ + +} diff --git a/src/main/java/ui/verificationpd/VerificationPropertySafety.java b/src/main/java/ui/verificationpd/VerificationPropertySafety.java new file mode 100755 index 0000000000000000000000000000000000000000..3e77958b900d4fb1214ac1805e3a3b21dc0e0f09 --- /dev/null +++ b/src/main/java/ui/verificationpd/VerificationPropertySafety.java @@ -0,0 +1,84 @@ +/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + * + * ludovic.apvrille AT enst.fr + * + * This software is a computer program whose purpose is to allow the + * edition of TURTLE analysis, design and deployment diagrams, to + * allow the generation of RT-LOTOS or Java code from this diagram, + * and at last to allow the analysis of formal validation traces + * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + * from INRIA Rhone-Alpes. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + + + +package ui.verificationpd; + + +import ui.*; +import ui.verificationpd.VerificationPropertyGeneric; + +/** + * Class VerificationPropertySafety + * Safety verification tracking + * Creation: 10/04/2019 + * @version 1.0 10/04/2019 + * @author Ludovic APVRILLE + */ +public class VerificationPropertySafety extends VerificationPropertyGeneric { + + + public VerificationPropertySafety(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { + super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); + + initScaling(180, 70); + + nbConnectingPoint = 0; + connectingPoint = new TGConnectingPoint[nbConnectingPoint]; + //connectingPoint[0] = new SysmlsecMethodologyConnectingPoint(this, 0, 0, false, true, 0.5, 0, TGConnectingPoint.WEST); + + typeOfReference = PROPERTY; + + addTGConnectingPointsCommentTop(); + + } + + public int getType() { + return TGComponentManager.SYSMLSEC_METHODOLOGY_REF_PROPERTIES; + } + + public boolean isAValidPanelType(TURTLEPanel panel) { + return panel instanceof AvatarRequirementPanel; + + } + + + +} diff --git a/src/main/java/verification/Property.java b/src/main/java/verification/Property.java index b2c31289b4570801b59ef9fb18f203b7db969e0b..518e4cb4b1cb77e0c279e85f357055218ea6ba0d 100644 --- a/src/main/java/verification/Property.java +++ b/src/main/java/verification/Property.java @@ -45,6 +45,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; import java.net.URL; +import java.util.Date; import java.util.Vector; @@ -63,10 +64,10 @@ public class Property { public PropertyResultType resultType; public String result; public Object reference; - + public Date date; public Property() { - + date = new Date(); } }