static {
   String colorStr =
       ParameterService.getParameterValue(
           MainFrame.PROPERTY_RAPIDMINER_GUI_MESSAGEVIEWER_HIGHLIGHT_LOGSERVICE);
   if (colorStr != null) {
     COLOR_DEFAULT = ParameterTypeColor.string2Color(colorStr);
   } else {
     COLOR_DEFAULT = Color.BLACK;
   }
   colorStr =
       ParameterService.getParameterValue(
           MainFrame.PROPERTY_RAPIDMINER_GUI_MESSAGEVIEWER_HIGHLIGHT_NOTES);
   if (colorStr != null) {
     COLOR_INFO = ParameterTypeColor.string2Color(colorStr);
   } else {
     COLOR_INFO = Color.BLACK;
   }
   colorStr =
       ParameterService.getParameterValue(
           MainFrame.PROPERTY_RAPIDMINER_GUI_MESSAGEVIEWER_HIGHLIGHT_WARNINGS);
   if (colorStr != null) {
     COLOR_WARNING = ParameterTypeColor.string2Color(colorStr);
   } else {
     COLOR_WARNING = Color.BLACK;
   }
   colorStr =
       ParameterService.getParameterValue(
           MainFrame.PROPERTY_RAPIDMINER_GUI_MESSAGEVIEWER_HIGHLIGHT_ERRORS);
   if (colorStr != null) {
     COLOR_ERROR = ParameterTypeColor.string2Color(colorStr);
   } else {
     COLOR_ERROR = Color.BLACK;
   }
 }
  /** Trains a model using an ExampleSet from the input. Uses the method learn(ExampleSet). */
  @Override
  public void doWork() throws OperatorException {
    ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);

    // some checks
    if (exampleSet.getAttributes().getLabel() == null) {
      throw new UserError(this, 105, new Object[0]);
    }
    if (exampleSet.getAttributes().size() == 0) {
      throw new UserError(this, 106, new Object[0]);
    }

    // check capabilities and produce errors if they are not fulfilled
    CapabilityCheck check =
        new CapabilityCheck(
            this,
            Tools.booleanValue(
                ParameterService.getParameterValue(
                    CapabilityProvider.PROPERTY_RAPIDMINER_GENERAL_CAPABILITIES_WARN),
                true));
    check.checkLearnerCapabilities(this, exampleSet);

    Model model = learn(exampleSet);

    modelOutput.deliver(model);
    exampleSetOutput.deliver(exampleSet);
  }
  public String getErrorName() {
    String deflt = "Unnamed plotter error.";
    if (Boolean.valueOf(
        ParameterService.getParameterValue(RapidMiner.PROPERTY_RAPIDMINER_GENERAL_DEBUGMODE))) {
      deflt += " (" + errorId + ")";
    }

    return getResourceString(errorId, NAME_KEY, deflt);
  }
 private static Level getSpecifiedLogLevelIndex() {
   String value = ParameterService.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_LOG_LEVEL);
   if (value == null) {
     return Level.CONFIG;
   } else {
     for (int i = 0; i < SELECTABLE_LEVEL_NAMES.length; i++) {
       if (SELECTABLE_LEVEL_NAMES[i].equals(value)) {
         return SELECTABLE_LEVELS[i];
       }
     }
     return Level.CONFIG;
   }
 }
 {
   String encoding = RapidMiner.SYSTEM_ENCODING_NAME;
   String encodingProperty =
       ParameterService.getParameterValue(RapidMiner.PROPERTY_RAPIDMINER_GENERAL_DEFAULT_ENCODING);
   if (encodingProperty != null) {
     encoding = encodingProperty;
   }
   encodingComboBox.setSelectedItem(encoding);
   encodingComboBox.setPreferredSize(new Dimension(encodingComboBox.getPreferredSize().width, 25));
   encodingComboBox.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           settingsChanged();
         }
       });
 }
  @Override
  public void windowClosed(WindowEvent e) {
    boolean betaActiveNow =
        Boolean.parseBoolean(
            ParameterService.getParameterValue(
                RapidMiner.PROPERTY_RAPIDMINER_UPDATE_BETA_FEATURES));
    if (!betaActiveBefore && betaActiveNow) {
      JTextArea textArea = new JTextArea();
      textArea.setColumns(60);
      textArea.setRows(15);
      textArea.setLineWrap(true);
      textArea.setWrapStyleWord(true);
      textArea.setEditable(false);
      textArea.setText(loadBetaEULA());
      textArea.setBorder(null);
      textArea.setCaretPosition(0);

      JScrollPane scrollPane = new ExtendedJScrollPane(textArea);
      scrollPane.setBorder(BorderFactory.createLineBorder(Colors.TEXTFIELD_BORDER));

      ButtonDialog dialog =
          new ButtonDialogBuilder("beta_features_eula")
              .setOwner(ApplicationFrame.getApplicationFrame())
              .setButtons(DefaultButtons.OK_BUTTON, DefaultButtons.CANCEL_BUTTON)
              .setModalityType(ModalityType.APPLICATION_MODAL)
              .setContent(scrollPane, ButtonDialog.DEFAULT_SIZE)
              .build();
      dialog.setVisible(true);
      if (!dialog.wasConfirmed()) {
        ParameterService.setParameterValue(
            RapidMiner.PROPERTY_RAPIDMINER_UPDATE_BETA_FEATURES, String.valueOf(false));
        ActionStatisticsCollector.INSTANCE.log(
            ActionStatisticsCollector.TYPE_BETA_FEATURES,
            ActionStatisticsCollector.VALUE_BETA_FEATURES_ACTIVATION,
            "cancelled");
      }
    }
  }
  private LoggingViewer(JTextPane textArea) {
    super(new BorderLayout());
    final Level level = getSpecifiedLogLevelIndex();
    handler.setLevel(level);
    LogService.getRoot().setLevel(level);
    maxRows = 1000;
    try {
      String maxRowsString =
          ParameterService.getParameterValue(
              MainFrame.PROPERTY_RAPIDMINER_GUI_MESSAGEVIEWER_ROWLIMIT);
      if (maxRowsString != null) maxRows = Integer.parseInt(maxRowsString);
    } catch (NumberFormatException e) {
      // LogService.getGlobal().log("Bad integer format for property '', using default number of
      // maximum rows for logging (1000).", LogService.WARNING);
      LogService.getRoot()
          .log(
              Level.WARNING,
              "com.rapidminer.gui.tools.LoggingViewer.bad_integer_format_for_property");
    }

    this.textArea = textArea;
    this.textArea.setToolTipText(
        "Displays logging messages according to the current log verbosity (parameter of root operator).");
    this.textArea.setEditable(false);
    this.textArea.addMouseListener(this);
    this.textArea.setFont(this.textArea.getFont().deriveFont(Font.PLAIN));
    LogService.getRoot().addHandler(handler);

    JToolBar toolBar = new ExtendedJToolBar();
    toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));
    toolBar.add(SAVE_LOGFILE_ACTION);
    toolBar.add(CLEAR_MESSAGE_VIEWER_ACTION);
    toolBar.add(SEARCH_ACTION);
    add(toolBar, BorderLayout.NORTH);
    JScrollPane scrollPane = new ExtendedJScrollPane(textArea);
    scrollPane.setBorder(null);
    add(scrollPane, BorderLayout.CENTER);
  }
 protected PerformanceVector getPerformance(boolean cloneInput) {
   try {
     inputExtender.passDataThrough();
     executeSubprocess();
     if (isPerformanceRequired()) {
       return getPerformanceInnerSink().getData(PerformanceVector.class);
     } else {
       return getPerformanceInnerSink().getDataOrNull(PerformanceVector.class);
     }
   } catch (OperatorException e) {
     StringBuilder builder = new StringBuilder();
     builder.append(this.getName());
     builder.append(
         ": Cannot evaluate performance for current parameter combination because of an error in one of the inner operators: ");
     builder.append(e.getMessage());
     getLogger().severe(builder.toString());
     //            getLogger().severe("Cannot evaluate performance for current parameter
     // combination: " + e.getMessage());
     if (Boolean.parseBoolean(
         ParameterService.getParameterValue(RapidMiner.PROPERTY_RAPIDMINER_GENERAL_DEBUGMODE)))
       e.printStackTrace();
     return null;
   }
 }
  public RepositoryLocationChooser(
      Dialog owner,
      RepositoryLocation resolveRelativeTo,
      String initialValue,
      final boolean allowEntries,
      final boolean allowFolders,
      boolean enforceValidRepositoryEntryName,
      final boolean onlyWriteableRepositories) {
    if (initialValue != null) {
      try {
        RepositoryLocation repositoryLocation;
        if (resolveRelativeTo != null) {
          repositoryLocation = new RepositoryLocation(resolveRelativeTo, initialValue);
        } else {
          repositoryLocation = new RepositoryLocation(initialValue);
        }
        locationField.setText(repositoryLocation.getName());
        locationFieldRepositoryEntry.setText(repositoryLocation.getName());
        resultLabel.setText(repositoryLocation.toString());
      } catch (Exception e) {
      }
    }
    this.resolveRelativeTo = resolveRelativeTo;
    this.enforceValidRepositoryEntryName = enforceValidRepositoryEntryName;
    tree = new RepositoryTree(owner, !allowEntries, onlyWriteableRepositories);

    if (initialValue != null) {
      if (tree.expandIfExists(resolveRelativeTo, initialValue)) {
        locationField.setText("");
        locationFieldRepositoryEntry.setText("");
      }
    }
    tree.getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {

              @Override
              public void valueChanged(TreeSelectionEvent e) {
                if (e.getPath() != null) {
                  currentEntry = (Entry) e.getPath().getLastPathComponent();
                  if (currentEntry instanceof Folder) { //  && allowFolders)) {
                    //						locationField.setText("");
                  } else if ((!(currentEntry instanceof Folder)) && allowEntries) {
                    //					if (true) {
                    //							//!(currentEntry instanceof Folder)) {
                    locationField.setText(currentEntry.getLocation().getName());
                    locationFieldRepositoryEntry.setText(currentEntry.getLocation().getName());
                  }
                  updateResult();
                }
              }
            });
    KeyListener keyListener =
        new KeyListener() {
          @Override
          public void keyPressed(KeyEvent e) {}

          @Override
          public void keyReleased(KeyEvent e) {
            updateResult();
          }

          @Override
          public void keyTyped(KeyEvent e) {
            TreePath selectionPath = tree.getSelectionPath();
            if (selectionPath != null) {
              Entry selectedEntry = (Entry) selectionPath.getLastPathComponent();
              if (!(selectedEntry instanceof Folder)) {
                tree.setSelectionPath(selectionPath.getParentPath());
              }
            }
          }
        };
    locationField.addKeyListener(keyListener);
    locationFieldRepositoryEntry.addKeyListener(keyListener);
    locationFieldRepositoryEntry.addObserver(this, true);

    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(0, 0, 0, 0);
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 1;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.gridwidth = GridBagConstraints.REMAINDER;

    JScrollPane treePane = new ExtendedJScrollPane(tree);
    treePane.setBorder(ButtonDialog.createBorder());
    add(treePane, c);

    c.insets = new Insets(ButtonDialog.GAP, 0, 0, ButtonDialog.GAP);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.weightx = 0;
    locationLabel = new ResourceLabel("repository_chooser.entry_name");
    locationLabel.setLabelFor(locationField);
    add(locationLabel, c);

    c.weightx = 1;
    c.insets = new Insets(ButtonDialog.GAP, 0, 0, 0);
    c.weightx = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    add(locationField, c);
    add(locationFieldRepositoryEntry, c);
    if (enforceValidRepositoryEntryName) {
      locationField.setVisible(false);
    } else {
      locationFieldRepositoryEntry.setVisible(false);
    }

    c.gridwidth = GridBagConstraints.RELATIVE;
    c.weightx = 0;
    c.insets = new Insets(ButtonDialog.GAP, 0, 0, ButtonDialog.GAP);
    add(new ResourceLabel("repository_chooser.location"), c);
    c.weightx = 1;
    c.insets = new Insets(ButtonDialog.GAP, 0, 0, 0);
    c.gridwidth = GridBagConstraints.REMAINDER;
    add(resultLabel, c);

    if (resolveRelativeTo != null) {
      resolveBox =
          new JCheckBox(
              new ResourceActionAdapter(
                  "repository_chooser.resolve", resolveRelativeTo.getAbsoluteLocation()));
      resolveBox.setSelected(
          ParameterService.getParameterValue(
                  RapidMinerGUI.PROPERTY_RESOLVE_RELATIVE_REPOSITORY_LOCATIONS)
              .equals("true"));
      add(resolveBox, c);
      resolveBox.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              updateResult();
            }
          });
    }
  }
 /** Constructs a listener for beta features activation. */
 BetaFeaturesListener() {
   betaActiveBefore =
       Boolean.parseBoolean(
           ParameterService.getParameterValue(
               RapidMiner.PROPERTY_RAPIDMINER_UPDATE_BETA_FEATURES));
 }