1 30 package com.genimen.djeneric.tools.specifier.components; 31 32 import javax.swing.JComponent ; 33 import javax.swing.JLabel ; 34 35 import com.genimen.djeneric.repository.exceptions.DjenericException; 36 import com.genimen.djeneric.tools.specifier.interfaces.ObjectViewer; 37 38 public class DjLabel extends JLabel implements DjBindable 39 { 40 private static final long serialVersionUID = 1L; 41 private BindingMediator _mediator; 42 43 public DjLabel(ObjectViewer viewer, String propertyName) throws DjenericException 44 { 45 super(); 46 _mediator = new BindingMediator(this, viewer, propertyName); 47 } 48 49 public void clear() 50 { 51 setText(""); 52 } 53 54 public void apply() 55 { 56 } 58 59 public boolean isComponentWritable() 60 { 61 return _mediator.isComponentWritable(); 62 } 63 64 public void setPropertyName(String propertyName) throws DjenericException 65 { 66 _mediator.setPropertyName(propertyName); 67 } 68 69 public void setViewer(ObjectViewer viewer) 70 { 71 _mediator.setViewer(viewer); 72 } 73 74 public void synchronize() throws DjenericException 75 { 76 setText(_mediator.getPropertyValueString()); 77 } 78 79 public Object getDisplayedValue() 80 { 81 return getText(); 82 } 83 84 public String getPropertyName() 85 { 86 return _mediator.getPropertyName(); 87 } 88 89 public JComponent getFocussableComponent() 90 { 91 return this; 92 } 93 } | Popular Tags |