use of com.cubrid.cubridmanager.ui.replication.editor.model.LeafNode in project cubrid-manager by CUBRID.
the class ReplicationEditor method initConnection.
/**
* initialize the connection
*
*/
private void initConnection() {
if (diagram != null) {
MasterNode master = null;
DistributorNode dist = null;
SlaveNode slave = null;
List<ContainerNode> containerNodeList = diagram.getChildNodeList();
for (int i = 0; containerNodeList != null && i < containerNodeList.size(); i++) {
ContainerNode containerNode = containerNodeList.get(i);
if (containerNode != null) {
List<LeafNode> leafNodeList = containerNode.getChildNodeList();
for (int j = 0; j < leafNodeList.size(); j++) {
LeafNode leafNode = leafNodeList.get(j);
if (leafNode instanceof MasterNode) {
master = (MasterNode) leafNode;
} else if (leafNode instanceof DistributorNode) {
dist = (DistributorNode) leafNode;
}
}
}
}
//connection from master to dist
if (master != null && dist != null) {
new ArrowConnection(master, dist);
}
for (int i = 0; containerNodeList != null && i < containerNodeList.size(); i++) {
ContainerNode containerNode = containerNodeList.get(i);
if (containerNode != null) {
List<LeafNode> leafNodeList = containerNode.getChildNodeList();
for (int j = 0; j < leafNodeList.size(); j++) {
LeafNode leafNode = leafNodeList.get(j);
if (leafNode instanceof SlaveNode) {
slave = (SlaveNode) leafNode;
//connection from dist to slave
if (dist != null && slave != null) {
new ArrowConnection(dist, slave);
}
}
}
}
}
}
}
use of com.cubrid.cubridmanager.ui.replication.editor.model.LeafNode in project cubrid-manager by CUBRID.
the class SetDistributorDbInfoDialog method checkDatabaseExist.
/**
* Check whether the database exist
*
* @param dbName the database name
* @return <code>true</code> if already exist;<code>false</code> otherwise
*/
private boolean checkDatabaseExist(String dbName) {
boolean isDatabaseExist = false;
List<DatabaseInfo> databaseInfoList = hostNode.getDatabaseInfoList();
for (int i = 0; databaseInfoList != null && i < databaseInfoList.size(); i++) {
DatabaseInfo databaseInfo = databaseInfoList.get(i);
if (dbName.equalsIgnoreCase(databaseInfo.getDbName())) {
isDatabaseExist = true;
break;
}
}
if (!isDatabaseExist) {
List<LeafNode> childNodeList = hostNode.getChildNodeList();
for (int i = 0; childNodeList != null && i < childNodeList.size(); i++) {
LeafNode node = childNodeList.get(i);
if (dbName.equalsIgnoreCase(node.getName()) && !dbName.equals(distributorNode.getDbName())) {
isDatabaseExist = true;
break;
}
}
}
return isDatabaseExist;
}
use of com.cubrid.cubridmanager.ui.replication.editor.model.LeafNode in project cubrid-manager by CUBRID.
the class DeleteNodeCommand method undo.
/**
* @see org.eclipse.gef.commands.Command#undo()
*/
public void undo() {
if (parent instanceof Diagram) {
Diagram diagram = (Diagram) parent;
diagram.addNode((ContainerNode) node);
} else if (parent instanceof ContainerNode) {
ContainerNode containerNode = (ContainerNode) parent;
containerNode.addChildNode((LeafNode) node);
}
}
use of com.cubrid.cubridmanager.ui.replication.editor.model.LeafNode in project cubrid-manager by CUBRID.
the class ContainerNodeLayoutEditPolicy method getCreateCommand.
/**
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
* @param request the CreateRequest
* @return a Command to perform a create
*
*/
protected Command getCreateCommand(CreateRequest request) {
if (!(request.getNewObject() instanceof LeafNode)) {
return null;
}
CreateLeafNodeCommand cmd = new CreateLeafNodeCommand();
cmd.setContainerNode((ContainerNode) getHost().getModel());
cmd.setLeafNode((LeafNode) request.getNewObject());
Rectangle constraint = (Rectangle) getConstraintFor(request);
cmd.setLocation(constraint.getLocation());
return cmd;
}
use of com.cubrid.cubridmanager.ui.replication.editor.model.LeafNode in project cubrid-manager by CUBRID.
the class ContainerNodePart method getModelSourceConnections.
/**
* @see com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart#getModelSourceConnections()
* @return list
*/
protected List<ArrowConnection> getModelSourceConnections() {
List<ArrowConnection> list = new ArrayList<ArrowConnection>();
list.addAll(getContainerNode().getOutgoingConnections());
for (Iterator<LeafNode> iter = getContainerNode().getChildNodeList().iterator(); iter.hasNext(); ) {
LeafNode node = iter.next();
list.addAll(node.getOutgoingConnections());
}
return list;
}
Aggregations