1 10 11 package org.enhydra.jawe; 12 13 import org.enhydra.jawe.graph.*; 14 15 import java.util.*; 16 import java.awt.*; 17 import javax.swing.*; 18 19 22 public class JaWEStatusBar extends JPanel { 23 24 private AbstractEditor editor; 25 26 private JLabel message; 27 28 public JaWEStatusBar(AbstractEditor editor) { 29 super(); 30 this.editor=editor; 31 setLayout(new BorderLayout()); 32 message = new JLabel(" "); 33 message.setBorder(BorderFactory.createLoweredBevelBorder()); 34 add(message,BorderLayout.CENTER); 35 } 36 37 public void updateMessage () { 38 if (!JaWEConfig.getInstance().getStatusBarStatus()) { 39 return; 40 } 41 if (!JaWEConfig.getInstance().getValidationStatus()) { 42 message.setText(ResourceManager.getLanguageDependentString("MessageValidationIsTurnedOff")); 43 return; 44 } 45 boolean isSchemaValidationError=!editor.getGraph().validateAgainsXPDLSchema(); 46 boolean isConnectionError=false; 47 boolean isGraphConformanceError=false; 48 boolean isLogicError=false; 49 if (!isSchemaValidationError) { 50 isConnectionError=!editor.getGraph().checkConnections(false); 51 } 52 if (!isConnectionError) { 53 isGraphConformanceError=!editor.getGraph().checkGraphConformance(false); 54 } 55 if (!(isConnectionError || isGraphConformanceError)) { 56 isLogicError=!editor.getGraph().checkLogic(false); 57 } 58 boolean isModelOK=!(isSchemaValidationError || isConnectionError || 59 isGraphConformanceError || isLogicError); 60 String msg=""; 61 if (editor instanceof PackageEditor) { 62 if (isModelOK) { 63 msg=ResourceManager.getLanguageDependentString("InformationPackageIsValid"); 64 } else { 65 if (isSchemaValidationError) { 66 msg=editor.getGraph().getBasicXPDLSchemaValidationErrorMessage(); 67 } else if (isConnectionError) { 68 msg=editor.getGraph().getBasicConnectionErrorMessage(); 69 } else if (isGraphConformanceError) { 70 msg=editor.getGraph().getBasicGraphConformanceErrorMessages().get(0).toString(); 71 if (msg.length()==0) { 72 msg="SWR1"; 73 } 74 } else { 75 msg=editor.getGraph().getBasicLogicErrorMessage(); 76 } 77 } 78 } else { 79 if (isModelOK) { 80 if (editor instanceof BlockActivityEditor) { 81 msg=ResourceManager.getLanguageDependentString("InformationBlockIsValid"); 82 } else { 83 msg=ResourceManager.getLanguageDependentString("InformationProcessIsValid"); 84 } 85 } else { 86 if (isSchemaValidationError) { 87 msg=editor.getGraph().getBasicXPDLSchemaValidationErrorMessage(); 88 } else if (isConnectionError) { 89 msg=editor.getGraph().getBasicConnectionErrorMessage(); 90 } else if (isGraphConformanceError) { 91 msg=editor.getGraph().getBasicGraphConformanceErrorMessages().get(0).toString(); 92 if (msg.length()==0) { 93 msg="SWR2"; 94 } 95 } else { 96 msg=editor.getGraph().getBasicLogicErrorMessage(); 97 } 98 } 99 } 100 101 message.setText(msg); 102 } 103 104 107 public String getMessage() { 108 return message.getText() ; 109 } 110 111 114 public void setMessage (String message) { 115 this.message.setText(message); 116 } 117 118 } 119 | Popular Tags |