예제 #1
0
 public void removeAttribute(String attributeName) {
   try {
     VEXElement element = this.getCurrentElement();
     if (element.getAttribute(attributeName) != null) {
       element.removeAttribute(attributeName);
     }
   } catch (DocumentValidationException ex) {
     ex.printStackTrace(); // TODO: when can this happen?
   }
 }
예제 #2
0
 public void deleteSelection() {
   try {
     if (this.hasSelection()) {
       this.document.delete(this.getSelectionStart(), this.getSelectionEnd());
       this.moveTo(this.getSelectionStart());
     }
   } catch (DocumentValidationException ex) {
     ex.printStackTrace(); // This should never happen, because we
     // constrain the selection
   }
 }
예제 #3
0
 public void setAttribute(String attributeName, String value) {
   try {
     VEXElement element = this.getCurrentElement();
     if (value == null) {
       this.removeAttribute(attributeName);
     } else if (!value.equals(element.getAttribute(attributeName))) {
       element.setAttribute(attributeName, value);
     }
   } catch (DocumentValidationException ex) {
     ex.printStackTrace(); // TODO: mebbe throw the exception instead
   }
 }