Package de.hwrberlin.it11.tsp.persistence

Examples of de.hwrberlin.it11.tsp.persistence.Persister


    Composite comp = new Composite(this, SWT.NONE);
    comp.setLayout(new MigLayout("fill, wrap 3, ins 0", "[pref!][]"));
    comp.setLayoutData("hmin pref, wmin pref, growx, pushx");

    _rIterationCount = new AntButton(new Button(comp, SWT.RADIO), getController().getProject());
    _rIterationCount.getButton().setLayoutData("hmin 0, wmin 0");
    _rIterationCount.getButton().setText("Iterationen:");
    _rIterationCount
        .setTooltipText("Diese Option l�sst den Suchvorgang stoppen, nachdem eine eingestellte Anzahl an Iterationen durchgef�hrt wurden.");

    _tIterationCount = new AntText(new Text(comp, SWT.BORDER), getController().getProject());
    _tIterationCount.getText().setLayoutData("hmin pref, wmin 50, spanx 2, growx");
    _tIterationCount.setTooltipText("Hier k�nnen Sie einstellen, wie oft iteriert werden soll. (X > 0)");
    _tIterationCount.setInputMode(AntText.INTEGER_ONLY);
    _tIterationCount.setNumberRange(1, Double.POSITIVE_INFINITY, false, true);
    _tIterationCount.addValidInputListener(this);

    _rMaximumTourLength = new AntButton(new Button(comp, SWT.RADIO), getController().getProject());
    _rMaximumTourLength.getButton().setLayoutData("hmin 0, wmin 0");
    _rMaximumTourLength.getButton().setText("Tourl�nge:");
    _rMaximumTourLength
        .setTooltipText("Diese Option l�sst den Suchvorgang stoppen, nachdem eine Tour gefunden wurde, die k�rzer oder gleich lang als eine eingestellte L�nge ist.");

    _tMaximumTourLength = new AntText(new Text(comp, SWT.BORDER), getController().getProject());
    _tMaximumTourLength.getText().setLayoutData("hmin pref, wmin 50, spanx 2, growx");
    _tMaximumTourLength.setTooltipText("Hier k�nnen Sie einstellen, bei welcher Tourl�nge abegebrochen werden soll. (X > 0)");
    _tMaximumTourLength.setInputMode(AntText.DOUBLE_ONLY);
    _tMaximumTourLength.setNumberRange(0, Double.POSITIVE_INFINITY, false, true);
    _tMaximumTourLength.addValidInputListener(this);

    _rOptTourFilePath = new AntButton(new Button(comp, SWT.RADIO), getController().getProject());
    _rOptTourFilePath.getButton().setLayoutData("hmin 0, wmin 0");
    _rOptTourFilePath.getButton().setText("Optimale Tour:");
    _rOptTourFilePath.setTooltipText("Diese Option l�sst den Suchvorgang stoppen, wenn eine eingestellte L�sung gefunden wurde.");

    _bOptTourFilePath = new AntButton(new Button(comp, SWT.PUSH), getController().getProject());
    _bOptTourFilePath.getButton().setLayoutData("hmin 0, wmin 0");
    _bOptTourFilePath.getButton().setImage(Images.FOLDER);
    _bOptTourFilePath.setTooltipText("Ein Klick auf diesen Button �ffnet den Datei-Browser, mit dem Sie eine L�sungsdatei aussuchen k�nnen.");
    _bOptTourFilePath.getButton().addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent pE) {
        String path = new FileDialogFactory().setParent(getShell()).setFilter(FileDialogFilter.OPTTOUR).setStyle(SWT.OPEN).open();
        if (path != null) {
          List<Integer> indexList = Persister.loadOptTourFile(new File(path));
          if (indexList.size() - 1 != getController().getProject().getTSPData().getNodeList().size()) {
            MessageDialog
                .openError(getShell(), "Ung�ltige optimale Tour",
                    "Die Liste der Knoten und die Liste der optimalen Tour weisen eine unterschiedliche L�nge auf, somit kann die optimale Tour nicht geladen werden.");
          }
          else {
            getController().getProject().setOptimalTourIndeces(indexList);
          }
        }
        evaluateSolutionAccept();
        evaluateStartEnabled();
      }

    });

    _lAccept = new AntLabel(new Label(comp, SWT.NONE), getController().getProject());
    _lAccept.getLabel().setLayoutData("hmin 0, wmin 0, push");
    _lAccept.getLabel().setImage(Images.CROSS);
    _lAccept.setTooltipText("Zeigt den Status der L�sungsdatei an.");

    SelectionAdapter radioGroupListener = new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent pE) {
        Object source = pE.getSource();
        if (source == _rIterationCount.getButton()) {
          _tIterationCount.getText().setEnabled(true);
          _tMaximumTourLength.getText().setEnabled(false);
          _bOptTourFilePath.getButton().setEnabled(false);
          _lAccept.getLabel().setEnabled(false);
          getController().setIterationMode(IterationMode.COUNT);
        }
        if (source == _rMaximumTourLength.getButton()) {
          _tIterationCount.getText().setEnabled(false);
          _tMaximumTourLength.getText().setEnabled(true);
          _bOptTourFilePath.getButton().setEnabled(false);
          _lAccept.getLabel().setEnabled(false);
          getController().setIterationMode(IterationMode.LENGTH);
        }
        if (source == _rOptTourFilePath.getButton()) {
          _tIterationCount.getText().setEnabled(false);
          _tMaximumTourLength.getText().setEnabled(false);
          _bOptTourFilePath.getButton().setEnabled(true);
          _lAccept.getLabel().setEnabled(true);
          getController().setIterationMode(IterationMode.SOLUTION);
        }
        evaluateStartEnabled();
      }
    };

    Composite buttonComp = new Composite(comp, SWT.NONE);
    buttonComp.setLayout(new MigLayout("ins 0", "[49%][49%]"));
    buttonComp.setLayoutData("hmin 0, wmin 0, spanx, growx");

    _bStart = new AntButton(new Button(buttonComp, SWT.PUSH), getController().getProject());
    _bStart.getButton().setText("START");
    _bStart.getButton().setLayoutData("hmin pref, wmin pref, growx");
    _bStart.setTooltipText("Dieser Button startet und stoppt den Suchvorgang.");
    _bStart.getButton().addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent pE) {
        if (!_buttonStartState) {
          getController().start();
        }
        else {
          getController().stop();
        }
      }
    });

    _bPause = new AntButton(new Button(buttonComp, SWT.PUSH), getController().getProject());
    _bPause.getButton().setText("PAUSE");
    _bPause.getButton().setLayoutData("hmin pref, wmin pref, growx");
    _bPause.setTooltipText("Dieser Button pausiert und setzt den Suchvorgang fort.");
    _bPause.getButton().addSelectionListener(new SelectionAdapter() {
View Full Code Here


    Label simon = new Label(simonComposite, SWT.NONE);
    simon.setText("imon Rodeike");
    simon.setFont(font20Height);
    simon.setLayoutData("hmin pref, wmin pref, growx");

    AntButton confirm = new AntButton(new Button(shell, SWT.PUSH), getProject());
    confirm.getButton().setText("Genug gesehen");
    confirm.getButton().setLayoutData("hmin pref, wmin pref, grow");
    confirm.setTooltipText("Schlie�t den Dialog.");
    confirm.getButton().addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent pE) {
        shell.close();
      }
View Full Code Here

    Composite buttonComp = new Composite(shell, SWT.NONE);
    buttonComp.setLayout(new MigLayout("wrap 2, ins 0", "[50%][50%]"));
    buttonComp.setLayoutData("hmin 0, wmin 0, growx, spanx");

    AntButton confirm = new AntButton(new Button(buttonComp, SWT.PUSH), getProject());
    confirm.getButton().setText("Speichern");
    confirm.getButton().setLayoutData("hmin pref, wmin pref, grow");
    confirm.setTooltipText("Speichert die Daten und schlie�t den Dialog.");
    confirm.getButton().addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent pE) {
        _tspData.setName(tName.getText().getText());
        _tspData.setComment(tName.getText().getText());

        shell.dispose();
      }
    });

    AntButton cancel = new AntButton(new Button(buttonComp, SWT.PUSH), getProject());
    cancel.getButton().setText("Abbrechen");
    cancel.getButton().setLayoutData("hmin pref, wmin pref, grow");
    cancel.setTooltipText("Schlie�t den Dialog ohne eine Bearbeitung der Daten vorzunehmen.");
    cancel.getButton().addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent pE) {
        shell.dispose();
      }
View Full Code Here

    Label lNodeColor = new Label(shell, SWT.NONE);
    lNodeColor.setText("Farbe der Knoten:");
    lNodeColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cNodeColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cNodeColor.setBackground(preferences.getNodeColor());
    cNodeColor.getComposite().setLayoutData("height 20!, wmin 50");
    cNodeColor.setTooltipText("Hier k�nnen Sie die Farbe einstellen, mit der die Knoten gezeichnet werden.");
    cNodeColor.getComposite().addMouseListener(new ChooseColorListener(cNodeColor));

    Label lCurrentNodeColor = new Label(shell, SWT.NONE);
    lCurrentNodeColor.setText("Farbe der ausgew�hlten Knoten:");
    lCurrentNodeColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cCurrentNodeColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cCurrentNodeColor.setBackground(preferences.getCurrentNodeColor());
    cCurrentNodeColor.getComposite().setLayoutData("height 20!, wmin 50");
    cCurrentNodeColor.setTooltipText("Hier k�nnen Sie die Farbe einstellen, mit der die ausgew�hlten Knoten gezeichnet werden.");
    cCurrentNodeColor.getComposite().addMouseListener(new ChooseColorListener(cCurrentNodeColor));

    Label lBestTourGlobalColor = new Label(shell, SWT.NONE);
    lBestTourGlobalColor.setText("Farbe der besten globalen Tour:");
    lBestTourGlobalColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cBestTourGlobalColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cBestTourGlobalColor.setBackground(preferences.getBestTourGlobalColor());
    cBestTourGlobalColor.getComposite().setLayoutData("height 20!, wmin 50");
    cBestTourGlobalColor.setTooltipText("Hier k�nnen Sie die Farbe einstellen, mit der die Linien der globalen besten Tour gezeichnet werden.");
    cBestTourGlobalColor.getComposite().addMouseListener(new ChooseColorListener(cBestTourGlobalColor));

    Label lBestTourIterationColor = new Label(shell, SWT.NONE);
    lBestTourIterationColor.setText("Farbe der besten Tour der Iteration:");
    lBestTourIterationColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cBestTourIterationColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cBestTourIterationColor.setBackground(preferences.getBestTourIterationColor());
    cBestTourIterationColor.getComposite().setLayoutData("height 20!, wmin 50");
    cBestTourIterationColor
        .setTooltipText("Hier k�nnen Sie die Farbe einstellen, mit der die Linien der besten Tour der Iteration gezeichnet werden.");
    cBestTourIterationColor.getComposite().addMouseListener(new ChooseColorListener(cBestTourIterationColor));

    Label lBackgroundColor = new Label(shell, SWT.NONE);
    lBackgroundColor.setText("Farbe des Malfl�chenhintergrundes:");
    lBackgroundColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cBackgroundColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cBackgroundColor.setBackground(preferences.getBackgroundColor());
    cBackgroundColor.getComposite().setLayoutData("height 20!, wmin 50");
    cBackgroundColor.setTooltipText("Hier k�nnen Sie die Hintergrundfarbe der Malfl�che einstellen.");
    cBackgroundColor.getComposite().addMouseListener(new ChooseColorListener(cBackgroundColor));

    Composite buttonComp = new Composite(shell, SWT.NONE);
    buttonComp.setLayout(new MigLayout("wrap 2, ins 0", "[50%][50%]"));
    buttonComp.setLayoutData("hmin 0, wmin 0, growx, spanx");

    AntButton confirm = new AntButton(new Button(buttonComp, SWT.PUSH), getProject());
    confirm.getButton().setText("Speichern");
    confirm.getButton().setLayoutData("hmin pref, wmin pref, grow");
    confirm.setTooltipText("Speichert die Eigenschaften und schlie�t den Dialog.");
    confirm.getButton().addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent pE) {
        if (tRedrawInterval.isValidInput()) {
          try {
            preferences.setAntialias(bAntialias.getButton().getSelection());
            preferences.setRedrawInterval(Utility.FORMAT.parse(tRedrawInterval.getText().getText()).intValue());
            preferences.setNodeColor(cNodeColor.getBackground());
            preferences.setCurrentNodeColor(cCurrentNodeColor.getBackground());
            preferences.setBestTourGlobalColor(cBestTourGlobalColor.getBackground());
            preferences.setBestTourIterationColor(cBestTourIterationColor.getBackground());
            preferences.setBackgroundColor(cBackgroundColor.getBackground());
          }
          catch (ParseException e) {
            MessageDialog.openError(shell, "Fehler beim umwandeln der Werte",
                "Beim Umwandeln der Werte von Text in eine Zahl ist ein Fehler aufgetreten.");
          }
View Full Code Here

    shell.setText("Farbe w�hlen");
    shell.setImage(Images.COLOR_SWATCH);
    shell.setLayout(new MigLayout("fill, wrap 4"));
    shell.setLayoutData("hmin pref, wmin pref");

    AntComposite black = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    black.setBackground(Colors.BLACK);
    black.getComposite().setLayoutData("height 20!, width 50!");
    black.getComposite().addMouseListener(new ChosenColorListener(black));

    AntComposite darkGrey = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    darkGrey.setBackground(Colors.DARK_GREY);
    darkGrey.getComposite().setLayoutData("height 20!, width 50!");
    darkGrey.getComposite().addMouseListener(new ChosenColorListener(darkGrey));

    AntComposite grey = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    grey.setBackground(Colors.GREY);
    grey.getComposite().setLayoutData("height 20!, width 50!");
    grey.getComposite().addMouseListener(new ChosenColorListener(grey));

    AntComposite white = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    white.setBackground(Colors.WHITE);
    white.getComposite().setLayoutData("height 20!, width 50!");
    white.getComposite().addMouseListener(new ChosenColorListener(white));

    AntComposite darkBlue = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    darkBlue.setBackground(Colors.DARK_BLUE);
    darkBlue.getComposite().setLayoutData("height 20!, width 50!");
    darkBlue.getComposite().addMouseListener(new ChosenColorListener(darkBlue));

    AntComposite blue = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    blue.setBackground(Colors.BLUE);
    blue.getComposite().setLayoutData("height 20!, width 50!");
    blue.getComposite().addMouseListener(new ChosenColorListener(blue));

    AntComposite darkCyan = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    darkCyan.setBackground(Colors.DARK_CYAN);
    darkCyan.getComposite().setLayoutData("height 20!, width 50!");
    darkCyan.getComposite().addMouseListener(new ChosenColorListener(darkCyan));

    AntComposite cyan = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cyan.setBackground(Colors.CYAN);
    cyan.getComposite().setLayoutData("height 20!, width 50!");
    cyan.getComposite().addMouseListener(new ChosenColorListener(cyan));

    AntComposite darkRed = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    darkRed.setBackground(Colors.DARK_RED);
    darkRed.getComposite().setLayoutData("height 20!, width 50!");
    darkRed.getComposite().addMouseListener(new ChosenColorListener(darkRed));

    AntComposite red = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    red.setBackground(Colors.RED);
    red.getComposite().setLayoutData("height 20!, width 50!");
    red.getComposite().addMouseListener(new ChosenColorListener(red));

    AntComposite darkMagenta = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    darkMagenta.setBackground(Colors.DARK_MAGENTA);
    darkMagenta.getComposite().setLayoutData("height 20!, width 50!");
    darkMagenta.getComposite().addMouseListener(new ChosenColorListener(darkMagenta));

    AntComposite magenta = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    magenta.setBackground(Colors.MAGENTA);
    magenta.getComposite().setLayoutData("height 20!, width 50!");
    magenta.getComposite().addMouseListener(new ChosenColorListener(magenta));

    AntComposite darkGreen = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    darkGreen.setBackground(Colors.DARK_GREEN);
    darkGreen.getComposite().setLayoutData("height 20!, width 50!");
    darkGreen.getComposite().addMouseListener(new ChosenColorListener(darkGreen));

    AntComposite green = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    green.setBackground(Colors.GREEN);
    green.getComposite().setLayoutData("height 20!, width 50!");
    green.getComposite().addMouseListener(new ChosenColorListener(green));

    AntComposite darkYellow = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    darkYellow.setBackground(Colors.DARK_YELLOW);
    darkYellow.getComposite().setLayoutData("height 20!, width 50!");
    darkYellow.getComposite().addMouseListener(new ChosenColorListener(darkYellow));

    AntComposite yellow = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    yellow.setBackground(Colors.YELLOW);
    yellow.getComposite().setLayoutData("height 20!, width 50!");
    yellow.getComposite().addMouseListener(new ChosenColorListener(yellow));

    Composite buttonComp = new Composite(shell, SWT.NONE);
    buttonComp.setLayout(new MigLayout("wrap 2, ins 0", "[50%][50%]"));
    buttonComp.setLayoutData("hmin 0, wmin 0, growx, spanx");
View Full Code Here

        evaluateStartEnabled();
      }

    });

    _lAccept = new AntLabel(new Label(comp, SWT.NONE), getController().getProject());
    _lAccept.getLabel().setLayoutData("hmin 0, wmin 0, push");
    _lAccept.getLabel().setImage(Images.CROSS);
    _lAccept.setTooltipText("Zeigt den Status der L�sungsdatei an.");

    SelectionAdapter radioGroupListener = new SelectionAdapter() {
View Full Code Here

    data.setHeight(20);
    final Font font20Height = new Font(null, data);
    data.setStyle(SWT.BOLD);
    final Font font20HeightBold = new Font(null, data);

    AntLabel picture = new AntLabel(new Label(shell, SWT.NONE), getProject());
    picture.getLabel().setImage(Images.MOPSS);
    picture.getLabel().setLayoutData("hmin pref, wmin pref, growx");
    picture.setTooltipText("Das Firmenlogo von MOPS� Productions.");

    Composite teamComposite = new Composite(shell, SWT.NONE);
    teamComposite.setLayout(new MigLayout("wrap, ins 0"));
    teamComposite.setLayoutData("hmin pref, wmin pref, alignx center");
View Full Code Here

    _scrolledComposite.setExpandHorizontal(true);
    _scrolledComposite.setExpandVertical(true);

    _canvas = new Canvas(_scrolledComposite, SWT.DOUBLE_BUFFERED);

    _zoomFactor = new AntScale(new Scale(this, SWT.VERTICAL), getController().getProject());
    _zoomFactor.getScale().setLayoutData("hmin 0, wmin pref, growy");
    _zoomFactor.getScale().setMinimum(5);
    _zoomFactor.getScale().setMaximum(300);
    _zoomFactor.setTooltipText("Hier k�nnen Sie den Zoom-Faktor einstellen, mit dem die Knoten und Kanten dargestellt werden.");
View Full Code Here

    Label lRedrawInterval = new Label(shell, SWT.NONE);
    lRedrawInterval.setText("Neuzeichnungsintervall:");
    lRedrawInterval.setLayoutData("hmin pref, wmin pref");

    final AntText tRedrawInterval = new AntText(new Text(shell, SWT.BORDER), getProject());
    tRedrawInterval.getText().setText(Utility.FORMAT.format(preferences.getRedrawInterval()));
    tRedrawInterval.getText().setLayoutData("hmin pref, wmin pref, grow");
    tRedrawInterval.setTooltipText("Hier k�nnen Sie einstellen, nach wie vielen Iterationen neu gezeichnet werden soll. (X > 0)");
    tRedrawInterval.setInputMode(AntText.INTEGER_ONLY);
    tRedrawInterval.setNumberRange(1, Double.POSITIVE_INFINITY, true, true);

    Label lNodeColor = new Label(shell, SWT.NONE);
    lNodeColor.setText("Farbe der Knoten:");
    lNodeColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cNodeColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cNodeColor.setBackground(preferences.getNodeColor());
    cNodeColor.getComposite().setLayoutData("height 20!, wmin 50");
    cNodeColor.setTooltipText("Hier k�nnen Sie die Farbe einstellen, mit der die Knoten gezeichnet werden.");
    cNodeColor.getComposite().addMouseListener(new ChooseColorListener(cNodeColor));

    Label lCurrentNodeColor = new Label(shell, SWT.NONE);
    lCurrentNodeColor.setText("Farbe der ausgew�hlten Knoten:");
    lCurrentNodeColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cCurrentNodeColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cCurrentNodeColor.setBackground(preferences.getCurrentNodeColor());
    cCurrentNodeColor.getComposite().setLayoutData("height 20!, wmin 50");
    cCurrentNodeColor.setTooltipText("Hier k�nnen Sie die Farbe einstellen, mit der die ausgew�hlten Knoten gezeichnet werden.");
    cCurrentNodeColor.getComposite().addMouseListener(new ChooseColorListener(cCurrentNodeColor));

    Label lBestTourGlobalColor = new Label(shell, SWT.NONE);
    lBestTourGlobalColor.setText("Farbe der besten globalen Tour:");
    lBestTourGlobalColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cBestTourGlobalColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cBestTourGlobalColor.setBackground(preferences.getBestTourGlobalColor());
    cBestTourGlobalColor.getComposite().setLayoutData("height 20!, wmin 50");
    cBestTourGlobalColor.setTooltipText("Hier k�nnen Sie die Farbe einstellen, mit der die Linien der globalen besten Tour gezeichnet werden.");
    cBestTourGlobalColor.getComposite().addMouseListener(new ChooseColorListener(cBestTourGlobalColor));

    Label lBestTourIterationColor = new Label(shell, SWT.NONE);
    lBestTourIterationColor.setText("Farbe der besten Tour der Iteration:");
    lBestTourIterationColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cBestTourIterationColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cBestTourIterationColor.setBackground(preferences.getBestTourIterationColor());
    cBestTourIterationColor.getComposite().setLayoutData("height 20!, wmin 50");
    cBestTourIterationColor
        .setTooltipText("Hier k�nnen Sie die Farbe einstellen, mit der die Linien der besten Tour der Iteration gezeichnet werden.");
    cBestTourIterationColor.getComposite().addMouseListener(new ChooseColorListener(cBestTourIterationColor));

    Label lBackgroundColor = new Label(shell, SWT.NONE);
    lBackgroundColor.setText("Farbe des Malfl�chenhintergrundes:");
    lBackgroundColor.setLayoutData("hmin pref, wmin pref");

    final AntComposite cBackgroundColor = new AntComposite(new Composite(shell, SWT.BORDER), getProject());
    cBackgroundColor.setBackground(preferences.getBackgroundColor());
    cBackgroundColor.getComposite().setLayoutData("height 20!, wmin 50");
    cBackgroundColor.setTooltipText("Hier k�nnen Sie die Hintergrundfarbe der Malfl�che einstellen.");
    cBackgroundColor.getComposite().addMouseListener(new ChooseColorListener(cBackgroundColor));

    Composite buttonComp = new Composite(shell, SWT.NONE);
    buttonComp.setLayout(new MigLayout("wrap 2, ins 0", "[50%][50%]"));
    buttonComp.setLayoutData("hmin 0, wmin 0, growx, spanx");

    AntButton confirm = new AntButton(new Button(buttonComp, SWT.PUSH), getProject());
    confirm.getButton().setText("Speichern");
    confirm.getButton().setLayoutData("hmin pref, wmin pref, grow");
    confirm.setTooltipText("Speichert die Eigenschaften und schlie�t den Dialog.");
    confirm.getButton().addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent pE) {
        if (tRedrawInterval.isValidInput()) {
          try {
            preferences.setAntialias(bAntialias.getButton().getSelection());
            preferences.setRedrawInterval(Utility.FORMAT.parse(tRedrawInterval.getText().getText()).intValue());
            preferences.setNodeColor(cNodeColor.getBackground());
            preferences.setCurrentNodeColor(cCurrentNodeColor.getBackground());
            preferences.setBestTourGlobalColor(cBestTourGlobalColor.getBackground());
            preferences.setBestTourIterationColor(cBestTourIterationColor.getBackground());
            preferences.setBackgroundColor(cBackgroundColor.getBackground());
View Full Code Here

    Label lNodeCount = new Label(shell, SWT.NONE);
    lNodeCount.setText("Anzahl der St�dte:");
    lNodeCount.setLayoutData("hmin pref, wmin pref");

    final AntText tNodeCount = new AntText(new Text(shell, SWT.BORDER), getProject());
    tNodeCount.getText().setText("0");
    tNodeCount.getText().setLayoutData("hmin pref, wmin 50, growx");
    tNodeCount.setTooltipText("Tragen Sie hier die Anzahl der Knoten ein. F�r einen zuf�lligen Wert von 1 bis 100 tragen Sie 0 ein. (X >= 0)");
    tNodeCount.setInputMode(AntText.INTEGER_ONLY);
    tNodeCount.setNumberRange(0, Double.POSITIVE_INFINITY, true, true);

    Label lMaxXCoordinate = new Label(shell, SWT.NONE);
    lMaxXCoordinate.setText("Maximale X Koordinate:");
    lMaxXCoordinate.setLayoutData("hmin pref, wmin pref");

    final AntText tMaxXCoordinate = new AntText(new Text(shell, SWT.BORDER), getProject());
    tMaxXCoordinate.getText().setText("0");
    tMaxXCoordinate.getText().setLayoutData("hmin pref, wmin 50, growx");
    tMaxXCoordinate
        .setTooltipText("Tragen Sie hier den maximalen Wert der X Koordinate ein, den ein Knoten haben kann. F�r einen zuf�lligen Wert von 1 bis 5000 tragen Sie 0 ein. (X >= 0)");
    tMaxXCoordinate.setInputMode(AntText.DOUBLE_ONLY);
    tMaxXCoordinate.setNumberRange(0, Double.POSITIVE_INFINITY, true, true);

    Label lMaxYCoordinate = new Label(shell, SWT.NONE);
    lMaxYCoordinate.setText("Maximale Y Koordinate:");
    lMaxYCoordinate.setLayoutData("hmin pref, wmin pref");

    final AntText tMaxYCoordinate = new AntText(new Text(shell, SWT.BORDER), getProject());
    tMaxYCoordinate.getText().setText("0");
    tMaxYCoordinate.getText().setLayoutData("hmin pref, wmin 50, growx");
    tMaxYCoordinate
        .setTooltipText("Tragen Sie hier den maximalen Wert der Y Koordinate ein, den ein Knoten haben kann. F�r einen zuf�lligen Wert von 1 bis 5000 tragen Sie 0 ein. (X >= 0)");
    tMaxYCoordinate.setInputMode(AntText.DOUBLE_ONLY);
    tMaxYCoordinate.setNumberRange(0, Double.POSITIVE_INFINITY, true, true);

    Composite buttonComp = new Composite(shell, SWT.NONE);
    buttonComp.setLayout(new MigLayout("wrap 2, ins 0", "[50%][50%]"));
    buttonComp.setLayoutData("hmin 0, wmin 0, growx, spanx");

    AntButton confirm = new AntButton(new Button(buttonComp, SWT.PUSH), getProject());
    confirm.getButton().setText("Erstellen");
    confirm.getButton().setLayoutData("hmin pref, wmin pref, grow");
    confirm.setTooltipText("Erstellt ein neues Projekt und schlie�t den Dialog.");
    confirm.getButton().addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent pE) {
        if (tNodeCount.isValidInput() && tMaxXCoordinate.isValidInput() && tMaxYCoordinate.isValidInput()) {
          List<Node> nodeList = new ArrayList<Node>();
          int nodeCount;
          try {
            nodeCount = Utility.FORMAT.parse(tNodeCount.getText().getText()).intValue();
            double maxX = Utility.FORMAT.parse(tMaxXCoordinate.getText().getText()).doubleValue();
            double maxY = Utility.FORMAT.parse(tMaxYCoordinate.getText().getText()).doubleValue();
            if (nodeCount == 0) {
              nodeCount = (int) (Math.random() * 99) + 1;
            }
            if (maxX == 0) {
              maxX = (int) (Math.random() * 4999) + 1;
View Full Code Here

TOP

Related Classes of de.hwrberlin.it11.tsp.persistence.Persister

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.