use of com.cubrid.common.ui.decorator.DecoratedImage in project cubrid-manager by CUBRID.
the class NavigatorTreeLabelProvider method decorateDatabaseImgae.
/**
* Decorate the database image
*
* @param label
* @param server
* @return
*/
private Image decorateDatabaseImgae(Image baseImage, CubridDatabase database) {
CubridServer server = database.getServer();
HAHostStatusInfo haHostStatusInfo = server.getServerInfo().getHaHostStatusInfo();
HADatabaseStatusInfo haDatabaseStatusInfo = HAUtil.getHADatabaseStatusInfo(database.getName(), haHostStatusInfo, server.getServerInfo());
List<String> haNodeList = HAUtil.getAllHaDBList(server.getServerInfo());
server.getLoader().setLoaded(true);
if (haNodeList.contains(database.getName())) {
DBStatusType statusType = haDatabaseStatusInfo.getStatusType();
if (DBStatusType.ACTIVE.equals(statusType)) {
DecoratedImage decoratedImage = decoratorManager.decorate(baseImage, "HADatabase", null, null, null, null, null, null, imgDecMaster, "Active");
return decoratedImage.getDecoratedImage();
}
if (DBStatusType.STANDBY.equals(statusType)) {
DecoratedImage decoratedImage = decoratorManager.decorate(baseImage, "HADatabase", null, null, null, null, null, null, imgDecSlave, "Standby");
return decoratedImage.getDecoratedImage();
}
}
return baseImage;
}
Aggregations