Search in sources :

Example 1 with DecoratedImage

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;
}
Also used : DecoratedImage(com.cubrid.common.ui.decorator.DecoratedImage) HAHostStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo) DBStatusType(com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType) StyledString(org.eclipse.jface.viewers.StyledString) CubridServer(com.cubrid.common.ui.spi.model.CubridServer) HADatabaseStatusInfo(com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)

Aggregations

DecoratedImage (com.cubrid.common.ui.decorator.DecoratedImage)1 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 DBStatusType (com.cubrid.cubridmanager.core.mondashboard.model.DBStatusType)1 HADatabaseStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HADatabaseStatusInfo)1 HAHostStatusInfo (com.cubrid.cubridmanager.core.mondashboard.model.HAHostStatusInfo)1 StyledString (org.eclipse.jface.viewers.StyledString)1