public void New() {
    if (getWindow() != null) {
      return;
    }

    ClusterNetworkModel clusterModel = new ClusterNetworkModel();
    setWindow(clusterModel);
    clusterModel.setTitle("New Logical Network");
    clusterModel.setHashName("new_logical_network");
    clusterModel.setIsNew(true);
    if (getEntity().getstorage_pool_id() != null) {
      AsyncQuery _asyncQuery = new AsyncQuery();
      _asyncQuery.setModel(clusterModel);
      _asyncQuery.asyncCallback =
          new INewAsyncCallback() {
            public void OnSuccess(Object model, Object result) {
              ClusterNetworkModel clusterNetworkModel = (ClusterNetworkModel) model;
              storage_pool dataCenter = (storage_pool) result;
              clusterNetworkModel.setDataCenterName(dataCenter.getname());
            }
          };
      AsyncDataProvider.GetDataCenterById(_asyncQuery, getEntity().getstorage_pool_id().getValue());
    }
    UICommand tempVar = new UICommand("OnSave", this);
    tempVar.setTitle("OK");
    tempVar.setIsDefault(true);
    clusterModel.getCommands().add(tempVar);

    UICommand tempVar2 = new UICommand("Cancel", this);
    tempVar2.setTitle("Cancel");
    tempVar2.setIsCancel(true);
    clusterModel.getCommands().add(tempVar2);
  }
  private void Edit() {
    if (getWindow() != null) {
      return;
    }

    VmInterfaceModel model = new VmInterfaceModel();
    setWindow(model);
    model.setTitle("Edit Network Interface");

    AsyncDataProvider.GetClusterNetworkList(
        new AsyncQuery(
            this,
            new INewAsyncCallback() {
              @Override
              public void OnSuccess(Object target, Object returnValue) {

                TemplateInterfaceListModel vmInterfaceListModel =
                    (TemplateInterfaceListModel) target;
                java.util.ArrayList<network> network_list =
                    returnValue != null
                        ? (java.util.ArrayList<network>) returnValue
                        : new java.util.ArrayList<network>();
                vmInterfaceListModel.PostGetClusterNetworkList_Edit(network_list);
              }
            }),
        getEntityStronglyTyped().getvds_group_id());
  }
  public void Manage() {
    if (getWindow() != null) {
      return;
    }

    Guid storagePoolId =
        (getEntity().getstorage_pool_id() != null)
            ? getEntity().getstorage_pool_id().getValue()
            : Guid.Empty;

    AsyncQuery _asyncQuery = new AsyncQuery();
    _asyncQuery.setModel(this);
    _asyncQuery.asyncCallback =
        new INewAsyncCallback() {
          public void OnSuccess(Object model, Object result) {
            ClusterNetworkListModel clusterNetworkListModel = (ClusterNetworkListModel) model;
            java.util.ArrayList<network> networkList = (java.util.ArrayList<network>) result;
            ListModel listModel = new ListModel();
            clusterNetworkListModel.setWindow(listModel);
            listModel.setTitle("Assign/Detach Networks");
            listModel.setHashName("assign_networks");
            clusterNetworkListModel.PostManage(networkList, listModel);
          }
        };
    AsyncDataProvider.GetNetworkList(_asyncQuery, storagePoolId);
  }