Search in sources :

Example 1 with AbstractSafeHtmlColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn in project ovirt-engine by oVirt.

the class SubTabClusterNetworkView method createNetRoleColumn.

private AbstractSafeHtmlColumn<Network> createNetRoleColumn() {
    return new AbstractSafeHtmlColumn<Network>() {

        @Override
        public SafeHtml getValue(Network network) {
            List<SafeHtml> images = new LinkedList<>();
            final NetworkCluster networkCluster = network.getCluster();
            if (networkCluster != null) {
                images.add(thisOrEmptyImage(networkCluster.isManagement(), managementImage));
                images.add(thisOrEmptyImage(networkCluster.isDisplay(), displayImage));
                images.add(thisOrEmptyImage(networkCluster.isMigration(), migrationImage));
                images.add(thisOrEmptyImage(network.getCluster().isGluster(), glusterNwImage));
                images.add(thisOrEmptyImage(networkCluster.isDefaultRoute(), defaultRouteImage));
            }
            return MultiImageColumnHelper.getValue(images);
        }

        @Override
        public SafeHtml getTooltip(Network network) {
            Map<SafeHtml, String> imagesToText = new LinkedHashMap<>();
            final NetworkCluster networkCluster = network.getCluster();
            if (networkCluster != null) {
                if (networkCluster.isManagement()) {
                    imagesToText.put(managementImage, constants.managementItemInfo());
                }
                if (networkCluster.isDisplay()) {
                    imagesToText.put(displayImage, constants.displayItemInfo());
                }
                if (networkCluster.isMigration()) {
                    imagesToText.put(migrationImage, constants.migrationItemInfo());
                }
                if (network.getCluster().isGluster()) {
                    imagesToText.put(glusterNwImage, constants.glusterNwItemInfo());
                }
                if (networkCluster.isDefaultRoute()) {
                    imagesToText.put(defaultRouteImage, constants.defaultRouteItemInfo());
                }
            }
            return MultiImageColumnHelper.getTooltip(imagesToText);
        }
    };
}
Also used : AbstractSafeHtmlColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Network(org.ovirt.engine.core.common.businessentities.network.Network) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with AbstractSafeHtmlColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn in project ovirt-engine by oVirt.

the class SubTabNetworkClusterView method createNetRoleColumn.

private AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>> createNetRoleColumn() {
    return new AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>>() {

        @Override
        public SafeHtml getValue(PairQueryable<Cluster, NetworkCluster> object) {
            List<SafeHtml> images = new LinkedList<>();
            NetworkCluster networkCluster = object.getSecond();
            if (networkCluster != null) {
                images.add(thisOrEmptyImage(networkCluster.isManagement(), managementImage));
                images.add(thisOrEmptyImage(networkCluster.isDisplay(), displayImage));
                images.add(thisOrEmptyImage(networkCluster.isMigration(), migrationImage));
                images.add(thisOrEmptyImage(networkCluster.isGluster(), glusterNwImage));
                images.add(thisOrEmptyImage(networkCluster.isDefaultRoute(), defaultRouteImage));
            }
            return MultiImageColumnHelper.getValue(images);
        }

        @Override
        public SafeHtml getTooltip(PairQueryable<Cluster, NetworkCluster> object) {
            Map<SafeHtml, String> imagesToText = new LinkedHashMap<>();
            NetworkCluster networkCluster = object.getSecond();
            if (networkCluster != null) {
                if (networkCluster.isManagement()) {
                    imagesToText.put(managementImage, constants.managementItemInfo());
                }
                if (networkCluster.isDisplay()) {
                    imagesToText.put(displayImage, constants.displayItemInfo());
                }
                if (networkCluster.isMigration()) {
                    imagesToText.put(migrationImage, constants.migrationItemInfo());
                }
                if (networkCluster.isGluster()) {
                    imagesToText.put(glusterNwImage, constants.glusterNwItemInfo());
                }
                if (networkCluster.isDefaultRoute()) {
                    imagesToText.put(defaultRouteImage, constants.defaultRouteItemInfo());
                }
            }
            return MultiImageColumnHelper.getTooltip(imagesToText);
        }
    };
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) AbstractSafeHtmlColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedList (java.util.LinkedList)2 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)2 AbstractSafeHtmlColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)1