Package org.eobjects.metamodel.schema

Examples of org.eobjects.metamodel.schema.Column


    this();
    setModel(datastore, table);
  }

  public void setModel(Datastore datastore, Table table) {
    final Column previousItem = getSelectedItem();

    if (getTable() == table) {
      return;
    }
    setTable(table);
View Full Code Here


  public void setModel(Datastore datastore) {
    setModel(datastore, true);
  }

  public void setModel(Datastore datastore, boolean retainSelection) {
    final Column previousItem = getSelectedItem();

    setTable(null);

    if (datastore == null) {
      setDataContextProvider(null);
View Full Code Here

  @Override
  public void onAdd(InputColumn<?> sourceColumn) {
    _hintLabel.setVisible(false);
    _maxRowsFilterShortcutPanel.setEnabled(true);

    Column column = sourceColumn.getPhysicalColumn();
    Table table = column.getTable();

    ColumnListTable sourceColumnTable = getColumnListTable(table);
    sourceColumnTable.addColumn(sourceColumn);
  }
View Full Code Here

    sourceColumnTable.addColumn(sourceColumn);
  }

  @Override
  public void onRemove(InputColumn<?> sourceColumn) {
    Column column = sourceColumn.getPhysicalColumn();
    Table table = column.getTable();
    ColumnListTable sourceColumnTable = getColumnListTable(table);
    sourceColumnTable.removeColumn(sourceColumn);
    if (sourceColumnTable.getColumnCount() == 0) {
      this.remove(sourceColumnTable);
      _sourceColumnTables.remove(sourceColumnTable);
View Full Code Here

      comboBox.setEnabled(false);
      comboBox.setName(columnPath);
      comboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          Column col = comboBox.getSelectedItem();
          if (col != null) {
            // make sure all comboboxes in a group use the same
            // table
            List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tablePath);
            for (SourceColumnComboBox sameTableComboBox : comboBoxes) {
              sameTableComboBox.setModel(_datastore, col.getTable());
            }
          }
          refreshOpenButtonVisibility();
        }
      });
View Full Code Here

    } else if (value instanceof Table) {
      component = _rendererDelegate.getTreeCellRendererComponent(tree, ((Table) value).getName(), selected, expanded,
          leaf, row, hasFocus);
      icon = imageManager.getImageIcon("images/model/table.png", IconUtils.ICON_SIZE_SMALL);
    } else if (value instanceof Column) {
      Column column = (Column) value;
      component = _rendererDelegate.getTreeCellRendererComponent(tree, column.getName(), selected, expanded, leaf,
          row, hasFocus);
      icon = imageManager.getImageIcon("images/model/column.png", IconUtils.ICON_SIZE_SMALL);
    } else if (value instanceof String) {
      component = _rendererDelegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
    }
View Full Code Here

      throw new IllegalStateException("Could not find dependencies file");
    }
    try {
      DataContext dc = DataContextFactory.createCsvDataContext(url.openStream(), ',', '"', false);
      Table table = dc.getDefaultSchema().getTables()[0];
      Column projectColumn = table.getColumnByName("Project");
      Column websiteColumn = table.getColumnByName("Website");
      Column licenseColumn = table.getColumnByName("License");
      Query q = dc.query().from(table).select(table.getColumns()).orderBy(projectColumn).asc().toQuery();
      DataSet ds = dc.executeQuery(q);
      while (ds.next()) {
        final LicensedProject licensedProject = new LicensedProject();
        final Row row = ds.getRow();
View Full Code Here

      return;
    }
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
    final Object userObject = node.getUserObject();
    if (userObject instanceof Column) {
      final Column column = (Column) userObject;
      int button = e.getButton();

      if (button == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
        // double click = toggle column
        toggleColumn(column);
      } else if (button == MouseEvent.BUTTON2 || button == MouseEvent.BUTTON3) {
        // right click = open popup menu
        final JMenuItem toggleColumnItem = WidgetFactory.createMenuItem(null,
            "images/actions/toggle-source-column.png");
        if (_analysisJobBuilder.containsSourceColumn(column)) {
          toggleColumnItem.setText("Remove column from source");
        } else {
          toggleColumnItem.setText("Add column to source");
        }
        toggleColumnItem.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            toggleColumn(column);
          }
        });

        final JMenuItem createDictionaryItem = WidgetFactory.createMenuItem("Create dictionary from column",
            "images/model/dictionary.png");
        createDictionaryItem.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            String datastoreName = _analysisJobBuilder.getDataContextProvider().getDatastore().getName();
            DatastoreDictionary dictionary = new DatastoreDictionary(column.getName(), datastoreName, column
                .getQualifiedLabel());

            Injector injector = _injectorBuilder.with(DatastoreDictionary.class, dictionary).createInjector();

            DatastoreDictionaryDialog dialog = injector.getInstance(DatastoreDictionaryDialog.class);
            dialog.setVisible(true);
          }
        });

        final JMenuItem quickAnalysisMenuItem = WidgetFactory.createMenuItem("Quick analysis",
            "images/component-types/analyzer.png");

        Injector injector = _injectorBuilder.with(Column[].class, new Column[] { column }).with(Table.class, null)
            .createInjector();
        QuickAnalysisActionListener quickAnalysisActionListener = injector
            .getInstance(QuickAnalysisActionListener.class);

        quickAnalysisMenuItem.addActionListener(quickAnalysisActionListener);

        final JMenuItem previewMenuItem = WidgetFactory.createMenuItem("Preview column",
            "images/actions/preview_data.png");
        previewMenuItem.addActionListener(new PreviewSourceDataActionListener(_schemaTree.getWindowContext(),
            _analysisJobBuilder.getDataContextProvider(), column));

        final JPopupMenu popup = new JPopupMenu();
        popup.setLabel(column.getName());
        popup.add(toggleColumnItem);
        popup.add(createDictionaryItem);
        popup.add(quickAnalysisMenuItem);
        popup.add(previewMenuItem);
        popup.show((Component) e.getSource(), e.getX(), e.getY());
View Full Code Here

    DefaultTableModel model = new DefaultTableModel(columnNames, sourceColumns.size());

    int i = 0;
    for (InputColumn<?> inputColumn : sourceColumns) {
      Column column = inputColumn.getPhysicalColumn();
      model.setValueAt(column.getTable().getName(), i, 0);
      model.setValueAt(column.getName(), i, 1);
      model.setValueAt(inputColumn.getDataTypeFamily(), i, 2);
      model.setValueAt(column.getNativeType(), i, 3);
      model.setValueAt(column.getColumnSize(), i, 4);

      Boolean nullable = column.isNullable();
      if (nullable != null && nullable.booleanValue()) {
        model.setValueAt(validIcon, i, 5);
      } else {
        model.setValueAt("", i, 5);
      }

      boolean indexed = column.isIndexed();
      if (indexed) {
        model.setValueAt(validIcon, i, 6);
      } else {
        model.setValueAt("", i, 6);
      }
View Full Code Here

                if (path == null) {
                  return;
                }
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
                if (node.getUserObject() instanceof Column) {
                  Column column = (Column) node.getUserObject();

                  if (_nameAutomaticallySet || StringUtils.isNullOrEmpty(_nameTextField.getText())) {
                    _nameTextField.setText(column.getName());
                    _nameAutomaticallySet = true;
                  }

                }
              };
            });
          }
        }
      }
    });

    if (synonymCatalog != null) {
      String datastoreName = synonymCatalog.getDatastoreName();

      _nameTextField.setText(synonymCatalog.getName());
      _datastoreComboBox.setSelectedItem(datastoreName);

      Datastore datastore = _datastoreCatalog.getDatastore(datastoreName);
      if (datastore != null) {
        DataContextProvider dataContextProvider = datastore.getDataContextProvider();
        try {
          SchemaNavigator sn = dataContextProvider.getSchemaNavigator();

          Column masterTermColumn = sn.convertToColumn(synonymCatalog.getMasterTermColumnPath());
          _masterTermColumnComboBox.setSelectedItem(masterTermColumn);

          String[] synonymColumnPaths = synonymCatalog.getSynonymColumnPaths();
          Column[] synonymColumns = sn.convertToColumns(synonymColumnPaths);
          _synonymColumnsPanel.setColumns(Arrays.asList(synonymColumns));
View Full Code Here

TOP

Related Classes of org.eobjects.metamodel.schema.Column

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.