Package org.eobjects.analyzer.result

Examples of org.eobjects.analyzer.result.SimilarityGroup


      value = value.trim().toLowerCase();
      if (!"".equals(value)) {
        boolean foundMatch = false;

        for (ListIterator<SimilarityGroup> it = _similarityGroups.listIterator(); it.hasNext();) {
          SimilarityGroup similarityGroup = it.next();

          if (matches(value, similarityGroup)) {
            RowAnnotation annotation = similarityGroup.getAnnotation();
            it.set(new SimilarityGroup(annotation, _rowAnnotationFactory, _column, value, similarityGroup
                .getValues()));
            _rowAnnotationFactory.annotate(row, distinctCount, annotation);
            foundMatch = true;
          }
        }

        if (!foundMatch) {
          RowAnnotation annotation = _rowAnnotationFactory.createAnnotation();
          _rowAnnotationFactory.annotate(row, distinctCount, annotation);
          _similarityGroups.add(new SimilarityGroup(annotation, _rowAnnotationFactory, _column, value,
              new String[0]));
        }
      }
    }
  }
View Full Code Here


  }

  @Override
  public SimilarityResult getResult() {
    for (Iterator<SimilarityGroup> it = _similarityGroups.iterator(); it.hasNext();) {
      SimilarityGroup similarityGroup = it.next();
      if (similarityGroup.getValueCount() == 1) {
        it.remove();
      }
    }
    return new SimilarityResult(_similarityGroups);
  }
View Full Code Here

      public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
          boolean leaf, int row, boolean hasFocus) {
        if (value instanceof DefaultMutableTreeNode) {
          final Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
          if (userObject instanceof SimilarityGroup) {
            final SimilarityGroup similarityGroup = (SimilarityGroup) userObject;
            final String[] values = similarityGroup.getValues();

            final StringBuilder sb = new StringBuilder();
            sb.append(values.length);
            sb.append(": [");
            for (int i = 0; i < values.length; i++) {
              if (i != 0) {
                sb.append(',');
              }
              sb.append('\"');
              sb.append(values[i]);
              sb.append('\"');
              if (sb.length() > 17) {
                sb.delete(17, sb.length());
                sb.append(",...");
                break;
              }
            }
            sb.append(']');

            value = sb.toString();
          }
        }
        return rendererDelegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
      }
    });
    tree.setModel(treeModel);

    final DCPanel centerPanel = new DCPanel(WidgetUtils.BG_COLOR_BRIGHT, WidgetUtils.BG_COLOR_LESS_BRIGHT);
    centerPanel.setBorder(WidgetUtils.BORDER_EMPTY);
    centerPanel.setLayout(new BorderLayout());

    final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.add(WidgetUtils.scrolleable(tree));
    splitPane.add(WidgetUtils.scrolleable(centerPanel));
    splitPane.setDividerLocation(180);
    panel.add(splitPane, BorderLayout.CENTER);

    tree.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        TreePath path = tree.getPathForLocation(e.getX(), e.getY());
        if (path == null) {
          return;
        }
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
        Object userObject = node.getUserObject();
        if (userObject instanceof SimilarityGroup) {
          SimilarityGroup similarValues = (SimilarityGroup) userObject;
          AnnotatedRowsResult annotatedRowsResult = similarValues.getAnnotatedRows();
          AnnotatedRowsResultSwingRenderer renderer = new AnnotatedRowsResultSwingRenderer();
          JPanel comp = renderer.render(annotatedRowsResult);
          centerPanel.removeAll();
          centerPanel.add(comp, BorderLayout.NORTH);
          centerPanel.updateUI();
View Full Code Here

TOP

Related Classes of org.eobjects.analyzer.result.SimilarityGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.