Example usage for org.apache.commons.lang BooleanUtils toBooleanObject

List of usage examples for org.apache.commons.lang BooleanUtils toBooleanObject

Introduction

In this page you can find the example usage for org.apache.commons.lang BooleanUtils toBooleanObject.

Prototype

public static Boolean toBooleanObject(String str) 

Source Link

Document

Converts a String to a Boolean.

'true', 'on' or 'yes' (case insensitive) will return true.

Usage

From source file:jp.primecloud.auto.ui.data.InstanceParameterContainer.java

public InstanceParameterContainer(InstanceDto instanceDto) {
    super(InstanceParameter.class);

    Instance instance = instanceDto.getInstance();
    AwsInstance awsInstance = instanceDto.getAwsInstance();
    VmwareInstance vmwareInstance = instanceDto.getVmwareInstance();
    NiftyInstance niftyInstance = instanceDto.getNiftyInstance();
    CloudstackInstance cloudStackInstance = instanceDto.getCloudstackInstance();
    VcloudInstance vcloudInstance = instanceDto.getVcloudInstance();
    AzureInstance azureInstance = instanceDto.getAzureInstance();
    OpenstackInstance openstackInstance = instanceDto.getOpenstackInstance();

    Platform platform = instanceDto.getPlatform().getPlatform();
    String platformName = platform.getPlatformNameDisp();

    Image image = instanceDto.getImage().getImage();
    String imageName = image.getImageNameDisp();

    List<InstanceParameter> parameters = new ArrayList<InstanceParameter>();

    // //from  www  . j ava2s. c  om
    String captionCommon = ViewProperties.getCaption("param.instance.common");
    parameters.add(new InstanceParameter(captionCommon, ViewProperties.getCaption("param.instance.name"),
            instance.getInstanceName()));
    parameters.add(new InstanceParameter(captionCommon, ViewProperties.getCaption("param.instance.hostName"),
            instance.getFqdn()));
    parameters.add(new InstanceParameter(captionCommon, ViewProperties.getCaption("param.instance.comment"),
            instance.getComment()));

    Boolean showPublicIp = BooleanUtils.toBooleanObject(Config.getProperty("ui.showPublicIp"));
    if (BooleanUtils.isTrue(showPublicIp)) {
        //ui.showPublicIp = true ??IP?PublicIp?IP?PrivateIp
        parameters.add(new InstanceParameter(captionCommon,
                ViewProperties.getCaption("param.instance.ipAddress"), instance.getPublicIp()));
        parameters.add(new InstanceParameter(captionCommon,
                ViewProperties.getCaption("param.instance.privateIpAddress"), instance.getPrivateIp()));
    } else {
        //ui.showPublicIp = false ?? IP?PrivateIp?IP?PublicIp
        parameters.add(new InstanceParameter(captionCommon,
                ViewProperties.getCaption("param.instance.ipAddress"), instance.getPrivateIp()));
        parameters.add(new InstanceParameter(captionCommon,
                ViewProperties.getCaption("param.instance.privateIpAddress"), instance.getPublicIp()));
    }

    parameters.add(new InstanceParameter(captionCommon, ViewProperties.getCaption("param.instance.platform"),
            platformName));
    parameters.add(
            new InstanceParameter(captionCommon, ViewProperties.getCaption("param.instance.image"), imageName));

    // Eucalyptus/EC2
    // TODO CLOUD BRANCHING
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatformType()) && awsInstance != null) {
        String kind = platform.getPlatformSimplenameDisp();

        String elasticIp = null;
        if (instanceDto.getAwsAddress() != null) {
            elasticIp = instanceDto.getAwsAddress().getPublicIp();
        }

        parameters.add(
                new InstanceParameter(kind, ViewProperties.getCaption("param.instance.elasticIp"), elasticIp));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.dnsName"),
                awsInstance.getDnsName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.privateDns"),
                awsInstance.getPrivateDnsName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceId"),
                awsInstance.getInstanceId()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.keyPair"),
                awsInstance.getKeyName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceType"),
                awsInstance.getInstanceType()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.securityGroup"),
                awsInstance.getSecurityGroups()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.availabilityZone"),
                awsInstance.getAvailabilityZone()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.subnetId"),
                awsInstance.getSubnetId()));
    }
    // Vmware
    else if (PCCConstant.PLATFORM_TYPE_VMWARE.equals(platform.getPlatformType()) && vmwareInstance != null) {
        String kind = platform.getPlatformSimplenameDisp();

        String keyName = null;
        if (instanceDto.getVmwareKeyPair() != null) {
            keyName = instanceDto.getVmwareKeyPair().getKeyName();
        }

        String staticIp = "";
        VmwareAddress vmwareAddress = instanceDto.getVmwareAddress();
        if (vmwareAddress != null && BooleanUtils.isTrue(instanceDto.getVmwareAddress().getEnabled())) {
            staticIp = instanceDto.getVmwareAddress().getIpAddress();
        }

        parameters.add(
                new InstanceParameter(kind, ViewProperties.getCaption("param.instance.staticIp"), staticIp));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.machineName"),
                vmwareInstance.getMachineName()));
        parameters
                .add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.keyPair"), keyName));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceType"),
                vmwareInstance.getInstanceType()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.cluster"),
                vmwareInstance.getComputeResource()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.resourcePool"),
                vmwareInstance.getResourcePool()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.datastore"),
                vmwareInstance.getDatastore()));
    }
    // Nifty
    else if (PCCConstant.PLATFORM_TYPE_NIFTY.equals(platform.getPlatformType()) && niftyInstance != null) {
        String kind = platform.getPlatformSimplenameDisp();

        String keyName = null;
        if (instanceDto.getNiftyKeyPair() != null) {
            keyName = instanceDto.getNiftyKeyPair().getKeyName();
        }

        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceId"),
                niftyInstance.getInstanceId()));
        parameters
                .add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.keyPair"), keyName));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceType"),
                niftyInstance.getInstanceType()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.publicIp"),
                niftyInstance.getIpAddress()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.privateIp"),
                niftyInstance.getPrivateIpAddress()));
    }
    // CloudStack
    else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platform.getPlatformType())
            && cloudStackInstance != null) {
        String kind = platform.getPlatformSimplenameDisp();

        String elasticIp = null;
        if (instanceDto.getCloudstackAddress() != null) {
            elasticIp = instanceDto.getCloudstackAddress().getIpaddress();
        }

        parameters.add(
                new InstanceParameter(kind, ViewProperties.getCaption("param.instance.elasticIp"), elasticIp));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.machineName"),
                cloudStackInstance.getDisplayname()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceId"),
                cloudStackInstance.getInstanceId()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.keyPair"),
                cloudStackInstance.getKeyName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceType"),
                cloudStackInstance.getInstanceType()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.securityGroup"),
                cloudStackInstance.getSecuritygroup()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.zoneId"),
                cloudStackInstance.getZoneid()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.networkId"),
                cloudStackInstance.getNetworkid()));

    }
    // VCloud
    else if (PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platform.getPlatformType()) && vcloudInstance != null) {
        String kind = platform.getPlatformSimplenameDisp();
        PlatformVcloud platformVcloud = instanceDto.getPlatform().getPlatformVcloud();
        List<VcloudInstanceNetwork> vcloudInstanceNetworks = instanceDto.getVcloudInstanceNetworks();

        String keyName = null;
        if (instanceDto.getVcloudKeyPair() != null) {
            keyName = instanceDto.getVcloudKeyPair().getKeyName();
        }
        String storageTypeName = null;
        if (instanceDto.getPlatformVcloudStorageType() != null) {
            storageTypeName = instanceDto.getPlatformVcloudStorageType().getStorageTypeName();
        }
        for (VcloudInstanceNetwork vcloudInstanceNetwork : vcloudInstanceNetworks) {
            String ipStr = vcloudInstanceNetwork.getNetworkName();
            if (StringUtils.isNotEmpty(vcloudInstanceNetwork.getIpAddress())) {
                ipStr = ipStr + " (IP" + vcloudInstanceNetwork.getIpAddress() + ")";
            }
            parameters.add(
                    new InstanceParameter(kind, ViewProperties.getCaption("param.instance.network"), ipStr));
        }
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.machineName"),
                vcloudInstance.getVmName()));
        parameters
                .add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.keyPair"), keyName));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceType"),
                vcloudInstance.getInstanceType()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.organization"),
                platformVcloud.getOrgName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.vdc"),
                platformVcloud.getVdcName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.storageType"),
                storageTypeName));
    }
    // Azure
    else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatformType()) && azureInstance != null) {
        String kind = platform.getPlatformSimplenameDisp();

        //String subscriptionId = null;
        //if (instanceDto.getAzureCertificate().getSubscriptionId() != null) {
        //    subscriptionId = instanceDto.getCloudstackAddress().getIpaddress();
        //}

        //String subnetName = null;
        //if (instanceDto.getAzureInstance().getSubnetNo() != null) {
        //    AzureSubnet azureSubnet =  instanceDto.getAzureSubnet();
        //    subnetName = azureSubnet.getNetworkName();
        //}

        //parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.subscriptionId"), subscriptionId));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.machineName"),
                azureInstance.getInstanceName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.affinityGroup"),
                azureInstance.getAffinityGroupName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.cloudService"),
                azureInstance.getCloudServiceName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.networkName"),
                azureInstance.getNetworkName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.storageAccount"),
                azureInstance.getStorageAccountName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceType"),
                azureInstance.getInstanceType()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.availabilitySet"),
                azureInstance.getAvailabilitySet()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.subnetName"),
                azureInstance.getSubnetId()));

    }
    // OpenStack
    else if (PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platform.getPlatformType())) {
        String kind = platform.getPlatformSimplenameDisp();

        //parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.subscriptionId"), subscriptionId));
        //parameters.add(new InstanceParameter(kind, "??", "demo"));
        //parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceId"), openstackInstance.getInstanceId()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.availabilityZone"),
                openstackInstance.getAvailabilityZone()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.instanceType"),
                openstackInstance.getInstanceType()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.keyPair"),
                openstackInstance.getKeyName()));
        parameters.add(new InstanceParameter(kind, ViewProperties.getCaption("param.instance.securityGroup"),
                openstackInstance.getSecurityGroups()));

    }

    for (InstanceParameter parameter : parameters) {
        addItem(parameter);
    }
}

From source file:com.hortonworks.streamline.streams.service.NamespaceCatalogResource.java

@GET
@Path("/namespaces")
@Timed//from  w  w w  . java2 s  .c  om
public Response listNamespaces(@Context UriInfo uriInfo, @Context SecurityContext securityContext) {
    List<QueryParam> queryParams = new ArrayList<>();
    MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
    Collection<Namespace> namespaces;
    Boolean detail = false;

    if (params.isEmpty()) {
        namespaces = environmentService.listNamespaces();
    } else {
        MultivaluedMap<String, String> copiedParams = new MultivaluedHashMap<>();
        copiedParams.putAll(params);
        List<String> detailOption = copiedParams.remove("detail");
        if (detailOption != null && !detailOption.isEmpty()) {
            detail = BooleanUtils.toBooleanObject(detailOption.get(0));
        }

        queryParams = WSUtils.buildQueryParameters(copiedParams);
        namespaces = environmentService.listNamespaces(queryParams);
    }
    if (namespaces != null) {
        boolean environmentUser = SecurityUtil.hasRole(authorizer, securityContext,
                Roles.ROLE_ENVIRONMENT_USER);
        if (environmentUser) {
            LOG.debug("Returning all environments since user has role: {}", Roles.ROLE_ENVIRONMENT_USER);
        } else {
            namespaces = SecurityUtil.filter(authorizer, securityContext, Namespace.NAMESPACE, namespaces,
                    READ);
        }
        return buildNamespacesGetResponse(namespaces, detail);
    }

    throw EntityNotFoundException.byFilter(queryParams.toString());
}

From source file:info.magnolia.cms.gui.dialog.DialogMultiSelect.java

public String getSaveInfo() {
    Boolean renderSaveInfo = BooleanUtils.toBooleanObject(this.getConfigValue("saveInfo"));
    if (BooleanUtils.toBooleanDefaultIfNull(renderSaveInfo, true)) {
        ControlImpl dummy = new ControlImpl(this.getName(), (String) null);
        if (!isSaveAsList() && !isSaveAsJSON()) {
            dummy.setValueType(ControlImpl.VALUETYPE_MULTIPLE);
        }/*  www.  j av a2  s  .  c o  m*/
        return dummy.getHtmlSaveInfo();
    }
    // don' create the save info
    return "";
}

From source file:jp.primecloud.auto.ui.WinServiceEdit.java

WinServiceEdit(Application ap, Long componentNo) {
    apl = ap;//from  ww  w. j  a  v  a2 s.  c  o  m
    this.componentNo = componentNo;

    // ???
    initData();

    //
    setIcon(Icons.EDITMINI.resource());
    setCaption(ViewProperties.getCaption("window.winServiceEdit"));
    setModal(true);
    setWidth("600px");

    VerticalLayout layout = (VerticalLayout) getContent();
    //        layout.setWidth("100%");
    layout.setMargin(false, true, false, true);
    layout.setSpacing(true);

    // 
    layout.addComponent(tab);

    basicTab = new BasicTab();
    tab.addTab(basicTab, ViewProperties.getCaption("tab.basic"), Icons.BASIC.resource());

    detailTab = new DetailTab();
    Boolean useCustomPara = BooleanUtils.toBooleanObject(Config.getProperty("userCustomize.useCustomParam"));
    if (BooleanUtils.isTrue(useCustomPara)) {
        tab.addTab(detailTab, ViewProperties.getCaption("tab.detail"), Icons.BASIC.resource());
    }

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // OK
    Button okButton = new Button(ViewProperties.getCaption("button.ok"));
    okButton.setDescription(ViewProperties.getCaption("description.editService.ok"));
    okButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            okButtonClick(event);
        }
    });
    okbar.addComponent(okButton);
    // [Enter]?okButton
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.focus();

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    initValidation();

    // ?
    basicTab.showData();

    // ?
    detailTab.showData();
}

From source file:com.tesora.dve.common.catalog.SiteInstance.java

public Boolean schemaIsMaster() {
    return BooleanUtils.toBooleanObject(isMaster);
}

From source file:mitm.application.djigzo.james.MailAttributesUtils.java

/**
 * Returns the string attribute as a Boolean.
 *//*from ww  w.  ja va  2s.com*/
public static Boolean getBoolean(Mail mail, String attribute, Boolean defaultValue) {
    Boolean result = null;

    Object rawValue = mail.getAttribute(attribute);

    if (rawValue instanceof Boolean) {
        result = (Boolean) rawValue;
    } else if (rawValue instanceof String) {
        result = BooleanUtils.toBooleanObject((String) rawValue);
    }

    if (result == null) {
        result = defaultValue;
    }

    return result;
}

From source file:mitm.application.djigzo.james.mailets.AbstractDjigzoMailet.java

protected Boolean getBooleanInitParameter(String name, Boolean defaultIfEmpty) {
    Boolean value = defaultIfEmpty;

    String parameter = getInitParameter(name);

    if (StringUtils.isNotEmpty(parameter)) {
        value = BooleanUtils.toBooleanObject(parameter);

        if (value == null) {
            throw new IllegalArgumentException(parameter + " is not a valid boolean value.");
        }/*from  w  ww .ja va 2  s. co m*/
    }

    return value;
}

From source file:com.hortonworks.streamline.streams.cluster.resource.ClusterCatalogResource.java

/**
 * List ALL clusters or the ones matching specific query params.
 *//*from   w  w w. ja  v a2s .  c o  m*/
@GET
@Path("/clusters")
@Timed
public Response listClusters(@Context UriInfo uriInfo, @Context SecurityContext securityContext) {
    List<QueryParam> queryParams = new ArrayList<>();
    MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
    Collection<Cluster> clusters;
    Boolean detail = false;

    if (params.isEmpty()) {
        clusters = environmentService.listClusters();
    } else {
        MultivaluedMap<String, String> copiedParams = new MultivaluedHashMap<>();
        copiedParams.putAll(params);
        List<String> detailOption = copiedParams.remove("detail");
        if (detailOption != null && !detailOption.isEmpty()) {
            detail = BooleanUtils.toBooleanObject(detailOption.get(0));
        }

        queryParams = WSUtils.buildQueryParameters(copiedParams);
        clusters = environmentService.listClusters(queryParams);
    }

    if (clusters != null) {
        boolean servicePoolUser = SecurityUtil.hasRole(authorizer, securityContext,
                Roles.ROLE_SERVICE_POOL_USER);
        if (servicePoolUser) {
            LOG.debug("Returning all service pools since user has role: {}", Roles.ROLE_SERVICE_POOL_USER);
        } else {
            clusters = SecurityUtil.filter(authorizer, securityContext, NAMESPACE, clusters, READ);
        }
        return buildClustersGetResponse(clusters, detail);
    }

    throw EntityNotFoundException.byFilter(queryParams.toString());
}

From source file:com.openappengine.utility.ObjectConverter.java

/**
 * Converts String to Boolean./*from w w  w.  ja v  a 2  s  . c om*/
 * @param value The String to be converted.
 * @return The converted Boolean value.
 */
public static Boolean stringToBoolean(String value) {
    return BooleanUtils.toBooleanObject(value);
}

From source file:jp.primecloud.auto.ui.ServerTable.java

ServerTable(String caption, Container container, final MyCloudTabs sender) {
    super(caption, container);

    this.sender = sender;
    setVisibleColumns(new Object[] {});

    setWidth("100%");
    if (this.isEnabled()) {
        setHeight("100%");
    }/*from   ww  w .j ava 2  s .com*/

    setPageLength(0);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setImmediate(true);
    setStyleName("server-table");
    setNullSelectionAllowed(false);
    setCacheRate(0.1);

    addGeneratedColumn("no", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            Label nlbl = new Label(String.valueOf(p.getInstance().getInstanceNo()));
            return nlbl;
        }
    });

    addGeneratedColumn("name", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;

            PlatformDto platformDto = p.getPlatform();
            //????
            Icons icon = CommonUtils.getPlatformIcon(platformDto);

            Label nlbl = new Label("<img src=\"" + VaadinUtils.getIconPath(ServerTable.this, icon) + "\"><div>"
                    + p.getInstance().getInstanceName() + "</div>", Label.CONTENT_XHTML);
            nlbl.setHeight(COLUMN_HEIGHT);
            return nlbl;
        }
    });

    addGeneratedColumn("fqdn", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            Label nlbl = new Label(p.getInstance().getFqdn());
            return nlbl;
        }
    });

    addGeneratedColumn("publicIp", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            Boolean showPublicIp = BooleanUtils.toBooleanObject(Config.getProperty("ui.showPublicIp"));
            Label ipaddr;
            if (BooleanUtils.isTrue(showPublicIp)) {
                //ui.showPublicIp = true???PublicIp
                ipaddr = new Label(p.getInstance().getPublicIp());
            } else {
                //ui.showPublicIp = false???PrivateIp
                ipaddr = new Label(p.getInstance().getPrivateIp());
            }
            return ipaddr;
        }
    });

    addGeneratedColumn("status", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            String a = p.getInstance().getStatus().substring(0, 1).toUpperCase()
                    + p.getInstance().getStatus().substring(1).toLowerCase();
            Icons icon = Icons.fromName(a);
            Label slbl = new Label(
                    "<img src=\"" + VaadinUtils.getIconPath(ServerTable.this, icon) + "\"><div>" + a + "</div>",
                    Label.CONTENT_XHTML);
            slbl.setHeight(COLUMN_HEIGHT);
            return slbl;
        }
    });

    addGeneratedColumn("services", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {

            InstanceDto p = (InstanceDto) itemId;

            String context = "<div>";
            for (ComponentDto dto : sender.getComponents(p.getComponentInstances())) {
                ComponentType componentType = dto.getComponentType();
                String name = componentType.getComponentTypeNameDisp();
                Icons nameIcon = Icons.fromName(componentType.getComponentTypeName());
                // Master
                if (MySQLConstants.COMPONENT_TYPE_NAME.equals(componentType.getComponentTypeName())) {
                    Long masterInstanceNo = null;
                    for (InstanceConfig config : dto.getInstanceConfigs()) {
                        if (MySQLConstants.CONFIG_NAME_MASTER_INSTANCE_NO.equals(config.getConfigName())) {
                            if (StringUtils.isEmpty(config.getConfigValue())) {
                                masterInstanceNo = config.getInstanceNo();
                                break;
                            }
                        }
                    }
                    if (masterInstanceNo != null) {
                        if (masterInstanceNo.equals(p.getInstance().getInstanceNo())) {
                            name = name + "_master";
                            nameIcon = Icons.MYSQL_MASTER;
                        } else {
                            name = name + "_slave";
                            nameIcon = Icons.MYSQL_SLAVE;
                        }
                    } else {
                        name = name + "_slave";
                        nameIcon = Icons.MYSQL_SLAVE;
                    }
                }

                context = context + "<img style=\"width: 5px;\" src=\" "
                        + VaadinUtils.getIconPath(ServerTable.this, Icons.fromName("SPACER")) + "\" >"
                        + "<img src=\"" + VaadinUtils.getIconPath(ServerTable.this, nameIcon) + "\" + "
                        + " title=\"" + name + "\">";
            }
            context = context + "</div>";

            Label slayout = new Label(context, Label.CONTENT_XHTML);
            slayout.setHeight(COLUMN_HEIGHT);
            return slayout;
        }

    });

    //        addGeneratedColumn("operation", new ColumnGenerator() {
    //            public Component generateCell(Table source, Object itemId, Object columnId) {
    //
    //                List<Button> list = new ArrayList<Button>();
    //
    //                CssLayout blayout = new CssLayout();
    //
    //                blayout.setWidth("100%");
    //                blayout.setHeight(COLUMN_HEIGHT);
    //                blayout.setMargin(false);
    //
    //                InstanceDto p = (InstanceDto) itemId;
    //
    //                Button playButton = new Button(ViewProperties.getCaption("button.startServer"));
    //                playButton.setDescription(ViewProperties.getCaption("description.startServer"));
    //                playButton.addStyleName("borderless");
    //                playButton.setIcon(Icons.PLAY.resource());
    //                playButton.setEnabled(false);
    //                playButton.addListener(Button.ClickEvent.class, ServerTable.this, "playButtonClick");
    //                blayout.addComponent(playButton);
    //                list.add(playButton);
    //
    //                Button stopButton = new Button(ViewProperties.getCaption("button.stopServer"));
    //                stopButton.setDescription(ViewProperties.getCaption("description.stopServer"));
    //                stopButton.addStyleName("borderless");
    //                stopButton.setIcon(Icons.STOP.resource());
    //                stopButton.setEnabled(false);
    //                stopButton.addListener(Button.ClickEvent.class, ServerTable.this, "stopButtonClick");
    //                blayout.addComponent(stopButton);
    //                list.add(stopButton);
    //
    //                Button editButton = new Button(ViewProperties.getCaption("button.editServer"));
    //                editButton.setDescription(ViewProperties.getCaption("description.editServer"));
    //                editButton.addStyleName("borderless");
    //                editButton.setIcon(Icons.EDIT.resource());
    //                editButton.setEnabled(false);
    //                editButton.addListener(Button.ClickEvent.class, ServerTable.this, "editButtonClick");
    //                blayout.addComponent(editButton);
    //                list.add(editButton);
    //
    //                Button delButton = new Button(ViewProperties.getCaption("button.deleteServer"));
    //                delButton.setDescription(ViewProperties.getCaption("description.deleteServer"));
    //                delButton.addStyleName("borderless");
    //                delButton.setIcon(Icons.DELETE.resource());
    //                delButton.setEnabled(false);
    //                delButton.addListener(Button.ClickEvent.class, ServerTable.this, "delButtonClick");
    //                blayout.addComponent(delButton);
    //                list.add(delButton);
    //
    //                map.put(p.getInstance().getInstanceNo(), list);
    //
    //                return blayout;
    //            }
    //
    //        });

    //???
    setColumnHeaders(CAPNAME);

    //????StyleName
    setCellStyleGenerator(new Table.CellStyleGenerator() {
        public String getStyle(Object itemId, Object propertyId) {

            if (propertyId == null) {
                return "";
            } else {
                return propertyId.toString().toLowerCase();
            }
        }
    });

    //        setColumnExpandRatio("name", 100);
    setColumnExpandRatio("fqdn", 100);
    addListener(Table.ValueChangeEvent.class, sender, "tableRowSelected");

    //        alwaysRecalculateColumnWidths = true;
}