⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paresultswindow.java

📁 一个用于排队系统仿真的开源软件,有非常形象的图象仿真过程!
💻 JAVA
字号:
/**
  * Copyright (C) 2006, Laboratorio di Valutazione delle Prestazioni - Politecnico di Milano

  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.

  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.

  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */

package jmt.gui.common.panels.parametric;

import jmt.gui.common.definitions.*;
import jmt.gui.common.definitions.parametric.*;
import jmt.gui.common.layouts.SpringUtilities;
import jmt.gui.common.resources.ImageLoader;
import jmt.gui.common.util.PAPlot;
import jmt.gui.exact.table.ExactTable;
import jmt.gui.exact.table.ExactTableModel;
import jmt.engine.QueueNet.SimConstants;

import javax.swing.*;
import javax.swing.event.ChangeListener;
import javax.swing.event.ChangeEvent;
import javax.swing.border.EmptyBorder;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.DefaultTableCellRenderer;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.ActionEvent;
import java.text.DecimalFormat;
import java.util.Vector;
import java.io.*;


/**
 * <p>Title: PAResultsWindow </p>
 * <p>Description: this is a JFrame used to show results from a parametric analysis simulation.
 * Performance indexes are grouped by type inside a JTabbedPane. Performance indexes of the
 * same type are showed one below the other. <br>
 * It contains some subclasses used for several purpose: <br>
 *   - <code>PAMeasurePanel</code>: it is a JPanel that contains the table with results and the
 *                     plot <br>
 *   - <code>ZoomedFrame</code>: it is a JFrame used to show a single performance index <br>
 *   - <code>PlotImagesFileChooser</code>: a file chooser used to save plot images <br>
 *   - <code>PlotImagesFileFilter</code>: a file filter used to filter unsupported image type <br>
 *   - <code>PlotPopupMenu</code>: a JPopupMenu used to zoom inside and outside the plot and save images <br></p>
 *
 * @author Francesco D'Aquino
 *         Date: 28-gen-2006
 *         Time: 10.48.11
 */
public class PAResultsWindow extends JFrame implements ResultsConstants,ParametricAnalysis {
    public static final int SPINNER_WIDTH = 65;
    public static final double PLOT_ZOOM_FACTOR = 0.5;
    public static final double SPINNER_PRECISION = 0.001;

    private ParametricAnalysisDefinition pad;
    private PAResultsModel results;


    /**
     * Creates a new PAResultsWindow
     * @param pad parametric analysis definition model
     * @param resModel parametric analysis results data structure
     */
    public PAResultsWindow(ParametricAnalysisDefinition pad, PAResultsModel resModel) {
        this.results = resModel;
        this.pad = pad;
        initGUI();
    }

    /**
     * Initialize all gui-related stuff
     */
    private void initGUI() {
        // Sets default title, close operation and dimensions
        this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
        this.setTitle("Simulation Results...");
        this.setIconImage(ImageLoader.loadImage("Results").getImage());
        int width = 800, height=600;

        // Centers this dialog on the screen
        Dimension scrDim = Toolkit.getDefaultToolkit().getScreenSize();
        this.setBounds((scrDim.width-width)/2,(scrDim.height-height)/2,width,height);

        // Creates all tabs
        JTabbedPane mainPanel = new JTabbedPane();
        this.getContentPane().setLayout(new BorderLayout());
        this.getContentPane().add(mainPanel, BorderLayout.CENTER);
        addTabPane(mainPanel, "Queue Length", DESCRIPTION_QUEUELENGTHS, results.getQueueLengthMeasures());
        addTabPane(mainPanel, "Queue Time", DESCRIPTION_QUEUETIMES, results.getQueueTimeMeasures());
        addTabPane(mainPanel, "Residence Time", DESCRIPTION_RESIDENCETIMES, results.getResidenceTimeMeasures());
        addTabPane(mainPanel, "Response Time", DESCRIPTION_RESPONSETIMES, results.getResponseTimeMeasures());
        addTabPane(mainPanel, "Utilization", DESCRIPTION_UTILIZATIONS, results.getUtilizationMeasures());
        addTabPane(mainPanel, "Throughput", DESCRIPTION_THROUGHPUTS, results.getThroughputMeasures());
        addTabPane(mainPanel, "System Throughput", DESCRIPTION_SYSTEMTHROUGHPUTS, results.getSystemThroughputMeasures());
        addTabPane(mainPanel, "System Response Time", DESCRIPTION_SYSTEMRESPONSETIMES, results.getSystemResponseTimeMeasures());
        addTabPane(mainPanel, "Customer Number", DESCRIPTION_CUSTOMERNUMBERS, results.getCustomerNumberMeasures());
    }

     public String getXLabel() {
        if (pad instanceof NumberOfCustomerParametricAnalysis)
            return "N";
        else if (pad instanceof PopulationMixParametricAnalysis) {
            return "

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -