public void onCellOver(CellOverEvent event) {
      ListGridField gridField = AttributeListGrid.this.getField(event.getColNum());
      if (gridField.getName().equals(attributeInfo.getName())) {
        ListGridRecord record = event.getRecord();
        String value = record.getAttribute(attributeInfo.getName());
        if (event.getRowNum() != row) {
          if (img != null) {
            cleanup();
          }
          img = new Img(value);
          img.setMaxWidth(300);
          img.setMaxHeight(300);
          img.setKeepInParentRect(true);
          img.setShowEdges(true);
          img.setLeft(AttributeListGrid.this.getAbsoluteLeft() + 10);
          img.setTop(AttributeListGrid.this.getAbsoluteTop() + 10);
          img.draw();
          killTimer =
              new Timer() {

                public void run() {
                  img.destroy();
                }
              };
          killTimer.schedule(Math.round(3000));
          row = event.getRowNum();
        }
      }
    }
 public void onCellClick(CellClickEvent event) {
   ListGridField gridField = AttributeListGrid.this.getField(event.getColNum());
   if (gridField.getName().equals(attributeInfo.getName())) {
     ListGridRecord record = event.getRecord();
     String value = record.getAttribute(attributeInfo.getName());
     Window.open(value, "urlWindow", null);
   }
 }
 private void setField(final String fieldname) {
   for (int i = maxlevelparents; i <= maxlevelchildren; i++) {
     final TreeColumn grid = treecolumns.get(i);
     for (final ListGridField field : grid.getFields()) {
       grid.hideField(field.getName());
     }
     grid.showField(fieldname);
   }
 }
    @Override
    public ArrayList<ListGridField> getListGridFields() {
      ArrayList<ListGridField> fields = super.getListGridFields();

      // hide the created/modified fields, we don't need to show them by default
      // add cell formatter on the name field so we can make it a link
      for (ListGridField field : fields) {
        String fieldName = field.getName();
        if (fieldName.equals(FIELD_CTIME) || fieldName.equals(FIELD_MTIME)) {
          field.setHidden(true);
        } else if (fieldName.equals(FIELD_NAME)) {
          field.setCellFormatter(
              new CellFormatter() {
                @Override
                public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
                  AlertDefinition alertDef = copyValues(record);
                  int resourceId = alertDef.getResource().getId();
                  int alertDefId = alertDef.getId();
                  String link = LinkManager.getSubsystemAlertDefinitionLink(resourceId, alertDefId);
                  return "<a href=\""
                      + link
                      + "\">"
                      + StringUtility.escapeHtml(alertDef.getName())
                      + "</a>";
                }
              });
        }
      }

      // add more columns
      ListGridField parentField = new ListGridField(FIELD_PARENT, MSG.view_alerts_field_parent());
      parentField.setWidth(100);
      parentField.setShowHover(true);
      parentField.setHoverCustomizer(
          new HoverCustomizer() {
            @Override
            public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
              if (record.getAttribute(FIELD_PARENT) != null) {
                return MSG.view_reports_alertDefinitions_parentHover();
              }
              return MSG.common_val_na();
            }
          });
      parentField.addRecordClickHandler(
          new RecordClickHandler() {
            @Override
            public void onRecordClick(RecordClickEvent event) {
              // we only do something if we really have a parent.
              // if we have a template parent, we have to get the resource's type and go to the
              // template page for that type
              // if we have a group parent, we can directly go to the group's alert def page
              Record record = event.getRecord();
              AlertDefinition alertDef = copyValues(record);
              if (alertDef.getParentId() != null && alertDef.getParentId().intValue() > 0) {
                final Integer templateId = alertDef.getParentId().intValue();
                final Integer resourceId = alertDef.getResource().getId();

                ResourceCriteria resCriteria = new ResourceCriteria();
                resCriteria.addFilterId(resourceId);
                resCriteria.fetchResourceType(true);

                GWTServiceLookup.getResourceService()
                    .findResourcesByCriteria(
                        resCriteria,
                        new AsyncCallback<PageList<Resource>>() {
                          @Override
                          public void onSuccess(PageList<Resource> result) {
                            if (result == null || result.size() != 1) {
                              CoreGUI.getErrorHandler()
                                  .handleError(
                                      MSG.view_reports_alertDefinitions_resTypeLoadError());
                            } else {
                              int typeId = result.get(0).getResourceType().getId();
                              CoreGUI.goToView(
                                  LinkManager.getAdminTemplatesLink()
                                      + "/Alert/"
                                      + typeId
                                      + "/"
                                      + templateId);
                            }
                          }

                          @Override
                          public void onFailure(Throwable caught) {
                            CoreGUI.getErrorHandler()
                                .handleError(
                                    MSG.view_reports_alertDefinitions_resTypeLoadError(), caught);
                          }
                        });
              } else if (alertDef.getGroupAlertDefinition() != null) {
                AlertDefinition groupAlertDef = alertDef.getGroupAlertDefinition();
                CoreGUI.goToView(
                    LinkManager.getEntityTabLink(
                            EntityContext.forGroup(groupAlertDef.getResourceGroup()),
                            "Alert",
                            "Definitions")
                        + "/"
                        + groupAlertDef.getId());
              }
            }
          });
      fields.add(parentField);

      ListGridField resourceField = new ListGridField(FIELD_RESOURCE, MSG.common_title_resource());
      resourceField.setCellFormatter(
          new CellFormatter() {
            public String format(Object value, ListGridRecord listGridRecord, int i, int i1) {
              String url =
                  LinkManager.getResourceLink(
                      listGridRecord.getAttributeAsInt(AncestryUtil.RESOURCE_ID));
              return SeleniumUtility.getLocatableHref(
                  url, StringUtility.escapeHtml(value.toString()), null);
            }
          });
      resourceField.setShowHover(true);
      resourceField.setHoverCustomizer(
          new HoverCustomizer() {
            public String hoverHTML(
                Object value, ListGridRecord listGridRecord, int rowNum, int colNum) {
              return AncestryUtil.getResourceHoverHTML(listGridRecord, 0);
            }
          });
      fields.add(resourceField);

      ListGridField ancestryField = AncestryUtil.setupAncestryListGridField();
      fields.add(ancestryField);

      return fields;
    }