Example usage for java.awt.event ActionEvent getSource

List of usage examples for java.awt.event ActionEvent getSource

Introduction

In this page you can find the example usage for java.awt.event ActionEvent getSource.

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:ch.algotrader.client.chart.ChartTab.java

private void initMarker(SeriesDefinitionVO seriesDefinition) {

    final MarkerDefinitionVO markerDefinition = (MarkerDefinitionVO) seriesDefinition;

    final Marker marker;
    if (markerDefinition.isInterval()) {
        marker = new IntervalMarker(0, 0);
        marker.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT); // position of the label
        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); // position of the text within the label
    } else {/* w  w  w. j a v  a2  s . c om*/
        marker = new ValueMarker(0);
        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
    }

    marker.setPaint(getColor(markerDefinition.getColor()));
    marker.setLabel(markerDefinition.getLabel());
    marker.setLabelFont(new Font("SansSerif", 0, 9));

    if (seriesDefinition.isDashed()) {
        marker.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f,
                new float[] { 5.0f }, 0.0f));
    } else {
        marker.setStroke(new BasicStroke(1.0f));
    }

    getPlot().addRangeMarker(marker, markerDefinition.isInterval() ? Layer.BACKGROUND : Layer.FOREGROUND);

    this.markers.put(markerDefinition.getName(), marker);
    this.markersSelectionStatus.put(markerDefinition.getName(), seriesDefinition.isSelected());

    // add the menu item
    JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(seriesDefinition.getLabel());
    menuItem.setSelected(seriesDefinition.isSelected());
    menuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            resetAxis();
            boolean selected = ((JCheckBoxMenuItem) e.getSource()).isSelected();
            ChartTab.this.markersSelectionStatus.put(markerDefinition.getName(), selected);
            if (selected) {
                if (marker instanceof ValueMarker) {
                    marker.setAlpha(1.0f);
                } else {
                    marker.setAlpha(0.5f);
                }
            } else {
                marker.setAlpha(0);
            }
            initAxis();
        }
    });
    this.getPopupMenu().add(menuItem);
}

From source file:ch.algotrader.client.chart.ChartTab.java

private void initTimeSeries(int datasetNumber, XYDataset dataset, SeriesDefinitionVO seriesDefinition) {

    IndicatorDefinitionVO indicatorDefinition = (IndicatorDefinitionVO) seriesDefinition;
    TimeSeriesCollection timeSeriesCollection = (TimeSeriesCollection) dataset;

    // create the TimeSeries
    TimeSeries series = new TimeSeries(indicatorDefinition.getLabel());
    timeSeriesCollection.addSeries(series);
    this.indicators.put(indicatorDefinition.getName(), series);

    // get the seriesNumber & color
    final int seriesNumber = timeSeriesCollection.getSeriesCount() - 1;

    // configure the renderer
    final XYItemRenderer renderer = getPlot().getRenderer(datasetNumber);
    renderer.setSeriesPaint(seriesNumber, getColor(indicatorDefinition.getColor()));
    renderer.setSeriesVisible(seriesNumber, seriesDefinition.isSelected());
    renderer.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());

    if (seriesDefinition.isDashed()) {
        renderer.setSeriesStroke(seriesNumber, new BasicStroke(0.5f, BasicStroke.CAP_BUTT,
                BasicStroke.JOIN_MITER, 10.0f, new float[] { 5.0f }, 0.0f));
    } else {/* w w  w.j a  va 2 s  .c  o m*/
        renderer.setSeriesStroke(seriesNumber, new BasicStroke(0.5f));
    }

    // add the menu item
    JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(seriesDefinition.getLabel());
    menuItem.setSelected(seriesDefinition.isSelected());
    menuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            resetAxis();
            renderer.setSeriesVisible(seriesNumber, ((JCheckBoxMenuItem) e.getSource()).isSelected());
            initAxis();
        }
    });
    this.getPopupMenu().add(menuItem);
}

From source file:edu.ucla.stat.SOCR.chart.SuperPieChart.java

public void actionPerformed(ActionEvent event) {
    if (event.getSource() == addButton3) {
        addButtonPullout();//from   w  w  w  . ja va2  s  . c  o  m
    } else if (event.getSource() == removeButton3) {
        removeButtonPullout();
    } else if (event.getActionCommand().equals(ROTATEON)) {
        turnRotateOn();
    } else if (event.getActionCommand().equals(ROTATEOFF)) {
        turnRotateOff();
    }
    super.actionPerformed(event);

}

From source file:com.moteiv.trawler.Trawler.java

public void actionPerformed(ActionEvent e) {
    AbstractButton source = (AbstractButton) e.getSource();
    processEvent(source);
}

From source file:be.agiv.security.demo.Main.java

public void actionPerformed(ActionEvent e) {
    if (e.getSource() == this.exitMenuItem) {
        dispose();/*from w w w .  j a  v a  2 s .c om*/
        System.exit(0);
    }
    if (e.getSource() == this.ipStsIssueMenuItem) {
        ipStsIssueToken();
    } else if (e.getSource() == this.claimsAwareServiceMenuItem) {
        invokeClaimsAwareService();
    } else if (e.getSource() == this.aboutMenuItem) {
        showAbout();
    } else if (e.getSource() == this.preferencesMenuItem) {
        showPreferences();
    } else if (e.getSource() == this.ipStsViewMenuItem) {
        ipStsViewToken();
    } else if (e.getSource() == this.rStsIssueMenuItem) {
        rStsIssueToken();
    } else if (e.getSource() == this.rStsViewMenuItem) {
        rStsViewToken();
    } else if (e.getSource() == this.secConvIssueMenuItem) {
        secConvIssueToken();
    } else if (e.getSource() == this.secConvViewMenuItem) {
        secConvViewToken();
    } else if (e.getSource() == this.secConvCancelMenuItem) {
        secConvCancelToken();
    }
}

From source file:com.net2plan.gui.utils.topologyPane.TopologyPanel.java

@Override
public void actionPerformed(ActionEvent e) {
    Object src = e.getSource();
    final VisualizationState vs = callback.getVisualizationState();
    if (src == btn_load) {
        loadDesign();/*from  www  . ja  va  2  s.  c  o  m*/
    } else if (src == btn_loadDemand) {
        loadTrafficDemands();
    } else if (src == btn_save) {
        saveDesign();
    } else if (src == btn_showNodeNames) {
        vs.setCanvasShowNodeNames(btn_showNodeNames.isSelected());
        canvas.refresh();
    } else if (src == btn_showLinkIds) {
        vs.setCanvasShowLinkLabels(btn_showLinkIds.isSelected());
        canvas.refresh();
    } else if (src == btn_showNonConnectedNodes) {
        vs.setCanvasShowNonConnectedNodes(btn_showNonConnectedNodes.isSelected());
        canvas.refresh();
    } else if (src == btn_takeSnapshot) {
        takeSnapshot();
    } else if (src == btn_zoomIn) {
        canvas.zoomIn();
    } else if (src == btn_zoomOut) {
        canvas.zoomOut();
    } else if (src == btn_zoomAll) {
        canvas.zoomAll();
    } else if (src == btn_reset) {
        if (callback.inOnlineSimulationMode())
            return;

        callback.setCurrentNetPlanDoNotUpdateVisualization(new NetPlan());
        Pair<BidiMap<NetworkLayer, Integer>, Map<NetworkLayer, Boolean>> res = vs
                .suggestCanvasUpdatedVisualizationLayerInfoForNewDesign(
                        new HashSet<>(callback.getDesign().getNetworkLayers()));
        vs.setCanvasLayerVisibilityAndOrder(callback.getDesign(), res.getFirst(), res.getSecond());
        callback.updateVisualizationAfterNewTopology();
        callback.getUndoRedoNavigationManager().addNetPlanChange();
    } else if (src == btn_increaseInterLayerDistance) {
        if (vs.getCanvasNumberOfVisibleLayers() == 1)
            return;

        final int currentInterLayerDistance = vs.getInterLayerSpaceInPixels();
        final int newInterLayerDistance = currentInterLayerDistance
                + (int) Math.ceil(currentInterLayerDistance * (VisualizationConstants.SCALE_IN - 1));

        vs.setInterLayerSpaceInPixels(newInterLayerDistance);
        canvas.updateInterLayerDistanceInNpCoordinates(newInterLayerDistance);
        canvas.updateAllVerticesXYPosition();
        canvas.refresh();
    } else if (src == btn_decreaseInterLayerDistance) {
        if (vs.getCanvasNumberOfVisibleLayers() == 1)
            return;

        final int currentInterLayerDistance = vs.getInterLayerSpaceInPixels();
        final int newInterLayerDistance = currentInterLayerDistance
                - (int) Math.ceil(currentInterLayerDistance * (1 - VisualizationConstants.SCALE_OUT));

        vs.setInterLayerSpaceInPixels(newInterLayerDistance);
        canvas.updateInterLayerDistanceInNpCoordinates(newInterLayerDistance);
        canvas.updateAllVerticesXYPosition();

        canvas.refresh();
    } else if (src == btn_showLowerLayerInfo) {
        vs.setShowInCanvasLowerLayerPropagation(btn_showLowerLayerInfo.isSelected());
        canvas.refresh();
    } else if (src == btn_showUpperLayerInfo) {
        vs.setShowInCanvasUpperLayerPropagation(btn_showUpperLayerInfo.isSelected());
        canvas.refresh();
    } else if (src == btn_showThisLayerInfo) {
        vs.setShowInCanvasThisLayerPropagation(btn_showThisLayerInfo.isSelected());
        canvas.refresh();
    } else if (src == btn_npChangeUndo) {
        callback.requestUndoAction();
    } else if (src == btn_npChangeRedo) {
        callback.requestRedoAction();
    } else if (src == btn_tableControlWindow) {
        WindowController.showTablesWindow(true);
    } else if (src == btn_osmMap) {
        if (btn_osmMap.isSelected()) {
            try {
                setOSMSupportTo(true);
            } catch (OSMException ex) {
                btn_osmMap.setSelected(false);
            }
        } else if (!btn_osmMap.isSelected()) {
            setOSMSupportTo(false);
        }
    } else if (src == btn_increaseNodeSize) {
        callback.getVisualizationState().increaseCanvasNodeSizeAll();
        canvas.refresh();
    } else if (src == btn_decreaseNodeSize) {
        callback.getVisualizationState().decreaseCanvasNodeSizeAll();
        canvas.refresh();
    } else if (src == btn_increaseFontSize) {
        callback.getVisualizationState().increaseCanvasFontSizeAll();
        canvas.refresh();
    } else if (src == btn_decreaseFontSize) {
        final boolean somethingChanged = callback.getVisualizationState().decreaseCanvasFontSizeAll();
        if (somethingChanged)
            canvas.refresh();
    }
}

From source file:de.evaluationtool.gui.EvaluationFrameActionListener.java

@Override
public void actionPerformed(ActionEvent event) {
    //if(!(event.getSource() instanceof JMenuItem)) return;
    //JMenuItem item = (JMenuItem) event.getSource();
    try {//from   w w w. ja  v  a 2  s.c o  m
        if (event.getSource() == frame.loadReferenceItem) {
            loadReference();
        }
        if (event.getSource() == frame.saveReferenceOnlyItem) {
            saveReference(false, false);
        }
        if (event.getSource() == frame.saveReferenceAndEvaluationItem) {
            saveReference(true, true);
        }
        if (event.getSource() == frame.removeAllUnderAutoEvalDistanceItem) {
            frame.removeAllUnderAutoEvalDistance();
        }

        //         // load
        //         for(ReferenceFormat format: ReferenceFormats.referenceFormats)
        //         {
        //            // TODO: maybe a bit unstable? if someone changes the menu item label then the action listener does not work anymore
        //            if(item.getText().equals("Load "+format.getDescription()))
        //            {
        //               loadFormat(format);
        //            };
        //            if(item.getText().equals("Save "+format.getDescription()))
        //            {
        //               saveFormat(format);
        //            };
        //         }

        //         if(event.getSource()==frame.loadSameAsNTItem) {loadSameAsNT();}
        //         if(event.getSource()==frame.loadReferenceItem) {loadReference();}
        //         if(event.getSource()==frame.loadReferenceNTItem) {loadReferenceNT();}      
        //         if(event.getSource()==frame.loadEvaluationXMLItem) {loadEvaluationXML();}
        //         //if(event.getSource()==frame.loadReferenceTSVItem) {loadReferenceTSV();}      
        //         if(event.getSource()==frame.loadPositiveNegativeNTItem) {loadPositiveNegativeNT();}   
        //         if(event.getSource()==frame.loadReferenceAlignmentTSVItem) {loadReferenceAlignmentTSV();}

        // save
        //         if(event.getSource()==frame.savePositiveNegativeNTItem)   {savePositiveNegativeNT();}
        //         if(event.getSource()==frame.saveXMLItem) {saveXML();}
        //         if(event.getSource()==frame.saveTSVItem) {saveTSV();}

        // options
        // operations
        if (event.getSource() == frame.reloadLabelsItem) {
            frame.startLabelThread(false, true);
        }
        if (event.getSource() == frame.autoEvalItem) {
            frame.autoEvaluate();
        }
        if (event.getSource() == frame.sortByCorrectnessItem) {
            frame.sortByCorrectness();
        }

        if (event.getSource() == frame.evaluateItem) {
            frame.evaluate();
        }
        if (event.getSource() == frame.evaluateAlignItem) {
            frame.evaluateAlign();
        }
        if (event.getSource() == frame.changeAutoEvalDistanceItem) {
            changeAutoEvalDistance();
        }
        if (event.getSource() == frame.changeLoadLimitItem) {
            changeLoadLimit();
        }
        if (event.getSource() == frame.shrinkToLoadLimitItem) {
            frame.shrinkToLoadLimit();
        }
        if (event.getSource() == frame.javadocMenuItem) {
            browse("file://" + System.getProperty("user.dir") + "/doc/"
                    + EvaluationTool.class.toString().split(" ")[1].replace('.', '/') + ".html");
        }
        if (event.getSource() == frame.manualMenuItem) {
            browse("file:///home/konrad/projekte/www/evaluationtool/index.html");
        }
        if (event.getSource() == frame.saveReferenceXMLItem) {
            saveReferenceXML();
        }
        //if(event.getSource()==frame.convertItem) {convert();}
        if (event.getSource() == frame.precisionButton) {
            frame.showPrecision();
        }
        if (event.getSource() == frame.editNameSourceFileItem) {
            editNameSourceFile();
        }
        if (event.getSource() == frame.reloadNameSourceFileItem) {
            reloadNameSourceFile();
        }
        //         if(event.getSource()==frame.editConfigurationFileItem) {editConfigurationFile();}
        //         if(event.getSource()==frame.reloadConfigurationFileItem) {reloadConfigurationFile();}

    } catch (Exception e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(frame, "Exception: " + e);
    }
}

From source file:edu.ku.brc.specify.plugins.PartialDateUI.java

/**
 * Creates the UI.//  www .ja  v a 2s. c  om
 */
protected void createUI() {
    DocumentAdaptor docListener = null;
    if (!isDisplayOnly) {
        docListener = new DocumentAdaptor() {
            @Override
            protected void changed(DocumentEvent e) {
                super.changed(e);

                if (!ignoreDocChanges) {
                    isChanged = true;
                    isDateChanged = true;
                    if (changeListener != null) {
                        changeListener.stateChanged(new ChangeEvent(PartialDateUI.this));
                    }
                }
            }
        };
    }

    List<UIFieldFormatterIFace> partialDateList = UIFieldFormatterMgr.getInstance().getDateFormatterList(true);
    for (UIFieldFormatterIFace uiff : partialDateList) {
        if (uiff.getName().equals("PartialDateMonth")) {
            ValFormattedTextField tf = new ValFormattedTextField(uiff, isDisplayOnly, !isDisplayOnly);
            tf.setRequired(isRequired);

            if (docListener != null)
                tf.addDocumentListener(docListener);
            uivs[1] = tf;
            textFields[1] = tf.getTextField();
            if (isDisplayOnly) {
                ViewFactory.changeTextFieldUIForDisplay(textFields[1], false);
            } else {
                setupPopupMenu(tf);
            }

        } else if (uiff.getName().equals("PartialDateYear")) {
            ValFormattedTextField tf = new ValFormattedTextField(uiff, isDisplayOnly, !isDisplayOnly);
            tf.setRequired(isRequired);

            if (docListener != null)
                tf.addDocumentListener(docListener);
            uivs[2] = tf;
            textFields[2] = tf.getTextField();
            if (isDisplayOnly) {
                ViewFactory.changeTextFieldUIForDisplay(textFields[2], false);
            } else {
                setupPopupMenu(tf);
            }
        }
    }

    List<UIFieldFormatterIFace> dateList = UIFieldFormatterMgr.getInstance().getDateFormatterList(false);
    for (UIFieldFormatterIFace uiff : dateList) {
        if (uiff.getName().equals("Date")) {
            ValFormattedTextFieldSingle tf = new ValFormattedTextFieldSingle(uiff, isDisplayOnly, false);
            tf.setRequired(isRequired);

            if (docListener != null)
                tf.addDocumentListener(docListener);
            uivs[0] = tf;
            textFields[0] = tf;
            if (isDisplayOnly) {
                ViewFactory.changeTextFieldUIForDisplay(textFields[0], false);
            } else {
                ViewFactory.addTextFieldPopup(this, tf, true);
            }
        }
    }

    cardPanel = new JPanel(cardLayout);

    String[] formatKeys = { "PARTIAL_DATE_FULL", "PARTIAL_DATE_MONTH", "PARTIAL_DATE_YEAR" };
    String[] labels = new String[formatKeys.length];
    for (int i = 0; i < formatKeys.length; i++) {
        labels[i] = UIRegistry.getResourceString(formatKeys[i]);
        cardPanel.add(labels[i], (JComponent) uivs[i]);
    }

    formatSelector = createComboBox(labels);
    formatSelector.setSelectedIndex(0);

    JComponent typDisplayComp = null;
    if (!isDisplayOnly) {
        comboBoxAL = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                JComboBox cbx = (JComboBox) ae.getSource();
                Object dataValue = ((GetSetValueIFace) currentUIV).getValue();//isDateChanged ? ((GetSetValueIFace)currentUIV).getValue() : Calendar.getInstance();
                currentUIV = uivs[cbx.getSelectedIndex()];

                ignoreDocChanges = true;
                ((GetSetValueIFace) currentUIV).setValue(dataValue, null);
                ignoreDocChanges = false;

                cardLayout.show(cardPanel, formatSelector.getSelectedItem().toString());

                isChanged = true;
                if (changeListener != null) {
                    changeListener.stateChanged(new ChangeEvent(PartialDateUI.this));
                }
            }
        };
        typDisplayComp = formatSelector;
        formatSelector.addActionListener(comboBoxAL);
    }

    PanelBuilder builder = new PanelBuilder(
            new FormLayout((typDisplayComp != null ? "p, 2px, f:p:g" : "f:p:g"), "p"), this);
    CellConstraints cc = new CellConstraints();
    if (typDisplayComp != null) {
        builder.add(typDisplayComp, cc.xy(1, 1));
        builder.add(cardPanel, cc.xy(3, 1));
    } else {
        builder.add(cardPanel, cc.xy(1, 1));
    }
}

From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java

@Override
public void actionPerformed(ActionEvent ev) {
    if (ev.getSource() instanceof JButton) {
        String cmd = ev.getActionCommand();
        // /////////////////////////////////////////////////////////////////////////
        // Abbrechen
        if (cmd.equals("cancel")) {
            lg.debug("Cancel ProgramProperetysDialog.");
            setVisible(false);/*from  www.ja  va 2s .  c o m*/
            closeWithOk = false;
            return;
        }
        // /////////////////////////////////////////////////////////////////////////
        // Mache!
        if (cmd.equals("set_propertys")) {
            lg.debug("OK pressed...");
            closeWithOk = false;
            if (wasChangedParameter) {
                if (!SpxPcloggerProgramConfig.logFile.getAbsolutePath()
                        .equals(logfileNameTextField.getText())) {
                    // da wurde was gendert!
                    SpxPcloggerProgramConfig.logFile = new File(logfileNameTextField.getText());
                    SpxPcloggerProgramConfig.wasChanged = true;
                    lg.debug("logfile name changed...");
                }
                if (!SpxPcloggerProgramConfig.databaseDir.getAbsolutePath()
                        .equals(databaseDirTextField.getText())) {
                    // da hat einer was dran gemacht
                    try {
                        testMoveDatafiles();
                    } catch (NoDatabaseException ex) {
                        showErrorDialog(ex.getLocalizedMessage());
                    }
                    SpxPcloggerProgramConfig.wasChanged = true;
                    lg.debug("database directory changed...");
                    SpxPcloggerProgramConfig.databaseDir = new File(databaseDirTextField.getText());
                }
                if (!SpxPcloggerProgramConfig.exportDir.getAbsolutePath()
                        .equals(exportDirTextField.getText())) {
                    // da wurde was gendert!
                    SpxPcloggerProgramConfig.exportDir = new File(exportDirTextField.getText());
                    SpxPcloggerProgramConfig.wasChanged = true;
                    lg.debug("exportdir changed...");
                }
                // Log und Daten ber Dialog
                // Einstellung fr Maeinheiten...
                if (defaultUnitsRadioButton.isSelected()
                        && (SpxPcloggerProgramConfig.unitsProperty != ProjectConst.UNITS_DEFAULT)) {
                    // da war doch jemand dran!
                    SpxPcloggerProgramConfig.unitsProperty = ProjectConst.UNITS_DEFAULT;
                    SpxPcloggerProgramConfig.wasChanged = true;
                    lg.debug("units to default changed...");
                } else if (metricUnitsRadioButton.isSelected()
                        && (SpxPcloggerProgramConfig.unitsProperty != ProjectConst.UNITS_METRIC)) {
                    // da war einer dran!
                    SpxPcloggerProgramConfig.unitsProperty = ProjectConst.UNITS_METRIC;
                    SpxPcloggerProgramConfig.wasChanged = true;
                    lg.debug("units to metric changed...");
                } else if (imperialUnitsRadioButton.isSelected()
                        && (SpxPcloggerProgramConfig.unitsProperty != ProjectConst.UNITS_IMPERIAL)) {
                    // da war einer dran!
                    SpxPcloggerProgramConfig.unitsProperty = ProjectConst.UNITS_IMPERIAL;
                    SpxPcloggerProgramConfig.wasChanged = true;
                    lg.debug("units to imperial changed...");
                }
                // wenn da also was in der Config gendert wurde....
                if (SpxPcloggerProgramConfig.wasChanged)
                    closeWithOk = true;
            }
            setVisible(false);
            return;
        } else if (cmd.equals("choose_logfile")) {
            lg.debug("choose logfile pressed...");
            chooseLogFile();
        } else if (cmd.equals("choose_datadir")) {
            lg.debug("choose datadir pressed...");
            chooseDataDir();
        } else if (cmd.equals("choose_exportdir")) {
            lg.debug("choose datadir pressed...");
            chooseExportDir();
        } else {
            lg.warn("unknown command <" + cmd + "> recived!");
        }
        return;
    } else if (ev.getActionCommand().equals("rbutton")) {
        // da hat jemand dran rumgefummelt
        wasChangedParameter = true;
    }
}

From source file:eu.ggnet.dwoss.redtape.document.DocumentUpdateView.java

private void addNonUnitPosition(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addNonUnitPosition
    PositionType type;//from  w  w w  .j  a  va2s  .  c  o  m
    if (((JButton) evt.getSource()) == addProductBatchButton) {
        type = PositionType.PRODUCT_BATCH;
    } else if (((JButton) evt.getSource()) == addServiceButton) {
        type = PositionType.SERVICE;
    } else if (((JButton) evt.getSource()) == addCommentButton) {
        type = PositionType.COMMENT;
    } else {
        type = PositionType.SHIPPING_COST;
    }
    try {
        controller.addPosition(document.getDossier().getId(), type, null, false);
        Platform.runLater(() -> {
            positions.clear();
            positions.addAll(document.getPositions().values());
        });
    } catch (UserInfoException ex) {
        DwOssCore.show(SwingUtilities.getWindowAncestor(this), ex);
    }
}