1 19 20 package org.apache.excalibur.instrument.client; 21 22 import javax.swing.ImageIcon ; 23 24 27 class InstrumentableNodeData 28 extends NodeData 29 { 30 31 private static final ImageIcon m_iconInstrumentableConf; 32 33 34 private static final ImageIcon m_iconInstrumentableReg; 35 36 38 private static final ImageIcon m_iconInstrumentableRegConf; 39 40 42 private static final ImageIcon m_iconInstrumentableOld; 43 44 private InstrumentableData m_data; 45 46 private boolean m_configured; 47 private boolean m_registered; 48 49 52 static 53 { 54 ClassLoader cl = InstrumentManagerTreeCellRenderer.class.getClassLoader(); 56 m_iconInstrumentableConf = 57 new ImageIcon ( cl.getResource( MEDIA_PATH + "instrumentable_conf.gif") ); 58 m_iconInstrumentableReg = 59 new ImageIcon ( cl.getResource( MEDIA_PATH + "instrumentable_reg.gif") ); 60 m_iconInstrumentableRegConf = 61 new ImageIcon ( cl.getResource( MEDIA_PATH + "instrumentable_reg_conf.gif") ); 62 m_iconInstrumentableOld = 63 new ImageIcon ( cl.getResource( MEDIA_PATH + "instrumentable_old.gif") ); 64 } 65 66 69 InstrumentableNodeData( InstrumentableData data ) 70 { 71 m_data = data; 72 73 update(); 74 } 75 76 79 84 ImageIcon getIcon() 85 { 86 ImageIcon icon; 87 if ( isConfigured() && isRegistered() ) 88 { 89 icon = m_iconInstrumentableRegConf; 90 } 91 else if ( isConfigured() ) 92 { 93 icon = m_iconInstrumentableConf; 94 } 95 else if ( isRegistered() ) 96 { 97 icon = m_iconInstrumentableReg; 98 } 99 else 100 { 101 icon = m_iconInstrumentableOld; 102 } 103 104 return icon; 105 } 106 107 112 String getToolTipText() 113 { 114 String text; 115 if ( isConfigured() && isRegistered() ) 116 { 117 text = "Registered and Configured Instrumentable"; 118 } 119 else if ( isConfigured() ) 120 { 121 text = "Configured but unregistered Instrumentable"; 122 } 123 else if ( isRegistered() ) 124 { 125 text = "Registered Instrumentable"; 126 } 127 else 128 { 129 text = "Old Instrumentable loaded from state file"; 130 } 131 132 return text; 133 } 134 135 138 InstrumentableData getData() 139 { 140 return m_data; 141 } 142 143 boolean isConfigured() 144 { 145 return m_configured; 146 } 147 148 boolean isRegistered() 149 { 150 return m_registered; 151 } 152 153 157 boolean update() 158 { 159 boolean changed = false; 160 changed |= update( m_data.getName(), m_data.getDescription(), m_data.getStateVersion() ); 161 162 boolean newConfigured = m_data.isConfigured(); 163 if ( newConfigured != m_configured ) 164 { 165 changed = true; 166 m_configured = newConfigured; 167 } 168 169 boolean newRegistered = m_data.isRegistered(); 170 if ( newRegistered != m_registered ) 171 { 172 changed = true; 173 m_registered = newRegistered; 174 } 175 176 return changed; 177 } 178 } 179 | Popular Tags |