1 24 25 package org.objectweb.cjdbc.console.gui.objects; 26 27 import java.awt.Color ; 28 29 import org.objectweb.cjdbc.console.gui.constants.GuiConstants; 30 import org.objectweb.cjdbc.console.gui.constants.GuiIcons; 31 32 38 public class ControllerObject extends AbstractGuiObject 39 { 40 private String state; 41 42 47 public ControllerObject(String name) 48 { 49 super(); 50 setText(name); 51 setName(name); 52 setBackground(Color.white); 53 } 54 55 60 public String getIpAdress() 61 { 62 return getName().substring(0, getName().indexOf(':')); 63 } 64 65 70 public String getPort() 71 { 72 return getName().substring(getName().indexOf(':') + 1); 73 } 74 75 80 public String getState() 81 { 82 return state; 83 } 84 85 90 public void setState(String state) 91 { 92 if (state.equals(GuiConstants.CONTROLLER_STATE_UP)) 93 { 94 setIcon(GuiIcons.CONTROLLER_READY); 95 setEnabled(true); 96 } 97 else 98 { 99 setIcon(GuiIcons.CONTROLLER_DOWN); 100 } 102 this.state = state; 103 } 104 } | Popular Tags |