1 32 33 package it.businesslogic.ireport.gui.sheet; 34 35 import it.businesslogic.ireport.ExpressionContext; 36 import javax.swing.*; 37 38 public class ExpressionSheetProperty extends SheetProperty { 39 40 private ExpressionSheetPropertyComponent editor = null; 41 private boolean plainTextEditor = false; 42 43 public ExpressionSheetProperty(String key, String name) { 44 super( key, name, SheetProperty.STRING, ""); 45 } 46 47 public JComponent getEditor() 48 { 49 if (editor != null) return editor; 50 editor = new ExpressionSheetPropertyComponent(); 51 editor.addActionListener( this ); 52 return editor; 53 } 54 55 public Object getEditorValue(JComponent component) 56 { 57 return editor.getExpression(); 58 } 59 60 public void setEditorValue(JComponent component, Object str) 61 { 62 try { 63 getEditor(); 65 if (str != null) 66 { 67 editor.setExpression(""+str); 68 } 69 else 70 { 71 editor.setExpression(""); 72 } 73 } catch (Exception ex) {} 74 } 75 76 public void setExpressionContext(ExpressionContext ex) 77 { 78 ((ExpressionSheetPropertyComponent)getEditor()).setExpressionContext(ex); 79 } 80 81 public boolean isPlainTextEditor() { 82 return plainTextEditor; 83 } 84 85 public void setPlainTextEditor(boolean plainTextEditor) { 86 ((ExpressionSheetPropertyComponent)getEditor()).setPlainTextEditor(plainTextEditor); 87 } 88 } 89 | Popular Tags |