use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode in project cubrid-manager by CUBRID.
the class DatabaseDataProvider method setDefaultValue.
/**
*
* Set default value
*
*/
private void setDefaultValue() {
boolean isOldExecuteStandbyStaTask = isExecuteStandbyStaTask;
boolean isOldExecuteDbProcessTask = isExecuteDbProcessTask;
isExecuteStandbyStaTask = false;
isExecuteDbDumpTask = false;
isExecuteDbProcessTask = false;
errorMsg = "";
DBStatusType statusType = dbStatusInfo == null ? DBStatusType.UNKNOWN : dbStatusInfo.getStatusType();
boolean isDatabaseStarted = DBStatusType.isDbStarted(statusType);
HostNode hostNode = dbNode.getParent();
if (hostNode != null && hostNode.isConnected()) {
List<DataUpdateListener> listenerList = generator.getListeners();
for (DataUpdateListener listener : listenerList) {
HANode node = listener.getModel();
if (!dbNode.equals(node)) {
continue;
}
if (listener instanceof DatabaseMonitorPartHelper || listener instanceof DatabaseDashboardViewPart) {
isExecuteDbProcessTask = isDatabaseStarted;
isExecuteStandbyStaTask = statusType == DBStatusType.STANDBY || statusType == DBStatusType.MAINTENANCE;
}
if (listener instanceof DatabaseDashboardViewPart) {
isExecuteDbDumpTask = isDatabaseStarted;
}
}
}
if (isOldExecuteStandbyStaTask != isExecuteStandbyStaTask) {
standyServerStatRequestCount = 0;
}
if (isOldExecuteDbProcessTask != isExecuteDbProcessTask) {
dbProcRequestCount = 0;
}
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode in project cubrid-manager by CUBRID.
the class HANodePart 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() {
HANode node = (HANode) getModel();
Point loc = node.getLocation();
((AbstractMonitorFigure) getFigure()).setMinimized(isMinimized());
//figure's size is stable
Rectangle rectangle = new Rectangle(loc, figure.getSize());
GraphicalEditPart graphicalEditPart = (GraphicalEditPart) getParent();
graphicalEditPart.setLayoutConstraint(this, getFigure(), rectangle);
getFigure().repaint();
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode in project cubrid-manager by CUBRID.
the class EditAliasNameAction method run.
/**
* Edit alias name
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
Object[] objArr = this.getSelectedObj();
if (objArr == null || objArr.length <= 0 || !isSupported(objArr[0])) {
setEnabled(false);
return;
}
HANode haNode = null;
if (objArr[0] instanceof HostMonitorPart) {
HostMonitorPart hostMonPart = (HostMonitorPart) objArr[0];
haNode = (HANode) hostMonPart.getModel();
} else if (objArr[0] instanceof DatabaseMonitorPart) {
DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) objArr[0];
haNode = (HANode) dbMonPart.getModel();
} else if (objArr[0] instanceof BrokerMonitorPart) {
BrokerMonitorPart brokerMonPart = (BrokerMonitorPart) objArr[0];
haNode = (HANode) brokerMonPart.getModel();
} else if (objArr[0] instanceof ClientMonitorPart) {
ClientMonitorPart clientMonitorPart = (ClientMonitorPart) objArr[0];
haNode = (HANode) clientMonitorPart.getModel();
} else if (objArr[0] instanceof BrokerDBListMonitorPart) {
BrokerDBListMonitorPart brokerDBListMonitorPart = (BrokerDBListMonitorPart) objArr[0];
haNode = (HANode) brokerDBListMonitorPart.getModel();
}
if (haNode == null) {
return;
}
InputDialog dialog = new InputDialog(getShell(), Messages.titleEditNickNameDialog, Messages.msgEditNickNameDialog, haNode.getName(), new IInputValidator() {
public String isValid(String newText) {
if (newText == null || newText.trim().length() == 0) {
return Messages.errEditNickName;
}
return null;
}
});
if (IDialogConstants.OK_ID == dialog.open()) {
String aliasName = dialog.getValue();
haNode.setName(aliasName);
}
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode in project cubrid-manager by CUBRID.
the class HAUtil method calcLocation.
/**
*
* Calculate the location
*
* @param hostNodeList List<HostNode>
* @param maxY The max y point
*/
private static void calcLocation(List<HostNode> hostNodeList, int maxY) {
int hostX = LEFT_DISTANCE;
int hostY = TOP_DISTANCE + maxY;
for (HostNode hostNode : hostNodeList) {
Dimension hostDimension = hostNode.getSize();
int nodeHeight = 0;
List<HANode> haNodeList = new ArrayList<HANode>();
haNodeList.addAll(hostNode.getDbNodeList());
haNodeList.addAll(hostNode.getBrokerNodeList());
int size = haNodeList.size();
if (size > 0) {
int dbX = LEFT_DISTANCE;
int dbY = hostY + hostDimension.height + HEIGHT_DISTANCE;
for (int i = 0; i < size; i++) {
HANode haNode = haNodeList.get(i);
Dimension dbDimension = haNode.getSize();
if (dbDimension.height > nodeHeight) {
nodeHeight = dbDimension.height;
}
Point dbLocation = new Point(dbX, dbY);
haNode.setLocation(dbLocation);
dbX = dbX + dbDimension.width + WIDTH_DISTANCE;
}
hostX = dbX / 2 - hostDimension.width / 2;
}
hostNode.setLocation(new Point(hostX, hostY));
if (nodeHeight == 0) {
hostY = hostY + hostDimension.height + TOP_DISTANCE;
} else {
hostY = hostY + hostDimension.height + HEIGHT_DISTANCE + nodeHeight + TOP_DISTANCE;
}
}
}
Aggregations