use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.
the class ClientMonitorPart method refreshVisuals.
/**
* Refreshes this EditPart's <i>visuals</i>. This method is called by
* {@link #refresh()}, and may also be called in response to notifications
* from the model.
*/
protected void refreshVisuals() {
ClientFigure figure = (ClientFigure) this.getFigure();
ClientNode clientNode = (ClientNode) this.getModel();
figure.setName(clientNode.getName());
figure.setClients(clientNode.getClientList());
BrokerNode broker = clientNode.getBrokerNode();
if (broker != null) {
figure.setHostConnected(broker.getParent().isConnected());
}
super.refreshVisuals();
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.
the class ClientMonitorPart method createFigure.
/**
* get a database monitor figure.
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
* @return a database figure
*/
protected IFigure createFigure() {
ClientFigure figure = new ClientFigure();
ClientNode modelNode = (ClientNode) getModel();
figure.setName(modelNode.getName());
return figure;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.
the class ShowBrokerClientAction method run.
/**
* Create a new figure in dashboard.
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
IStructuredSelection selection = (IStructuredSelection) getSelection();
BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
DashboardPart dp = (DashboardPart) cmp.getParent();
Dashboard db = (Dashboard) dp.getModel();
BrokerNode model = (BrokerNode) cmp.getModel();
ClientNode clientNode = db.getClientNodeByBroker(model);
if (this.isChecked()) {
if (null == clientNode) {
clientNode = new ClientNode();
clientNode.setBrokerNode(model);
db.addClientNode(clientNode);
}
clientNode.setVisible(true);
} else {
clientNode.setVisible(false);
}
db.refresh();
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.
the class ShowBrokerClientAction method isSupported.
/**
* Always support
*
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
* @param obj Object
* @return boolean support:true;not support:false;
*/
public boolean isSupported(Object obj) {
IStructuredSelection selection = (IStructuredSelection) getSelection();
if (!(selection.getFirstElement() instanceof BrokerMonitorPart)) {
return false;
}
BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
DashboardPart dp = (DashboardPart) cmp.getParent();
Dashboard db = (Dashboard) dp.getModel();
BrokerNode model = (BrokerNode) cmp.getModel();
ClientNode clientNode = db.getClientNodeByBroker(model);
setChecked(null != clientNode && clientNode.isVisible());
return true;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.
the class MonitorDashboardPersistManager method saveDashboard.
/**
*
* Save dash boards
*
*/
public void saveDashboard() {
synchronized (this) {
XMLMemento memento = XMLMemento.createWriteRoot("dashboards");
Iterator<ICubridNode> iterator = monitorDashboardList.iterator();
while (iterator.hasNext()) {
ICubridNode node = (ICubridNode) iterator.next();
if (node instanceof MonitorStatistic) {
continue;
}
Dashboard dashboard = (Dashboard) node.getAdapter(Dashboard.class);
IXMLMemento dashboardChild = memento.createChild("dashboard");
dashboardChild.putString("name", node.getName());
Iterator<HostNode> nodeIte = dashboard.getHostNodeList().iterator();
while (nodeIte.hasNext()) {
//save host node
HostNode hostNode = nodeIte.next();
IXMLMemento hostNodeChild = dashboardChild.createChild("host");
hostNodeChild.putString("aliasname", hostNode.getName());
hostNodeChild.putString("ip", hostNode.getIp());
hostNodeChild.putString("port", hostNode.getPort());
hostNodeChild.putString("username", hostNode.getUserName());
hostNodeChild.putString("password", CipherUtils.encrypt(hostNode.getPassword()));
hostNodeChild.putString("location", hostNode.getLocation().x + "," + hostNode.getLocation().y);
hostNodeChild.putString("visible", hostNode.isVisible() ? "true" : "false");
//save the database node list
List<DatabaseNode> dbNodeList = hostNode.getDbNodeList();
Iterator<DatabaseNode> dbNodeIte = dbNodeList.iterator();
while (dbNodeIte.hasNext()) {
DatabaseNode dbNode = (DatabaseNode) dbNodeIte.next();
IXMLMemento databaseNodeChild = hostNodeChild.createChild("database");
databaseNodeChild.putString("aliasname", dbNode.getName());
databaseNodeChild.putString("dbname", dbNode.getDbName());
databaseNodeChild.putString("username", dbNode.getDbUser());
databaseNodeChild.putString("password", CipherUtils.encrypt(dbNode.getDbPassword()));
databaseNodeChild.putString("location", dbNode.getLocation().x + "," + dbNode.getLocation().y);
}
//save broker node list
List<BrokerNode> brokerNodeList = hostNode.getBrokerNodeList();
Iterator<BrokerNode> brokerNodeIte = brokerNodeList.iterator();
while (brokerNodeIte.hasNext()) {
BrokerNode brokerNode = (BrokerNode) brokerNodeIte.next();
IXMLMemento brokerNodeChild = hostNodeChild.createChild("broker");
brokerNodeChild.putString("aliasname", brokerNode.getName());
brokerNodeChild.putString("brokername", brokerNode.getBrokerName());
brokerNodeChild.putString("location", brokerNode.getLocation().x + "," + brokerNode.getLocation().y);
//save the client IP list
ClientNode ipListNode = dashboard.getClientNodeByBroker(brokerNode);
Point point = null;
String clientIpName = null;
if (ipListNode == null) {
brokerNodeChild.putString("show_ip_list", "false");
point = brokerNode.getClientsLocation();
} else {
brokerNodeChild.putString("show_ip_list", ipListNode.isVisible() ? "true" : "false");
point = ipListNode.getLocation();
clientIpName = ipListNode.getName();
}
if (point != null) {
brokerNodeChild.putString("client_ip_location", point.x + "," + point.y);
}
if (clientIpName != null) {
brokerNodeChild.putString("client_ip_name", clientIpName);
}
//save the database list
BrokerDBListNode dbListNode = dashboard.getBrokerDBListNodeByBroker(brokerNode);
String clientDbName = null;
if (dbListNode == null) {
brokerNodeChild.putString("show_db_list", "false");
point = brokerNode.getDatabasesLocation();
} else {
brokerNodeChild.putString("show_db_list", dbListNode.isVisible() ? "true" : "false");
point = dbListNode.getLocation();
clientDbName = dbListNode.getName();
}
if (point != null) {
brokerNodeChild.putString("client_db_location", point.x + "," + point.y);
}
if (clientDbName != null) {
brokerNodeChild.putString("client_db_name", clientDbName);
}
}
}
}
PersistUtils.saveXMLMemento(CubridManagerUIPlugin.PLUGIN_ID, MONITOR_DASHBOARD_XML_CONTENT, memento);
}
}
Aggregations