Package org.eobjects.datacleaner.panels

Examples of org.eobjects.datacleaner.panels.DCPanel


    final JToolBar toolBar = WidgetFactory.createToolBar();
    toolBar.add(new HumanInferenceToolbarButton());
    toolBar.add(WidgetFactory.createToolBarSeparator());
    toolBar.add(closeButton);

    final DCPanel toolBarPanel = new DCPanel(WidgetUtils.BG_COLOR_DARKEST, WidgetUtils.BG_COLOR_DARKEST);
    toolBarPanel.setLayout(new BorderLayout());
    toolBarPanel.add(toolBar, BorderLayout.CENTER);

    final DCPanel panel = new DCPanel(WidgetUtils.BG_COLOR_DARK, WidgetUtils.BG_COLOR_DARK);
    panel.setLayout(new BorderLayout());
    panel.add(new DCBannerPanel("Options"), BorderLayout.NORTH);
    panel.add(_tabbedPane, BorderLayout.CENTER);
    panel.add(toolBarPanel, BorderLayout.SOUTH);
    panel.setPreferredSize(500, 500);
    return panel;
  }
View Full Code Here


      label.setBorder(border);
      return label;
    } else {
      final JLabel label = new JLabel(rowCount + " rows written!",
          imageManager.getImageIcon("images/status/valid.png"), JLabel.LEFT);
      final DCPanel buttonPanel = createButtonPanel(result);

      final DCPanel panel = new DCPanel();
      panel.setLayout(new VerticalLayout(4));
      panel.add(label);
      panel.add(buttonPanel);
      panel.setBorder(border);

      return panel;
    }
  }
View Full Code Here

      return panel;
    }
  }

  private DCPanel createButtonPanel(final OutputAnalyzerResult result) {
    final DCPanel panel = new DCPanel();
    panel.setLayout(new FlowLayout(Alignment.LEFT.getFlowLayoutAlignment(), 0, 4));

    final AnalyzerBeansConfiguration configuration = DCConfiguration.get();
    final DatastoreCatalog datastoreCatalog = configuration.getDatastoreCatalog();
    final Datastore datastore = result.getDatastore(datastoreCatalog);
    final Insets buttonMargin = new Insets(1, 4, 1, 4);
    if (datastore != null && datastore.getName() != null) {
      final Datastore ds = datastoreCatalog.getDatastore(datastore.getName());
      if (!datastore.equals(ds)) {
        final JButton addDatastoreButton = new JButton("Add to datastores",
            imageManager.getImageIcon("images/actions/add.png"));
        addDatastoreButton.setMargin(buttonMargin);
        addDatastoreButton.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            MutableDatastoreCatalog mutableDatastoreCatalog = (MutableDatastoreCatalog) datastoreCatalog;
            mutableDatastoreCatalog.addDatastore(datastore);
            addDatastoreButton.setEnabled(false);
          }
        });
        panel.add(addDatastoreButton);
        panel.add(Box.createHorizontalStrut(4));
      }

      final JButton analyzeButton = new JButton("Analyze this datastore",
          imageManager.getImageIcon("images/filetypes/analysis_job.png"));
      analyzeButton.setMargin(buttonMargin);
      analyzeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          Injector injector = Guice.createInjector(new DCModule(_parentModule, null));
          AnalysisJobBuilderWindow window = injector.getInstance(AnalysisJobBuilderWindow.class);
          window.setDatastore(datastore);
          window.open();
        }
      });
      panel.add(analyzeButton);
      panel.add(Box.createHorizontalStrut(4));

      final JButton previewButton = new JButton("Preview table",
          imageManager.getImageIcon("images/actions/preview_data.png"));
      previewButton.setMargin(buttonMargin);
      previewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          final DataContextProvider dcp = datastore.getDataContextProvider();
          final Table previewTable = result.getPreviewTable(datastore);
          if (previewTable == null) {
            throw new IllegalStateException("Result did not return any preview table: " + result);
          } else {
            final PreviewSourceDataActionListener actionListener = new PreviewSourceDataActionListener(
                windowContext, dcp, previewTable);
            actionListener.actionPerformed(null);
          }
        }
      });
      panel.add(previewButton);
    }
    return panel;
  }
View Full Code Here

    _datastoreComboBox = new JComboBox(comboBoxModel);
    _masterTermColumnComboBox = new SourceColumnComboBox();
    _synonymColumnsPanel = new MultiSourceColumnComboBoxPanel();
    _datastoreComboBox.setEditable(false);
    _treePanel = new DCPanel(WidgetUtils.BG_COLOR_BRIGHT, WidgetUtils.BG_COLOR_BRIGHTEST);
    _treePanel.setLayout(new BorderLayout());

    _datastoreComboBox.addActionListener(new ActionListener() {

      @Override
View Full Code Here

  }

  @Override
  protected JComponent getDialogContent() {

    final DCPanel formPanel = new DCPanel();

    int row = 0;
    final DCLabel descriptionLabel = DCLabel
        .brightMultiLine("A datastore synonym catalog is based on a datastore and columns within it. The layout of the datastore is flexible: There should be a master term column and either a single or multiple synonym columns.");
    descriptionLabel.setBorder(new EmptyBorder(10, 10, 10, 20));
    descriptionLabel.setPreferredSize(new Dimension(300, 100));
    WidgetUtils.addToGridBag(DCLabel.bright("Synonym catalog name:"), formPanel, 0, row);
    WidgetUtils.addToGridBag(_nameTextField, formPanel, 1, row);
    row++;
    WidgetUtils.addToGridBag(DCLabel.bright("Datastore:"), formPanel, 0, row);
    WidgetUtils.addToGridBag(_datastoreComboBox, formPanel, 1, row);
    row++;
    WidgetUtils.addToGridBag(DCLabel.bright("Master term column:"), formPanel, 0, row);
    WidgetUtils.addToGridBag(_masterTermColumnComboBox, formPanel, 1, row);
    row++;
    WidgetUtils.addToGridBag(DCLabel.bright("Synonym columns:"), formPanel, 0, row);
    WidgetUtils.addToGridBag(_synonymColumnsPanel.createPanel(), formPanel, 1, row);
    row++;
    final JButton saveButton = WidgetFactory.createButton("Save Synonym Catalog", "images/model/synonym.png");
    saveButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        String name = _nameTextField.getText();
        if (StringUtils.isNullOrEmpty(name)) {
          JOptionPane.showMessageDialog(DatastoreSynonymCatalogDialog.this,
              "Please fill out the name of the synonym catalog");
          return;
        }

        String nameOfDatastore = (String) _datastoreComboBox.getSelectedItem();
        if (StringUtils.isNullOrEmpty(nameOfDatastore)) {
          JOptionPane.showMessageDialog(DatastoreSynonymCatalogDialog.this, "Please select a character encoding");
          return;
        }

        Column selectedItem = _masterTermColumnComboBox.getSelectedItem();
        String[] synonymColumnNames = _synonymColumnsPanel.getColumnNames();

        DatastoreSynonymCatalog dataStoreBasedSynonymCatalog = new DatastoreSynonymCatalog(name, nameOfDatastore,
            selectedItem.getQualifiedLabel(), synonymColumnNames);

        if (_originalsynonymCatalog != null) {
          _mutableReferenceCatalog.removeSynonymCatalog(_originalsynonymCatalog);
        }

        _mutableReferenceCatalog.addSynonymCatalog(dataStoreBasedSynonymCatalog);
        DatastoreSynonymCatalogDialog.this.dispose();
      }
    });

    final DCPanel buttonPanel = new DCPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
    buttonPanel.add(saveButton);
    WidgetUtils.addToGridBag(buttonPanel, formPanel, 0, row, 2, 1);

    final DCPanel mainPanel = new DCPanel();
    mainPanel.setLayout(new VerticalLayout(4));
    mainPanel.add(descriptionLabel);
    mainPanel.add(formPanel);

    return mainPanel;
  }
View Full Code Here

    return _filenameField.getFilename();
  }

  @Override
  protected final JComponent getDialogContent() {
    DCPanel formPanel = new DCPanel();

    List<Entry<String, JComponent>> formElements = getFormElements();
    // temporary variable to make it easier to refactor the layout
    int row = 0;
    for (Entry<String, JComponent> entry : formElements) {
      String key = entry.getKey();
      if (StringUtils.isNullOrEmpty(key)) {
        WidgetUtils.addToGridBag(entry.getValue(), formPanel, 0, row, 2, 1);
      } else {
        WidgetUtils.addToGridBag(DCLabel.bright(key + ":"), formPanel, 0, row);
        WidgetUtils.addToGridBag(entry.getValue(), formPanel, 1, row);
      }
      row++;
    }

    if (isPreviewTableEnabled()) {
      WidgetUtils.addToGridBag(_loadingIcon, formPanel, 0, row, 2, 1);
      row++;
    }

    DCPanel buttonPanel = new DCPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
    buttonPanel.add(_addDatastoreButton);

    DCPanel centerPanel = new DCPanel();
    centerPanel.setLayout(new VerticalLayout(4));
    centerPanel.add(formPanel);
    if (isPreviewTableEnabled()) {
      centerPanel.add(_previewTablePanel);
    }
    centerPanel.add(buttonPanel);

    JXStatusBar statusBar = WidgetFactory.createStatusBar(_statusLabel);

    _outerPanel.setLayout(new BorderLayout());
    _outerPanel.add(centerPanel, BorderLayout.CENTER);
View Full Code Here

      protected void onChange(DocumentEvent event) {
        onSettingsUpdated(false);
      }
    };
    _lineWidthLabel = DCLabel.bright("");
    _valueWidthsPanel = new DCPanel();
    _valueWidthsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
    _valueWidthTextFields = new ArrayList<JXTextField>();

    _addValueWidthButton = WidgetFactory.createSmallButton("images/actions/add.png");
    _addValueWidthButton.addActionListener(new ActionListener() {
View Full Code Here

    return true;
  }

  @Override
  protected List<Entry<String, JComponent>> getFormElements() {
    final DCPanel buttonPanel = new DCPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
    buttonPanel.add(_addValueWidthButton);
    buttonPanel.add(_removeValueWidthButton);

    final DCPanel valueWidthConfigurationPanel = new DCPanel();
    valueWidthConfigurationPanel.setLayout(new BorderLayout());
    valueWidthConfigurationPanel.add(_valueWidthsPanel, BorderLayout.CENTER);
    valueWidthConfigurationPanel.add(buttonPanel, BorderLayout.EAST);
    valueWidthConfigurationPanel.add(_lineWidthLabel, BorderLayout.SOUTH);

    final List<Entry<String, JComponent>> result = super.getFormElements();
    result.add(new ImmutableEntry<String, JComponent>("Character encoding", _encodingComboBox));
    result.add(new ImmutableEntry<String, JComponent>("Column widths", valueWidthConfigurationPanel));
    result.add(new ImmutableEntry<String, JComponent>("", _failOnInconsistenciesCheckBox));
View Full Code Here

    return closing;
  }

  @Override
  protected JComponent getWindowContent() {
    DCPanel panel = new DCPanel(WidgetUtils.BG_COLOR_DARK, WidgetUtils.BG_COLOR_DARK);
    panel.setLayout(new BorderLayout());

    String bannerTitle = "Analysis results";
    String datastoreName = getDatastoreName();
    if (!StringUtils.isNullOrEmpty(datastoreName)) {
      bannerTitle = bannerTitle + "\n" + datastoreName;

      if (!StringUtils.isNullOrEmpty(_jobFilename)) {
        bannerTitle = bannerTitle + " | " + _jobFilename;
      }
    }

    panel.add(new DCBannerPanel(imageManager.getImage("images/window/banner-results.png"), bannerTitle),
        BorderLayout.NORTH);
    panel.add(_tabbedPane, BorderLayout.CENTER);

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int screenWidth = screenSize.width;
    int screenHeight = screenSize.height;

    int height = 550;
    if (screenHeight > 1000) {
      height = 900;
    } else if (screenHeight > 750) {
      height = 700;
    }

    int width = 750;
    if (screenWidth > 1200) {
      width = 1100;
    } else if (screenWidth > 1000) {
      width = 900;
    }

    panel.setPreferredSize(width, height);
    return panel;
  }
View Full Code Here

    }
  }

  @Override
  protected JComponent getDialogContent() {
    DCPanel panel = new DCPanel();

    int row = 0;
    WidgetUtils.addToGridBag(DCLabel.bright("Datastore name:"), panel, 0, row);
    WidgetUtils.addToGridBag(_datastoreNameTextField, panel, 1, row);

    row++;
    WidgetUtils.addToGridBag(DCLabel.bright("Database:"), panel, 0, row);
    WidgetUtils.addToGridBag(_databaseDriverComboBox, panel, 1, row);

    row++;
    WidgetUtils.addToGridBag(DCLabel.bright("Driver class name:"), panel, 0, row);
    WidgetUtils.addToGridBag(_driverClassNameTextField, panel, 1, row);

    row++;
    WidgetUtils.addToGridBag(DCLabel.bright("Connection string:"), panel, 0, row);
    WidgetUtils.addToGridBag(_connectionStringTextField, panel, 1, row);

    row++;
    WidgetUtils.addToGridBag(DCLabel.bright("Username:"), panel, 0, row);
    WidgetUtils.addToGridBag(_usernameTextField, panel, 1, row);

    row++;
    WidgetUtils.addToGridBag(DCLabel.bright("Password:"), panel, 0, row);
    WidgetUtils.addToGridBag(_passwordField, panel, 1, row);

    row++;

    final JButton testButton = WidgetFactory.createButton("Test connection", "images/actions/refresh.png");
    testButton.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent event) {
        JdbcDatastore datastore = createDatastore();
        try {
          Connection connection = datastore.createConnection();
          connection.close();
          JOptionPane.showMessageDialog(JdbcDatastoreDialog.this, "Connection successful!");
        } catch (Throwable e) {
          WidgetUtils.showErrorMessage("Could not establish connection", e);
        }
      }
    });

    final JButton saveButton = WidgetFactory.createButton("Save datastore", "images/model/datastore.png");
    saveButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        JdbcDatastore datastore = createDatastore();

        if (_originalDatastore != null) {
          _catalog.removeDatastore(_originalDatastore);
        }
        _catalog.addDatastore(datastore);
        JdbcDatastoreDialog.this.dispose();
      }
    });

    DCPanel buttonPanel = new DCPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 4, 0));
    buttonPanel.add(testButton);
    buttonPanel.add(saveButton);

    WidgetUtils.addToGridBag(buttonPanel, panel, 1, row, 2, 1);

    return panel;
  }
View Full Code Here

TOP

Related Classes of org.eobjects.datacleaner.panels.DCPanel

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.