1 19 package org.netbeans.modules.form.assistant; 20 21 import java.beans.*; 22 import java.util.*; 23 24 29 public class AssistantModel { 30 private PropertyChangeSupport support; 31 private String context; 32 private String additionalContext; 33 private Object [] parameters; 34 35 public AssistantModel() { 36 support = new PropertyChangeSupport(this); 37 } 38 39 public String getContext() { 40 return context; 41 } 42 43 public String getAdditionalContext() { 44 return additionalContext; 45 } 46 47 public Object [] getParameters() { 48 return parameters; 49 } 50 51 public void setContext(String context) { 52 setContext(context, (String )null); 53 } 54 55 public void setContext(String context, String additionalContext) { 56 this.context = context; 57 this.additionalContext = additionalContext; 58 this.parameters = null; 59 fireContextChange(); 60 } 61 62 public void setContext(String context, Object [] parameters) { 63 this.context = context; 64 this.additionalContext = null; 65 this.parameters = parameters; 66 fireContextChange(); 67 } 68 69 private void fireContextChange() { 70 support.firePropertyChange("context", null, null); } 72 73 public String [] getMessages() { 74 return AssistantMessages.getDefault().getMessages(context); 75 } 76 77 public String [] getAdditionalMessages() { 78 return AssistantMessages.getDefault().getMessages(additionalContext); 79 } 80 81 public void addPropertyChangeListener(PropertyChangeListener listener) { 83 support.addPropertyChangeListener(listener); 84 } 85 86 public void removePropertyChangeListener(PropertyChangeListener listener) { 87 support.removePropertyChangeListener(listener); 88 } 89 90 } 91 | Popular Tags |