/*
 * UcpDesktopClientView.java
 */

package ucpdesktopclient;

import java.awt.Color;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;


/**
 * The application's main frame.
 */
public class UcpDesktopClientView extends FrameView {
    
    
    public UcpDesktopClientView(SingleFrameApplication app) {
        super(app);

        initComponents();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = UcpDesktopClientApp.getApplication().getMainFrame();
            aboutBox = new UcpDesktopClientAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        UcpDesktopClientApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jScrollPaneSetUp = new javax.swing.JScrollPane();
        jPanelSetUp = new javax.swing.JPanel();
        jButtonLoadFile = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabelFilePath = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jTextFieldT1 = new javax.swing.JTextField();
        jTextFieldT2 = new javax.swing.JTextField();
        jTextFieldT3 = new javax.swing.JTextField();
        jTextFieldT4 = new javax.swing.JTextField();
        jTextFieldT5 = new javax.swing.JTextField();
        jTextFieldT6 = new javax.swing.JTextField();
        jTextFieldT7 = new javax.swing.JTextField();
        jTextFieldT8 = new javax.swing.JTextField();
        jTextFieldT9 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jTextFieldT10 = new javax.swing.JTextField();
        jTextFieldT11 = new javax.swing.JTextField();
        jTextFieldT12 = new javax.swing.JTextField();
        jTextFieldT13 = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jTextFieldE1 = new javax.swing.JTextField();
        jTextFieldE2 = new javax.swing.JTextField();
        jTextFieldE3 = new javax.swing.JTextField();
        jTextFieldE4 = new javax.swing.JTextField();
        jTextFieldE5 = new javax.swing.JTextField();
        jTextFieldE6 = new javax.swing.JTextField();
        jTextFieldE7 = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jTextFieldE8 = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel25 = new javax.swing.JLabel();
        jButtonCountModel = new javax.swing.JButton();
        jLabel26 = new javax.swing.JLabel();
        jTextFieldHours = new javax.swing.JTextField();
        jLabelOperationResult = new javax.swing.JLabel();
        jScrollPaneResults = new javax.swing.JScrollPane();
        jTableResults = new javax.swing.JTable();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        jMenuItemLoad = new javax.swing.JMenuItem();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        jFileChooserSourceFile = new javax.swing.JFileChooser();

        mainPanel.setName("mainPanel"); // NOI18N

        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jScrollPaneSetUp.setName("jScrollPaneSetUp"); // NOI18N

        jPanelSetUp.setAutoscrolls(true);
        jPanelSetUp.setName("jPanelSetUp"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(ucpdesktopclient.UcpDesktopClientApp.class).getContext().getResourceMap(UcpDesktopClientView.class);
        jButtonLoadFile.setText(resourceMap.getString("jButtonLoadFile.text")); // NOI18N
        jButtonLoadFile.setName("jButtonLoadFile"); // NOI18N
        jButtonLoadFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLoadFileActionPerformed(evt);
            }
        });

        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setForeground(resourceMap.getColor("jLabel1.foreground")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jSeparator1.setName("jSeparator1"); // NOI18N

        jLabelFilePath.setText(resourceMap.getString("jLabelFilePath.text")); // NOI18N
        jLabelFilePath.setName("jLabelFilePath"); // NOI18N

        jLabel3.setFont(resourceMap.getFont("jLabel3.font")); // NOI18N
        jLabel3.setForeground(resourceMap.getColor("jLabel3.foreground")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jTextFieldT1.setText(resourceMap.getString("jTextFieldT1.text")); // NOI18N
        jTextFieldT1.setName("jTextFieldT1"); // NOI18N

        jTextFieldT2.setText(resourceMap.getString("jTextFieldT2.text")); // NOI18N
        jTextFieldT2.setName("jTextFieldT2"); // NOI18N

        jTextFieldT3.setText(resourceMap.getString("jTextFieldT3.text")); // NOI18N
        jTextFieldT3.setName("jTextFieldT3"); // NOI18N

        jTextFieldT4.setText(resourceMap.getString("jTextFieldT4.text")); // NOI18N
        jTextFieldT4.setName("jTextFieldT4"); // NOI18N

        jTextFieldT5.setText(resourceMap.getString("jTextFieldT5.text")); // NOI18N
        jTextFieldT5.setName("jTextFieldT5"); // NOI18N

        jTextFieldT6.setText(resourceMap.getString("jTextFieldT6.text")); // NOI18N
        jTextFieldT6.setName("jTextFieldT6"); // NOI18N

        jTextFieldT7.setText(resourceMap.getString("jTextFieldT7.text")); // NOI18N
        jTextFieldT7.setName("jTextFieldT7"); // NOI18N

        jTextFieldT8.setText(resourceMap.getString("jTextFieldT8.text")); // NOI18N
        jTextFieldT8.setName("jTextFieldT8"); // NOI18N

        jTextFieldT9.setText(resourceMap.getString("jTextFieldT9.text")); // NOI18N
        jTextFieldT9.setName("jTextFieldT9"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N

        jTextFieldT10.setText(resourceMap.getString("jTextFieldT10.text")); // NOI18N
        jTextFieldT10.setName("jTextFieldT10"); // NOI18N

        jTextFieldT11.setText(resourceMap.getString("jTextFieldT11.text")); // NOI18N
        jTextFieldT11.setName("jTextFieldT11"); // NOI18N

        jTextFieldT12.setText(resourceMap.getString("jTextFieldT12.text")); // NOI18N
        jTextFieldT12.setName("jTextFieldT12"); // NOI18N

        jTextFieldT13.setText(resourceMap.getString("jTextFieldT13.text")); // NOI18N
        jTextFieldT13.setName("jTextFieldT13"); // NOI18N

        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N

        jTextFieldE1.setText(resourceMap.getString("jTextFieldE1.text")); // NOI18N
        jTextFieldE1.setName("jTextFieldE1"); // NOI18N

        jTextFieldE2.setText(resourceMap.getString("jTextFieldE2.text")); // NOI18N
        jTextFieldE2.setName("jTextFieldE2"); // NOI18N

        jTextFieldE3.setText(resourceMap.getString("jTextFieldE3.text")); // NOI18N
        jTextFieldE3.setName("jTextFieldE3"); // NOI18N

        jTextFieldE4.setText(resourceMap.getString("jTextFieldE4.text")); // NOI18N
        jTextFieldE4.setName("jTextFieldE4"); // NOI18N

        jTextFieldE5.setText(resourceMap.getString("jTextFieldE5.text")); // NOI18N
        jTextFieldE5.setName("jTextFieldE5"); // NOI18N

        jTextFieldE6.setText(resourceMap.getString("jTextFieldE6.text")); // NOI18N
        jTextFieldE6.setName("jTextFieldE6"); // NOI18N

        jTextFieldE7.setText(resourceMap.getString("jTextFieldE7.text")); // NOI18N
        jTextFieldE7.setName("jTextFieldE7"); // NOI18N

        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N

        jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N

        jLabel20.setText(resourceMap.getString("jLabel20.text")); // NOI18N
        jLabel20.setName("jLabel20"); // NOI18N

        jLabel21.setText(resourceMap.getString("jLabel21.text")); // NOI18N
        jLabel21.setName("jLabel21"); // NOI18N

        jLabel22.setText(resourceMap.getString("jLabel22.text")); // NOI18N
        jLabel22.setName("jLabel22"); // NOI18N

        jLabel23.setText(resourceMap.getString("jLabel23.text")); // NOI18N
        jLabel23.setName("jLabel23"); // NOI18N

        jTextFieldE8.setText(resourceMap.getString("jTextFieldE8.text")); // NOI18N
        jTextFieldE8.setName("jTextFieldE8"); // NOI18N

        jLabel24.setText(resourceMap.getString("jLabel24.text")); // NOI18N
        jLabel24.setName("jLabel24"); // NOI18N

        jSeparator2.setName("jSeparator2"); // NOI18N

        jLabel25.setFont(resourceMap.getFont("jLabel25.font")); // NOI18N
        jLabel25.setForeground(resourceMap.getColor("jLabel25.foreground")); // NOI18N
        jLabel25.setText(resourceMap.getString("jLabel25.text")); // NOI18N
        jLabel25.setName("jLabel25"); // NOI18N

        jButtonCountModel.setText(resourceMap.getString("jButtonCountModel.text")); // NOI18N
        jButtonCountModel.setName("jButtonCountModel"); // NOI18N
        jButtonCountModel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCountModelActionPerformed(evt);
            }
        });

        jLabel26.setText(resourceMap.getString("jLabel26.text")); // NOI18N
        jLabel26.setName("jLabel26"); // NOI18N

        jTextFieldHours.setText(resourceMap.getString("jTextFieldHours.text")); // NOI18N
        jTextFieldHours.setName("jTextFieldHours"); // NOI18N

        jLabelOperationResult.setText(resourceMap.getString("jLabelOperationResult.text")); // NOI18N
        jLabelOperationResult.setName("jLabelOperationResult"); // NOI18N

        javax.swing.GroupLayout jPanelSetUpLayout = new javax.swing.GroupLayout(jPanelSetUp);
        jPanelSetUp.setLayout(jPanelSetUpLayout);
        jPanelSetUpLayout.setHorizontalGroup(
            jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelSetUpLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelSetUpLayout.createSequentialGroup()
                            .addComponent(jButtonLoadFile)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jLabelFilePath, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING))
                    .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 821, Short.MAX_VALUE)
                    .addComponent(jLabel3)
                    .addGroup(jPanelSetUpLayout.createSequentialGroup()
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7)
                            .addComponent(jLabel4)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextFieldT8)
                            .addComponent(jTextFieldT7)
                            .addComponent(jTextFieldT6)
                            .addComponent(jTextFieldT5)
                            .addComponent(jTextFieldT4)
                            .addComponent(jTextFieldT3)
                            .addComponent(jTextFieldT2, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
                            .addComponent(jTextFieldT1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel15)
                            .addComponent(jLabel16)
                            .addComponent(jLabel14)
                            .addComponent(jLabel13)
                            .addComponent(jLabel12))
                        .addGap(8, 8, 8)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jTextFieldT13)
                            .addComponent(jTextFieldT12, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextFieldT11, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextFieldT10, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextFieldT9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(30, 30, 30)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel19)
                            .addComponent(jLabel22)
                            .addComponent(jLabel23)
                            .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel18)
                            .addComponent(jLabel24)
                            .addComponent(jLabel20)
                            .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextFieldE5)
                            .addComponent(jTextFieldE4)
                            .addComponent(jTextFieldE3)
                            .addComponent(jTextFieldE2)
                            .addComponent(jTextFieldE6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 44, Short.MAX_VALUE)
                            .addComponent(jTextFieldE7)
                            .addComponent(jTextFieldE8)
                            .addComponent(jTextFieldE1, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(29, 29, 29)
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldHours, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelSetUpLayout.createSequentialGroup()
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jButtonCountModel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel25, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addComponent(jLabelOperationResult, javax.swing.GroupLayout.PREFERRED_SIZE, 426, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 821, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanelSetUpLayout.setVerticalGroup(
            jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelSetUpLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonLoadFile)
                    .addComponent(jLabelFilePath))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelSetUpLayout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelSetUpLayout.createSequentialGroup()
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel4)
                                    .addComponent(jTextFieldT1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel5)
                                    .addComponent(jTextFieldT2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel6)
                                    .addComponent(jTextFieldT3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel7)
                                    .addComponent(jTextFieldT4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel8)
                                    .addComponent(jTextFieldT5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel9)
                                    .addComponent(jTextFieldT6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel10)
                                    .addComponent(jTextFieldT7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel11)
                                    .addComponent(jTextFieldT8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanelSetUpLayout.createSequentialGroup()
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel17)
                                    .addComponent(jTextFieldE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel26)
                                    .addComponent(jTextFieldHours, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldE2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel18))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel19)
                                    .addComponent(jTextFieldE3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldE4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel20))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldE5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel21))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldE6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel22))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldE7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel23))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldE8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel24)))))
                    .addGroup(jPanelSetUpLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12)
                            .addComponent(jTextFieldT9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13)
                            .addComponent(jTextFieldT10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(jTextFieldT11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(jTextFieldT12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(jTextFieldT13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addComponent(jLabel25)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelSetUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonCountModel)
                    .addComponent(jLabelOperationResult, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(33, Short.MAX_VALUE))
        );

        jLabelFilePath.getAccessibleContext().setAccessibleName(resourceMap.getString("jLabelFilePath.AccessibleContext.accessibleName")); // NOI18N

        jScrollPaneSetUp.setViewportView(jPanelSetUp);

        jTabbedPane1.addTab(resourceMap.getString("jScrollPaneSetUp.TabConstraints.tabTitle"), jScrollPaneSetUp); // NOI18N

        jScrollPaneResults.setName("jScrollPaneResults"); // NOI18N

        jTableResults.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Name", "Type", "Complexity", "UCP", "Hours", "Hours SW", "Sub UCP", "Sub Hours", "Sub Hours SW"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jTableResults.setName("jTableResults"); // NOI18N
        jScrollPaneResults.setViewportView(jTableResults);
        jTableResults.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("jTableResults.columnModel.title0")); // NOI18N
        jTableResults.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("jTableResults.columnModel.title1")); // NOI18N
        jTableResults.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("jTableResults.columnModel.title2")); // NOI18N
        jTableResults.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("jTableResults.columnModel.title3")); // NOI18N
        jTableResults.getColumnModel().getColumn(4).setHeaderValue(resourceMap.getString("jTableResults.columnModel.title4")); // NOI18N
        jTableResults.getColumnModel().getColumn(5).setHeaderValue(resourceMap.getString("jTableResults.columnModel.title5")); // NOI18N
        jTableResults.getColumnModel().getColumn(6).setHeaderValue(resourceMap.getString("jTableResults.columnModel.title6")); // NOI18N
        jTableResults.getColumnModel().getColumn(7).setHeaderValue(resourceMap.getString("jTableResults.columnModel.title7")); // NOI18N
        jTableResults.getColumnModel().getColumn(8).setHeaderValue(resourceMap.getString("jTableResults.columnModel.title8")); // NOI18N

        jTabbedPane1.addTab(resourceMap.getString("jScrollPaneResults.TabConstraints.tabTitle"), jScrollPaneResults); // NOI18N

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 848, Short.MAX_VALUE)
                .addContainerGap())
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 445, Short.MAX_VALUE)
                .addContainerGap())
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        jMenuItemLoad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemLoad.setText(resourceMap.getString("jMenuItemLoad.text")); // NOI18N
        jMenuItemLoad.setName("jMenuItemLoad"); // NOI18N
        jMenuItemLoad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemLoadActionPerformed(evt);
            }
        });
        fileMenu.add(jMenuItemLoad);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(ucpdesktopclient.UcpDesktopClientApp.class).getContext().getActionMap(UcpDesktopClientView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 868, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 698, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        jFileChooserSourceFile.setName("jFileChooserSourceFile"); // NOI18N

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

private void jButtonLoadFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLoadFileActionPerformed
    
    this.openFileChooser();
        
}//GEN-LAST:event_jButtonLoadFileActionPerformed

private void jMenuItemLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemLoadActionPerformed

    this.openFileChooser();
    
}//GEN-LAST:event_jMenuItemLoadActionPerformed

private void jButtonCountModelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCountModelActionPerformed
     
        BufferedReader reader = null;
        ResourceMap resourceMap = getResourceMap();
        
        // zavolani webove sluzby za ucelem vypoctu ucp modelu
        try {
            ucp.ws.UseCasePlanService service = new ucp.ws.UseCasePlanService();
            ucp.ws.UseCasePlan port = service.getUseCasePlanPort();
            ucp.ws.UcpWsMetrics metrics = new ucp.ws.UcpWsMetrics();
            java.lang.String xmlModel = "";
            
            //nastaveni metrik pro vypocet
            metrics.setHoursPerUc(Double.valueOf(jTextFieldHours.getText()));
            metrics.setT1(Integer.valueOf(jTextFieldT1.getText()));
            metrics.setT2(Integer.valueOf(jTextFieldT2.getText()));
            metrics.setT3(Integer.valueOf(jTextFieldT3.getText()));
            metrics.setT4(Integer.valueOf(jTextFieldT4.getText()));
            metrics.setT5(Integer.valueOf(jTextFieldT5.getText()));
            metrics.setT6(Integer.valueOf(jTextFieldT6.getText()));
            metrics.setT7(Integer.valueOf(jTextFieldT7.getText()));
            metrics.setT8(Integer.valueOf(jTextFieldT8.getText()));
            metrics.setT9(Integer.valueOf(jTextFieldT9.getText()));
            metrics.setT10(Integer.valueOf(jTextFieldT10.getText()));
            metrics.setT11(Integer.valueOf(jTextFieldT11.getText()));
            metrics.setT12(Integer.valueOf(jTextFieldT12.getText()));
            metrics.setT13(Integer.valueOf(jTextFieldT13.getText()));
            metrics.setE1(Integer.valueOf(jTextFieldE1.getText()));
            metrics.setE2(Integer.valueOf(jTextFieldE2.getText()));
            metrics.setE3(Integer.valueOf(jTextFieldE3.getText()));
            metrics.setE4(Integer.valueOf(jTextFieldE4.getText()));
            metrics.setE5(Integer.valueOf(jTextFieldE5.getText()));
            metrics.setE6(Integer.valueOf(jTextFieldE6.getText()));
            metrics.setE7(Integer.valueOf(jTextFieldE7.getText()));
            metrics.setE8(Integer.valueOf(jTextFieldE8.getText()));
            
            //precteni zdrojoveho souboru s xmi modelem
            StringBuffer fileData = new StringBuffer(1000);
            reader = new BufferedReader(new FileReader(jLabelFilePath.getText()));
            char[] buf = new char[1024];
            int numRead = 0;
            while ((numRead = reader.read(buf)) != -1) {
                fileData.append(buf, 0, numRead);
            }
            reader.close();
            //prevedeni nactenych dat do stringu
            xmlModel = fileData.toString();


            //zavolani operace webove sluzby
            java.util.List<ucp.ws.UcpElement> result = port.countUCP(metrics, xmlModel);

            //zobrazeni vysledku do tabulky
            DefaultTableModel tableModel = (DefaultTableModel) jTableResults.getModel();
            tableModel.setRowCount(0); //vycistit radky tabulky
            jTableResults.setAutoCreateRowSorter(true); //povolit serazeni vysledku podle sloupcu
            for (ucp.ws.UcpElement r : result) {
                //naplneni jednotlivych radku
                tableModel.addRow(new Object[]{r.getName(), r.getType(), r.getComplexity(), r.getUcp(), r.getHours(), r.getHoursSW(), r.getSubUCP(), r.getSubCasesHours(), r.getSubCasesHoursSW()});
            }
            
            //pokud sluzba vrati prazdny seznam, pak byla nekde ve vypoctu chyba
            if (!result.isEmpty())
            {
                jLabelOperationResult.setForeground(new java.awt.Color(0,102,0));
                jLabelOperationResult.setText(resourceMap.getString("jLabelOpeationResultSuccessfully.text")); // NOI18N
            }
            else
            {
                jLabelOperationResult.setForeground(Color.RED);
                jLabelOperationResult.setText(resourceMap.getString("jLabelOpeationResultNoResult.text"));// NOI18N
            }

        } catch (NumberFormatException ex) {
            Logger.getLogger(UcpDesktopClientView.class.getName()).log(Level.SEVERE, null, ex);

            jLabelOperationResult.setForeground(Color.RED);
            jLabelOperationResult.setText(resourceMap.getString("jLabelOpeationResultNumberException.text"));// NOI18N    
            
        } catch (FileNotFoundException ex) {
            Logger.getLogger(UcpDesktopClientView.class.getName()).log(Level.SEVERE, null, ex);
            
            jLabelOperationResult.setForeground(Color.RED);
            jLabelOperationResult.setText(resourceMap.getString("jLabelOpeationResultNotFound.text"));// NOI18N

        } catch (IOException ex) {
            Logger.getLogger(UcpDesktopClientView.class.getName()).log(Level.SEVERE, null, ex);
            
            jLabelOperationResult.setForeground(Color.RED);
            jLabelOperationResult.setText(resourceMap.getString("jLabelOpeationResultReadingError.text"));// NOI18N
                        
        } catch (Exception ex) {
            Logger.getLogger(UcpDesktopClientView.class.getName()).log(Level.SEVERE, null, ex);
            
            jLabelOperationResult.setForeground(Color.RED);
            jLabelOperationResult.setText(resourceMap.getString("jLabelOpeationResultErrorWhilePerforming.text"));// NOI18N

        } finally {
            try {
                reader.close();
            } catch (IOException ex) {
                Logger.getLogger(UcpDesktopClientView.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

    
}//GEN-LAST:event_jButtonCountModelActionPerformed

private void openFileChooser()
{
    jFileChooserSourceFile.setFileFilter(new FileNameExtensionFilter("XML (UML 2.1 XMI 2.1)", "xml", "xmi"));
    
    int returnVal = jFileChooserSourceFile.showOpenDialog(this.getFrame());
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = jFileChooserSourceFile.getSelectedFile();
        
        jLabelFilePath.setText(file.getPath());
        
    }
}

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonCountModel;
    private javax.swing.JButton jButtonLoadFile;
    private javax.swing.JFileChooser jFileChooserSourceFile;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelFilePath;
    private javax.swing.JLabel jLabelOperationResult;
    private javax.swing.JMenuItem jMenuItemLoad;
    private javax.swing.JPanel jPanelSetUp;
    private javax.swing.JScrollPane jScrollPaneResults;
    private javax.swing.JScrollPane jScrollPaneSetUp;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTableResults;
    private javax.swing.JTextField jTextFieldE1;
    private javax.swing.JTextField jTextFieldE2;
    private javax.swing.JTextField jTextFieldE3;
    private javax.swing.JTextField jTextFieldE4;
    private javax.swing.JTextField jTextFieldE5;
    private javax.swing.JTextField jTextFieldE6;
    private javax.swing.JTextField jTextFieldE7;
    private javax.swing.JTextField jTextFieldE8;
    private javax.swing.JTextField jTextFieldHours;
    private javax.swing.JTextField jTextFieldT1;
    private javax.swing.JTextField jTextFieldT10;
    private javax.swing.JTextField jTextFieldT11;
    private javax.swing.JTextField jTextFieldT12;
    private javax.swing.JTextField jTextFieldT13;
    private javax.swing.JTextField jTextFieldT2;
    private javax.swing.JTextField jTextFieldT3;
    private javax.swing.JTextField jTextFieldT4;
    private javax.swing.JTextField jTextFieldT5;
    private javax.swing.JTextField jTextFieldT6;
    private javax.swing.JTextField jTextFieldT7;
    private javax.swing.JTextField jTextFieldT8;
    private javax.swing.JTextField jTextFieldT9;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
    
}
