00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 package org.objectweb.cjdbc.console.gui.objects;
00026
00027 import java.awt.Color;
00028
00029 import org.objectweb.cjdbc.console.gui.constants.GuiConstants;
00030 import org.objectweb.cjdbc.console.gui.constants.GuiIcons;
00031
00032
00033
00034
00035
00036
00037
00038 public class DatabaseObject extends AbstractGuiObject
00039 {
00040 private String state;
00041 private String controllerName;
00042 private boolean isDistributed;
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 public DatabaseObject(String databaseName, String controllerName,
00053 boolean isDistributed)
00054 {
00055 super();
00056 setText(databaseName);
00057 setName(databaseName);
00058 this.controllerName = controllerName;
00059 this.isDistributed = isDistributed;
00060 setBackground(Color.white);
00061 if (isDistributed)
00062 setIcon(GuiIcons.DATABASE_DISTRIBUTED_ICON);
00063 else
00064 setIcon(GuiIcons.DATABASE_SINGLE_ICON);
00065 }
00066
00067
00068
00069
00070
00071
00072 public String getIpAdress()
00073 {
00074 return controllerName.substring(0, controllerName.indexOf(':'));
00075 }
00076
00077
00078
00079
00080
00081
00082 public String getPort()
00083 {
00084 return controllerName.substring(controllerName.indexOf(':') + 1);
00085 }
00086
00087
00088
00089
00090
00091
00092 public String getState()
00093 {
00094 return state;
00095 }
00096
00097
00098
00099
00100
00101
00102 public void setState(String state)
00103 {
00104 if (state.equals(GuiConstants.CONTROLLER_STATE_UP))
00105 setIcon(GuiIcons.CONTROLLER_READY);
00106 else
00107 setIcon(GuiIcons.CONTROLLER_DOWN);
00108 this.state = state;
00109 }
00110
00111
00112
00113
00114
00115
00116 public String getControllerName()
00117 {
00118 return controllerName;
00119 }
00120
00121
00122
00123
00124
00125
00126 public boolean isDistributed()
00127 {
00128 return isDistributed;
00129 }
00130
00131
00132
00133
00134
00135
00136 public void setDistributed(boolean isDistributed)
00137 {
00138 this.isDistributed = isDistributed;
00139 }
00140 }