1 19 package org.openharmonise.him.metadata.range.swing; 20 21 import java.awt.Component ; 22 23 import javax.swing.JPanel ; 24 25 import org.openharmonise.him.metadata.swing.*; 26 import org.openharmonise.vfs.metadata.*; 27 28 29 37 public abstract class AbstractRangeDisplay extends JPanel { 38 39 42 private PropertyInstance m_propInstance = null; 43 44 47 private boolean m_bReadOnly = false; 48 49 54 public AbstractRangeDisplay(PropertyInstance propInstance) { 55 super(); 56 m_propInstance = propInstance; 57 } 58 59 65 public PropertyInstance getPropertyInstance() { 66 return this.m_propInstance; 67 } 68 69 72 public void setEnabled(boolean bEnabled) { 73 if(!this.m_bReadOnly) { 74 super.setEnabled(bEnabled); 75 for (int i = 0; i < this.getComponentCount(); i++) { 76 Component comp = this.getComponent(i); 77 comp.setEnabled(bEnabled); 78 } 79 } else { 80 super.setEnabled(false); 81 for (int i = 0; i < this.getComponentCount(); i++) { 82 Component comp = this.getComponent(i); 83 comp.setEnabled(false); 84 } 85 } 86 } 87 88 93 public void setReadOnly(boolean bReadOnly) { 94 if(bReadOnly) { 95 this.setEnabled(false); 96 this.m_bReadOnly = true; 97 } 98 } 99 100 105 public boolean isReadOnly() { 106 return this.m_bReadOnly; 107 } 108 109 116 public abstract boolean isMetadataValid(); 117 118 122 protected void validateTab() { 123 Component comp = this; 124 while(comp!=null && !(comp instanceof MetadataTabPanel)) { 125 comp = comp.getParent(); 126 } 127 128 if(comp!=null && comp instanceof MetadataTabPanel) { 129 ((MetadataTabPanel) comp).checkValid(); 130 } 131 } 132 133 138 public boolean isResizeWidthEnabled() { 139 return true; 140 } 141 142 } 143 | Popular Tags |