Exemplo n.º 1
0
 /**
  * Creates a new demo panel.
  *
  * @param dataset
  */
 public MyDemoPanel(DefaultPieDataset dataset) {
   super(new BorderLayout());
   this.dataset = dataset;
   this.chart = createChart(dataset);
   addChart(this.chart);
   ChartPanel chartPanel = new ChartPanel(this.chart);
   add(chartPanel);
   JPanel buttonPanel = new JPanel(new FlowLayout());
   JButton button1 = new JButton("By Key");
   button1.setActionCommand("BY_KEY");
   button1.addActionListener(this);
   JButton button2 = new JButton("By Value");
   button2.setActionCommand("BY_VALUE");
   button2.addActionListener(this);
   JButton button3 = new JButton("Random");
   button3.setActionCommand("RANDOM");
   button3.addActionListener(this);
   JCheckBox checkBox = new JCheckBox("Simple Labels");
   checkBox.setActionCommand("LABELS");
   checkBox.addActionListener(this);
   buttonPanel.add(button1);
   buttonPanel.add(button2);
   buttonPanel.add(button3);
   buttonPanel.add(checkBox);
   add(buttonPanel, BorderLayout.SOUTH);
 }
  /**
   * ctor Create view controls on startup and initialize it. We don't start listening here. see
   * setFrame()!
   */
  CustomizeView() {
    this.setLayout(new GridLayout(3, 0));

    m_cbMenuBar = new JCheckBox(MENUBAR_OFF, false);
    m_cbToolBar = new JCheckBox(TOOLBAR_OFF, false);
    m_cbObjectBar = new JCheckBox(OBJECTBAR_OFF, false);

    m_cbMenuBar.setEnabled(false);
    m_cbToolBar.setEnabled(false);
    m_cbObjectBar.setEnabled(false);

    m_cbMenuBar.setActionCommand(ACTION_MENUBAR);
    m_cbToolBar.setActionCommand(ACTION_TOOLBAR);
    m_cbObjectBar.setActionCommand(ACTION_OBJECTBAR);

    this.add(m_cbMenuBar);
    this.add(m_cbToolBar);
    this.add(m_cbObjectBar);
  }
Exemplo n.º 3
0
 public void drawCheckPanel() {
   boxes = new ArrayList<JCheckBox>();
   checkPanel.removeAll();
   checkPanel.setLayout(new GridLayout(files.size(), 1));
   for (int i = 0; i < files.size(); i++) {
     JCheckBox box = new JCheckBox(files.get(i).getTitle());
     box.setActionCommand(files.get(i).getId());
     boxes.add(box);
     checkPanel.add(box);
   }
 }
  protected void initComponents() {
    defaultAccountCheckBox =
        new CheckBoxWithMnemonic(
            MailResourceLoader.getString("dialog", "account", "use_default_account_settings"));

    // defaultAccountCheckBox.setEnabled(false);
    defaultAccountCheckBox.setActionCommand("DEFAULT_ACCOUNT");
    defaultAccountCheckBox.addActionListener(this);

    if (isPopAccount()) {
      inboxLabel =
          new LabelWithMnemonic(
              MailResourceLoader.getString("dialog", "account", "inbox_folder")); // $NON-NLS-1$
      inboxButton = new JButton();
      inboxButton.setActionCommand("INBOX"); // $NON-NLS-1$
      inboxButton.addActionListener(this);
      inboxLabel.setLabelFor(inboxButton);
    }

    draftsLabel =
        new LabelWithMnemonic(
            MailResourceLoader.getString("dialog", "account", "drafts_folder")); // $NON-NLS-1$
    draftsButton = new JButton();
    draftsButton.setActionCommand("DRAFTS"); // $NON-NLS-1$
    draftsButton.addActionListener(this);
    draftsLabel.setLabelFor(draftsButton);

    templatesLabel =
        new LabelWithMnemonic(
            MailResourceLoader.getString("dialog", "account", "templates_folder")); // $NON-NLS-1$
    templatesButton = new JButton();
    templatesButton.setActionCommand("TEMPLATES"); // $NON-NLS-1$
    templatesButton.addActionListener(this);
    templatesLabel.setLabelFor(templatesButton);

    sentLabel =
        new LabelWithMnemonic(
            MailResourceLoader.getString("dialog", "account", "sent_folder")); // $NON-NLS-1$
    sentButton = new JButton();
    sentButton.setActionCommand("SENT"); // $NON-NLS-1$
    sentButton.addActionListener(this);
    sentLabel.setLabelFor(sentButton);

    if (!isPopAccount()) {
      trashLabel =
          new LabelWithMnemonic(
              MailResourceLoader.getString("dialog", "account", "trash_folder")); // $NON-NLS-1$	
      trashButton = new JButton();
      trashButton.setActionCommand("TRASH"); // $NON-NLS-1$
      trashButton.addActionListener(this);
      trashLabel.setLabelFor(trashButton);
    }
  }
Exemplo n.º 5
0
  public GLDemo() {
    super(VNMRFrame.getVNMRFrame(), "Jogl Demo", false);

    DisplayOptions.addChangeListener(this);

    contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    gradientPanel = createGradientPanel();

    contentPane.add(gradientPanel, BorderLayout.CENTER);

    checkBox = new JCheckBox("Transparent", true);
    checkBox.setActionCommand("transparancy");
    checkBox.addActionListener(this);
    optionsPan = new JPanel();
    optionsPan.setLayout(new SimpleH2Layout(SimpleH2Layout.LEFT, 5, 0, true, false));
    optionsPan.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

    optionsPan.add(checkBox);

    runButton = new JToggleButton("Run");
    runButton.setActionCommand("run");
    runButton.setSelected(false);
    runButton.addActionListener(this);

    optionsPan.add(runButton);

    getContentPane().add(optionsPan, BorderLayout.SOUTH);
    setSize(300, 300);
    setLocation(300, 300);

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // Run this on another thread than the AWT event queue to
            // make sure the call to Animator.stop() completes before
            // exiting
            new Thread(
                    new Runnable() {
                      public void run() {
                        stop();
                      }
                    })
                .start();
          }
        });
    setVisible(false);
  }
  // Create the control pane for the top of the frame.
  private JPanel createControlPanel() {
    onTop = new JCheckBox("Top Position in Layer");
    onTop.setSelected(true);
    onTop.setActionCommand(ON_TOP_COMMAND);
    onTop.addActionListener(this);

    layerList = new JComboBox(layerStrings);
    layerList.setSelectedIndex(2); // cyan layer
    layerList.setActionCommand(LAYER_COMMAND);
    layerList.addActionListener(this);

    JPanel controls = new JPanel();
    controls.add(layerList);
    controls.add(onTop);
    controls.setBorder(BorderFactory.createTitledBorder("Choose Duke's Layer and Position"));
    return controls;
  }
Exemplo n.º 7
0
  public JPanel getSelectionPanel() {
    JPanel inner = new JPanel();
    inner.setLayout(new BoxLayout(inner, BoxLayout.PAGE_AXIS));
    ActionListener listener =
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            String name = e.getActionCommand();
            PaintersBag.this.setPainterActive(name, ((JCheckBox) e.getSource()).isSelected());
            renderer.repaint();
          }
        };
    for (String name : sortByName) {
      JCheckBox check = new JCheckBox(name);
      check.setSelected(activePainters.get(name));
      check.setActionCommand(name);
      check.addActionListener(listener);
      inner.add(check);
    }

    return inner;
  }
Exemplo n.º 8
0
    protected void initComponents(
        AirspaceBuilderModel model, final AirspaceBuilderController controller) {
      final JCheckBox resizeNewShapesCheckBox;
      final JCheckBox enableEditCheckBox;

      JPanel newShapePanel = new JPanel();
      {
        JButton newShapeButton = new JButton("New shape");
        newShapeButton.setActionCommand(NEW_AIRSPACE);
        newShapeButton.addActionListener(controller);
        newShapeButton.setToolTipText("Create a new shape centered in the viewport");

        this.factoryComboBox = new JComboBox(defaultAirspaceFactories);
        this.factoryComboBox.setEditable(false);
        this.factoryComboBox.setToolTipText("Choose shape type to create");

        resizeNewShapesCheckBox = new JCheckBox("Fit new shapes to viewport");
        resizeNewShapesCheckBox.setActionCommand(SIZE_NEW_SHAPES_TO_VIEWPORT);
        resizeNewShapesCheckBox.addActionListener(controller);
        resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport());
        resizeNewShapesCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
        resizeNewShapesCheckBox.setToolTipText(
            "New shapes are sized to fit the geographic viewport");

        enableEditCheckBox = new JCheckBox("Enable shape editing");
        enableEditCheckBox.setActionCommand(ENABLE_EDIT);
        enableEditCheckBox.addActionListener(controller);
        enableEditCheckBox.setSelected(controller.isEnableEdit());
        enableEditCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
        enableEditCheckBox.setToolTipText("Allow modifications to shapes");

        Box newShapeBox = Box.createHorizontalBox();
        newShapeBox.add(newShapeButton);
        newShapeBox.add(Box.createHorizontalStrut(5));
        newShapeBox.add(this.factoryComboBox);
        newShapeBox.setAlignmentX(Component.LEFT_ALIGNMENT);

        JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap
        gridPanel.add(newShapeBox);
        gridPanel.add(resizeNewShapesCheckBox);
        gridPanel.add(enableEditCheckBox);

        newShapePanel.setLayout(new BorderLayout());
        newShapePanel.add(gridPanel, BorderLayout.NORTH);
      }

      JPanel entryPanel = new JPanel();
      {
        this.entryTable = new JTable(model);
        this.entryTable.setColumnSelectionAllowed(false);
        this.entryTable.setRowSelectionAllowed(true);
        this.entryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.entryTable
            .getSelectionModel()
            .addListSelectionListener(
                new ListSelectionListener() {
                  public void valueChanged(ListSelectionEvent e) {
                    if (!ignoreSelectEvents) {
                      controller.actionPerformed(
                          new ActionEvent(e.getSource(), -1, SELECTION_CHANGED));
                    }
                  }
                });
        this.entryTable.setToolTipText("<html>Click to select<br>Double-Click to rename</html>");

        JScrollPane tablePane = new JScrollPane(this.entryTable);
        tablePane.setPreferredSize(new Dimension(200, 100));

        entryPanel.setLayout(new BorderLayout(0, 0)); // hgap, vgap
        entryPanel.add(tablePane, BorderLayout.CENTER);
      }

      JPanel selectionPanel = new JPanel();
      {
        JButton delselectButton = new JButton("Deselect");
        delselectButton.setActionCommand(CLEAR_SELECTION);
        delselectButton.addActionListener(controller);
        delselectButton.setToolTipText("Clear the selection");

        JButton deleteButton = new JButton("Delete Selected");
        deleteButton.setActionCommand(REMOVE_SELECTED);
        deleteButton.addActionListener(controller);
        deleteButton.setToolTipText("Delete selected shapes");

        JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap
        gridPanel.add(delselectButton);
        gridPanel.add(deleteButton);

        selectionPanel.setLayout(new BorderLayout());
        selectionPanel.add(gridPanel, BorderLayout.NORTH);
      }

      this.setLayout(new BorderLayout(30, 0)); // hgap, vgap
      this.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); // top, left, bottom, right
      this.add(newShapePanel, BorderLayout.WEST);
      this.add(entryPanel, BorderLayout.CENTER);
      this.add(selectionPanel, BorderLayout.EAST);

      controller.addPropertyChangeListener(
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent e) {
              if (SIZE_NEW_SHAPES_TO_VIEWPORT.equals(e.getPropertyName())) {
                resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport());
              } else if (ENABLE_EDIT.equals(e.getPropertyName())) {
                enableEditCheckBox.setSelected(controller.isEnableEdit());
              }
            }
          });
    }
Exemplo n.º 9
0
  private void initConfig() throws MissingResourceException {

    setLayout(new MigLayout("", "[::523.00px]", "[][5px:n][][5px:n][]"));

    panelPreprocess = new JPanel();
    panelPreprocess.setBorder(
        new TitledBorder(
            null,
            BUNDLE.getString("EpaSoftPanel.panelPreprocess.borderTitle"),
            TitledBorder.LEADING,
            TitledBorder.TOP,
            FONT_PANEL_TITLE,
            null));
    add(panelPreprocess, "cell 0 0,grow");
    panelPreprocess.setLayout(new MigLayout("", "[118px:n][118px:n][118px:n][118px:n]", "[]"));

    btnSectorSelection =
        new JButton(BUNDLE.getString("EpaSoftPanel.btnSectorSelection.text")); // $NON-NLS-1$
    btnSectorSelection.setEnabled(false);
    btnSectorSelection.setActionCommand("showSectorSelection");
    panelPreprocess.add(btnSectorSelection, "cell 0 0,growx");

    btnStateSelection = new JButton(BUNDLE.getString("EpaSoftPanel.btnStateSelection.text"));
    btnStateSelection.setEnabled(false);
    btnStateSelection.setActionCommand(
        BUNDLE.getString("EpaSoftPanel.btnStateSelection.actionCommand")); // $NON-NLS-1$
    panelPreprocess.add(btnStateSelection, "cell 1 0,growx");

    btnOptions = new JButton(BUNDLE.getString("EpaSoftPanel.btnDesign.text")); // $NON-NLS-1$
    btnOptions.setEnabled(false);
    btnOptions.setActionCommand("showOptions");
    panelPreprocess.add(btnOptions, "flowx,cell 2 0,growx");

    btnDesign = new JButton(BUNDLE.getString("EpaSoftPanel.btnRaingage.text")); // $NON-NLS-1$
    btnDesign.setEnabled(false);
    btnDesign.setActionCommand("showRaingage");
    panelPreprocess.add(btnDesign, "cell 3 0,growx");

    panelFileManager = new JPanel();
    panelFileManager.setBorder(
        new TitledBorder(
            null,
            BUNDLE.getString("EpaSoftPanel.panelFileManager.borderTitle"),
            TitledBorder.LEADING,
            TitledBorder.TOP,
            FONT_PANEL_TITLE,
            null));
    add(panelFileManager, "cell 0 2,grow");
    panelFileManager.setLayout(
        new MigLayout(
            "",
            "[][108.00][::3px][:238.00px:250px][::3px][:65px:65px]",
            "[::22px][34px:n][20][34px:n][20][][]"));

    chkExport = new JCheckBox();
    chkExport.setToolTipText(BUNDLE.getString("EpaSoftPanel.chkExport.toolTipText")); // $NON-NLS-1$
    chkExport.setActionCommand("exportSelected");
    chkExport.setText(BUNDLE.getString("EpaSoftPanel.chkExport.text"));
    panelFileManager.add(chkExport, "cell 0 0 2 1,aligny bottom");

    chkSubcatchments = new JCheckBox();
    chkSubcatchments.setToolTipText(
        BUNDLE.getString("EpaSoftPanel.chkSubcatchments.toolTipText")); // $NON-NLS-1$
    chkSubcatchments.setVisible(false);
    chkSubcatchments.setText(BUNDLE.getString("EpaSoftPanel.chkSubcatchments.text")); // $NON-NLS-1$
    panelFileManager.add(chkSubcatchments, "cell 3 0");

    JLabel label = new JLabel();
    label.setText(BUNDLE.getString("Form.label.text"));
    panelFileManager.add(label, "cell 1 1,alignx right");

    scrollPane_2 = new JScrollPane();
    panelFileManager.add(scrollPane_2, "cell 3 1,grow");

    txtFileInp = new JTextArea();
    scrollPane_2.setViewportView(txtFileInp);
    txtFileInp.setFont(new Font("Tahoma", Font.PLAIN, 11));
    txtFileInp.setLineWrap(true);

    btnFileInp = new JButton();
    btnFileInp.setMinimumSize(new Dimension(65, 9));
    btnFileInp.setActionCommand("chooseFileInp");
    btnFileInp.setText("...");
    btnFileInp.setFont(new Font("Tahoma", Font.BOLD, 12));
    panelFileManager.add(btnFileInp, "cell 5 1,growx");

    chkExec = new JCheckBox();
    chkExec.setToolTipText(BUNDLE.getString("EpaSoftPanel.chkExec.toolTipText")); // $NON-NLS-1$
    chkExec.setText(BUNDLE.getString("EpaSoftPanel.chkExec.text")); // $NON-NLS-1$
    chkExec.setName("chk_exec");
    panelFileManager.add(chkExec, "cell 0 2 3 1,alignx left,aligny bottom");

    lblFileRpt = new JLabel();
    lblFileRpt.setText(BUNDLE.getString("Form.label_1.text"));
    panelFileManager.add(lblFileRpt, "cell 1 3,alignx right");

    scrollPane_3 = new JScrollPane();
    panelFileManager.add(scrollPane_3, "cell 3 3,grow");

    txtFileRpt = new JTextArea();
    scrollPane_3.setViewportView(txtFileRpt);
    txtFileRpt.setFont(new Font("Tahoma", Font.PLAIN, 11));
    txtFileRpt.setLineWrap(true);

    btnFileRpt = new JButton();
    btnFileRpt.setMinimumSize(new Dimension(65, 9));
    btnFileRpt.setActionCommand("chooseFileRpt");
    btnFileRpt.setText("...");
    btnFileRpt.setFont(new Font("Tahoma", Font.BOLD, 12));
    panelFileManager.add(btnFileRpt, "cell 5 3,growx");

    chkImport = new JCheckBox();
    chkImport.setToolTipText(BUNDLE.getString("EpaSoftPanel.chkImport.toolTipText")); // $NON-NLS-1$
    chkImport.setText(BUNDLE.getString("EpaSoftPanel.chkImport.text"));
    chkImport.setName("chk_import");
    panelFileManager.add(chkImport, "cell 0 4 2 1,aligny bottom");

    lblResultName = new JLabel();
    lblResultName.setText(BUNDLE.getString("Form.label_2.text"));
    lblResultName.setName("lbl_project");
    panelFileManager.add(lblResultName, "cell 1 5,alignx right");

    txtResultName = new JTextField();
    txtResultName.setName("txt_project");
    MaxLengthTextDocument maxLength = new MaxLengthTextDocument(16);
    txtResultName.setDocument(maxLength);
    panelFileManager.add(txtResultName, "cell 3 5,growx,aligny top");

    btnAccept = new JButton();
    btnAccept.setMinimumSize(new Dimension(65, 23));
    btnAccept.setEnabled(false);
    btnAccept.setText(BUNDLE.getString("Generic.btnAccept.text"));
    btnAccept.setName("btn_accept_postgis");
    btnAccept.setActionCommand("execute");
    panelFileManager.add(btnAccept, "flowx,cell 5 6,alignx right");

    btnProjectPreferences = new JButton("Project Preferences");
    btnProjectPreferences.setMinimumSize(new Dimension(130, 23));
    btnProjectPreferences.setPreferredSize(new Dimension(115, 23));
    btnProjectPreferences.setActionCommand("openProjectPreferences");
    add(btnProjectPreferences, "flowx,cell 0 4,alignx right");

    setupListeners();
  }
  /** Initialize the GUI */
  private void init() {
    setLayout(new BorderLayout(0, 0));

    JPanel panelMain = new JPanel();
    add(panelMain, BorderLayout.CENTER);
    panelMain.setLayout(new MigLayout("", "[grow]", "[grow]"));

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    panelMain.add(scrollPane, "cell 0 0,grow");

    table =
        new JXTable() {
          private static final long serialVersionUID = 1L;

          public void changeSelection(
              final int row, final int column, boolean toggle, boolean extend) {
            super.changeSelection(row, column, toggle, extend);
            if (table.isCellEditable(row, column)) {
              editCellAt(row, column);
            }
          }
        };

    table.setHorizontalScrollEnabled(true);
    table.setColumnControlVisible(true);
    model = new SeriesIdentityTableModel(containerFrame);

    SeriesIdentityTableCellRenderer renderer = new SeriesIdentityTableCellRenderer();

    table.setModel(model);

    table.getColumn(3).setCellRenderer(renderer);
    table.getColumn(4).setCellRenderer(renderer);
    table.getColumn(5).setCellRenderer(renderer);
    table.getColumn(6).setCellRenderer(renderer);
    table.getColumn(7).setCellRenderer(renderer);
    table.getColumn(8).setCellRenderer(renderer);
    table.getColumnExt(4).setIdentifier("SubObjectColumn");
    table.getColumnExt("SubObjectColumn").setVisible(false);

    table
        .getColumnModel()
        .addColumnModelListener(
            new TableColumnModelListener() {

              @Override
              public void columnAdded(TableColumnModelEvent arg0) {

                chkIncludeSubobjects.setSelected(table.getColumnExt("SubObjectColumn").isVisible());
              }

              @Override
              public void columnMarginChanged(ChangeEvent arg0) {
                // TODO Auto-generated method stub

              }

              @Override
              public void columnMoved(TableColumnModelEvent arg0) {
                // TODO Auto-generated method stub

              }

              @Override
              public void columnRemoved(TableColumnModelEvent arg0) {
                chkIncludeSubobjects.setSelected(table.getColumnExt("SubObjectColumn").isVisible());
              }

              @Override
              public void columnSelectionChanged(ListSelectionEvent arg0) {
                // TODO Auto-generated method stub

              }
            });

    scrollPane.setViewportView(table);

    JPanel panelButton = new JPanel();
    add(panelButton, BorderLayout.SOUTH);
    panelButton.setLayout(new MigLayout("", "[grow][][]", "[grow][grow][][][]"));

    model.addTableModelListener(this);

    JPanel panel = new JPanel();
    panelButton.add(panel, "cell 0 1 1 2,grow");
    panel.setLayout(new MigLayout("", "[31px][162px]", "[16px][][]"));

    JLabel lblKey = new JLabel("Key:");
    panel.add(lblKey, "cell 0 0,alignx left,aligny top");

    JLabel lblPresentIn = new JLabel("= Present in database");
    lblPresentIn.setFont(new Font("Dialog", Font.PLAIN, 12));
    lblPresentIn.setIcon(Builder.getIcon("found.png", 16));
    panel.add(lblPresentIn, "flowy,cell 1 0,alignx left,aligny top");

    JLabel lblAbsentFrom = new JLabel("= Absent from database");
    lblAbsentFrom.setFont(new Font("Dialog", Font.PLAIN, 12));
    lblAbsentFrom.setIcon(Builder.getIcon("missing.png", 16));
    panel.add(lblAbsentFrom, "cell 1 1,alignx left,aligny top");

    JLabel lblNotYet = new JLabel("= Not yet searched");
    lblNotYet.setFont(new Font("Dialog", Font.PLAIN, 12));
    lblNotYet.setIcon(Builder.getIcon("wait.png", 16));
    panel.add(lblNotYet, "cell 1 2,alignx left,aligny top");

    JPanel panel_1 = new JPanel();
    panelButton.add(panel_1, "cell 1 1 2 2,alignx right,growy");
    panel_1.setLayout(new MigLayout("", "[116px,fill]", "[22px][][][]"));

    JButton btnSearchDB = new JButton("Search Database");
    btnSearchDB.setFont(new Font("Dialog", Font.BOLD, 9));
    panel_1.add(btnSearchDB, "cell 0 0,alignx left,aligny top");
    btnSearchDB.setActionCommand("SearchDB");

    JButton btnDefineByPattern = new JButton("Define names by pattern");
    btnDefineByPattern.setFont(new Font("Dialog", Font.BOLD, 9));
    panel_1.add(btnDefineByPattern, "cell 0 1,alignx left,aligny top");
    btnDefineByPattern.setActionCommand("DefineByPattern");

    JButton btnGenerateMissing = new JButton("Generate missing entities");
    btnGenerateMissing.setActionCommand("GenerateMissing");
    btnGenerateMissing.addActionListener(this);

    JButton btnSetDefaults = new JButton("Set default parameters");
    btnSetDefaults.setActionCommand("SetDefaults");
    btnSetDefaults.addActionListener(this);
    btnSetDefaults.setFont(new Font("Dialog", Font.BOLD, 9));
    panel_1.add(btnSetDefaults, "cell 0 2");

    btnGenerateMissing.setFont(new Font("Dialog", Font.BOLD, 9));
    panel_1.add(btnGenerateMissing, "flowy,cell 0 3");
    btnDefineByPattern.addActionListener(this);
    btnSearchDB.addActionListener(this);

    chkIncludeSubobjects = new JCheckBox("Include sub-objects in import");
    chkIncludeSubobjects.addActionListener(this);
    chkIncludeSubobjects.setActionCommand("IncludeExcludeSubObjects");
    panelButton.add(chkIncludeSubobjects, "cell 0 3");

    chckbxOpenSeriesIn = new JCheckBox("Open series in editor when finished");
    chckbxOpenSeriesIn.setSelected(true);
    panelButton.add(chckbxOpenSeriesIn, "cell 0 4");
  }
  public DiameterCutOptionsTargetPanel() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Lungime:", 100));
    JFormattedTextField length = GUIFactory.createNumberInput(4100L, 0L, 1000000L, 80);
    panel.add(length);
    JComboBox<String> mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Diametru 1:", 100));
    JFormattedTextField smallRadius = GUIFactory.createNumberInput(200L, 0L, 1000000L, 80);
    panel.add(smallRadius);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Diametru 2:", 100));
    JFormattedTextField bigRadius = GUIFactory.createNumberInput(600L, 0L, 1000000L, 80);
    panel.add(bigRadius);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    label2 = GUIFactory.createLabel("Produse:", 100);
    panel.add(label2);
    products = ProductDAO.getProducts();
    JPanel productsPanel = new JPanel();
    productsPanel.setLayout(new BoxLayout(productsPanel, BoxLayout.Y_AXIS));
    for (Product product : products) {
      JPanel row = new JPanel(new FlowLayout(FlowLayout.LEFT));
      JCheckBox chk = new JCheckBox();
      row.add(chk);
      selection.add(chk);
      chk.setName("length" + (long) product.getLength());
      row.add(new JLabel(product.getName()));
      productsPanel.add(row);
    }
    JScrollPane scrollPane = new JScrollPane(productsPanel);
    scrollPane.setPreferredSize(new Dimension(productsPanel.getPreferredSize().width + 20, 215));
    panel.add(scrollPane);
    add(panel);

    JPanel filtru = new JPanel(new FlowLayout(FlowLayout.LEADING));
    filtru.add(filtru2m);
    filtru.add(filtru3m);
    filtru.add(filtru4m);
    filtru2m.setActionCommand("FILTRU2");
    filtru3m.setActionCommand("FILTRU3");
    filtru4m.setActionCommand("FILTRU4");
    filtru2m.addActionListener(this);
    filtru3m.addActionListener(this);
    filtru4m.addActionListener(this);
    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JLabel label1 = GUIFactory.createLabel("Filtru", 100);
    panel.add(label1);
    panel.add(filtru);
    add(panel);

    cancel.setActionCommand("CANCEL_DIALOG");
    cancel.addActionListener(GUIUtil.main);
    see.addActionListener(this);
  }
Exemplo n.º 12
0
  /** Implemetation of inherited method. Returns the layouted content panel of the form */
  public JPanel showFormContent() {
    JPanel root = getRootPanel(); // inherited

    if (myBranches.length == 0) {
      Gui.my_forms[index].setPreferredSize(new Dimension(300, 200));
      JPanel noresultPanel =
          getNoResultPanel(
              Gui.lang.getString("no_branches_avail"),
              Gui.lang.getString("list_branches")); // inherited
      root.add(noresultPanel, "1,1,3,1,FULL,FULL");
    } else {
      int border = 3;
      double size[][] = {
        {
          border,
          TableLayout.PREFERRED,
          TableLayout.PREFERRED,
          TableLayout.PREFERRED,
          TableLayout.PREFERRED,
          border
        }, // Columns
        {
          border,
          TableLayout.PREFERRED,
          TableLayout.PREFERRED,
          TableLayout.PREFERRED,
          TableLayout.PREFERRED,
          TableLayout.PREFERRED,
          border
        }
      }; // Rows

      TableLayout tl = new TableLayout(size);
      tl.setHGap(border);
      tl.setVGap(border);
      JPanel panel = new JPanel(tl);
      panel.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createEtchedBorder(BevelBorder.LOWERED),
              Gui.lang.getString("list_branches")));

      Object[][] tableData = new Object[myBranches.length][3];

      for (int i = 0; i < myBranches.length; i++) {
        tableData[i][0] = new Boolean(false);
        tableData[i][1] = ((Branch) myBranches[i]).getDescription();
        tableData[i][2] = ((Branch) myBranches[i]).getAbbreviation();
      }

      // Show Statistics
      int displayed;
      if (myBranches.length < 100) displayed = myBranches.length;
      else displayed = 100;

      String stat_string = (Gui.lang.getString("results") + " : " + myBranches.length);
      JLabel stats = FormElement.getInfiniteLabel(stat_string, Font.PLAIN, null);
      panel.add(stats, "1,1,4,1,LEFT,CENTER");

      branchTable = new JTable(new ResultTableModel(tableData));
      branchTable.setColumnModel(getColumnModel());
      branchTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      branchTable.addMouseListener(this);

      JPanel sroot = new JPanel(new BorderLayout());
      JScrollPane sp = new JScrollPane(branchTable);
      sp.setPreferredSize(new Dimension(300, 300));
      sroot.add(sp, BorderLayout.CENTER);
      panel.add(sroot, "1,2,4,2,FULL,TOP");

      selectAll = new JCheckBox(Gui.lang.getString("select_all"));
      selectAll.setToolTipText(Gui.lang.getString("select_all"));
      selectAll.setActionCommand("select_all");
      selectAll.addActionListener(this);
      panel.add(selectAll, "1,3,1,3,LEFT,CENTER");

      JButton new_button = FormElement.getButton("new", "images/branch2.png", null, null, true);
      new_button.setActionCommand("new_branch");
      new_button.addActionListener(this);
      new_button.addKeyListener(
          new KeyAdapter() {
            public void keyPressed(KeyEvent event) {
              if (event.getKeyCode() == KeyEvent.VK_ESCAPE)
                actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel"));
              if (event.getKeyCode() == KeyEvent.VK_ENTER)
                actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "new_branch"));
            }
          });
      panel.add(new_button, "3,3,3,3,FULL,CENTER");

      JButton content_button =
          FormElement.getButton("content", "images/content.png", "branch_content", null, true);
      content_button.setActionCommand("branch_content");
      content_button.addActionListener(this);
      content_button.addKeyListener(
          new KeyAdapter() {
            public void keyPressed(KeyEvent event) {
              if (event.getKeyCode() == KeyEvent.VK_ESCAPE)
                actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel"));
              if (event.getKeyCode() == KeyEvent.VK_ENTER)
                actionPerformed(
                    new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "branch_content"));
            }
          });
      panel.add(content_button, "4,3,4,3,FULL,CENTER");

      JButton checkout_button =
          FormElement.getButton("checkout", "images/checkout2.png", null, null, true);
      checkout_button.setActionCommand("checkout");
      checkout_button.addKeyListener(
          new KeyAdapter() {
            public void keyPressed(KeyEvent event) {
              if (event.getKeyCode() == KeyEvent.VK_ESCAPE)
                actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel"));
              if (event.getKeyCode() == KeyEvent.VK_ENTER)
                actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "checkout"));
            }
          });
      checkout_button.addActionListener(this);
      panel.add(checkout_button, "3,4,3,4,FULL,CENTER");

      JButton edit_button =
          FormElement.getButton("edit", "images/searchedit.png", null, null, true);
      edit_button.setActionCommand("edit");
      edit_button.addKeyListener(
          new KeyAdapter() {
            public void keyPressed(KeyEvent event) {
              if (event.getKeyCode() == KeyEvent.VK_ESCAPE)
                actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel"));
              if (event.getKeyCode() == KeyEvent.VK_ENTER)
                actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "edit"));
            }
          });
      edit_button.addActionListener(this);
      panel.add(edit_button, "4,4,4,4,FULL,CENTER");

      /*
      JButton delete_button = FormElement.getButton("delete", "images/delete.png", null, null, true);
      delete_button.setActionCommand("delete");
      delete_button.addActionListener(this);
      delete_button.addKeyListener(new KeyAdapter()
      		{
      			public void keyPressed(KeyEvent event)
      			{
      				if (event.getKeyCode() == KeyEvent.VK_ESCAPE )
      					actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"cancel"));
      				if (event.getKeyCode() == KeyEvent.VK_ENTER)
      					actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"delete"));
      			}
      		});
      panel.add(delete_button, "4,5,4,5,FULL,CENTER");

      */

      root.add(panel, "1,1,3,1,CENTER,CENTER");
    }
    // Ok-Button
    JButton ok_button = FormElement.getButton("close", "images/ok.png", null, null, true);
    ok_button.setActionCommand("cancel");
    ok_button.addActionListener(this);
    ok_button.addKeyListener(this);
    root.add(ok_button, "1,2,3,2,CENTER,CENTER");

    return root;
  }
Exemplo n.º 13
0
  public void init() {
    setForeground(Color.black);
    setTitle("DTI Create List File " + " v1.0");

    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints mainPanelConstraints = new GridBagConstraints();
    JPanel mainPanel = new JPanel(gbl);

    performRegistrationCheckbox = new JCheckBox("Register first");
    performRegistrationCheckbox.setFont(serif12B);
    performRegistrationCheckbox.setSelected(false);
    performRegistrationCheckbox.addActionListener(this);
    performRegistrationCheckbox.setActionCommand("performRegistrationCheckbox");
    performRegistrationCheckbox.setEnabled(false);
    registrationSettingsButton = new JButton("Registration Settings");
    registrationSettingsButton.setFont(serif12B);
    registrationSettingsButton.setEnabled(false);
    registrationSettingsButton.addActionListener(this);
    registrationSettingsButton.setActionCommand("registrationSettingsButton");
    dicomB0VolumeLabel = new JLabel("DICOM B0 volume: ");
    dicomB0VolumeLabel.setFont(serif12B);
    dicomB0VolumeLabel.setEnabled(false);
    dicomB0VolumeTextField = new JTextField(55);
    dicomB0VolumeTextField.setEditable(false);
    dicomB0VolumeTextField.setEnabled(false);
    dicomB0VolumeTextField.setBorder(new LineBorder(Color.gray));
    dicomB0VolumeBrowseButton = new JButton("Browse");
    dicomB0VolumeBrowseButton.setFont(serif12B);
    dicomB0VolumeBrowseButton.addActionListener(this);
    dicomB0VolumeBrowseButton.setActionCommand("dicomB0VolumeBrowse");
    dicomB0VolumeBrowseButton.setEnabled(false);
    JLabel dicomB0InfoLabel = new JLabel("Select the first image slice in the volume");
    dicomB0InfoLabel.setFont(serif12B);
    dicomB0InfoLabel.setEnabled(false);

    JPanel regPanel = new JPanel(gbl);
    regPanel.setBorder(buildTitledBorder("Registration"));
    GridBagConstraints regPanelConstraints = new GridBagConstraints();
    regPanelConstraints.gridx = 0;
    regPanelConstraints.gridy = 0;
    regPanelConstraints.anchor = GridBagConstraints.WEST;
    regPanelConstraints.insets = new Insets(0, 5, 15, 5);
    regPanel.add(performRegistrationCheckbox, regPanelConstraints);
    regPanelConstraints.gridx = 1;
    regPanelConstraints.gridy = 0;
    regPanelConstraints.insets = new Insets(0, 5, 15, 5);
    regPanel.add(registrationSettingsButton, regPanelConstraints);
    regPanelConstraints.gridx = 0;
    regPanelConstraints.gridy = 1;
    regPanelConstraints.insets = new Insets(0, 5, 5, 5);
    regPanel.add(dicomB0VolumeLabel, regPanelConstraints);
    regPanelConstraints.gridx = 1;
    regPanelConstraints.gridy = 1;
    regPanelConstraints.insets = new Insets(0, 5, 5, 5);
    regPanel.add(dicomB0VolumeTextField, regPanelConstraints);
    regPanelConstraints.gridx = 2;
    regPanelConstraints.gridy = 1;
    regPanelConstraints.insets = new Insets(0, 5, 5, 5);
    regPanel.add(dicomB0VolumeBrowseButton, regPanelConstraints);
    regPanelConstraints.gridx = 1;
    regPanelConstraints.gridy = 2;
    regPanelConstraints.gridwidth = 3;
    regPanelConstraints.anchor = GridBagConstraints.CENTER;
    regPanelConstraints.insets = new Insets(0, 5, 15, 5);
    regPanel.add(dicomB0InfoLabel, regPanelConstraints);

    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 0;
    mainPanelConstraints.insets = new Insets(15, 5, 5, 0);
    mainPanelConstraints.gridwidth = 1;
    mainPanelConstraints.anchor = GridBagConstraints.WEST;
    dwiLabel = new JLabel(" DWI data : ");
    dwiLabel.setFont(serif12B);
    mainPanel.add(dwiLabel, mainPanelConstraints);

    mainPanelConstraints.gridx = 1;
    mainPanelConstraints.gridy = 0;
    mainPanelConstraints.insets = new Insets(15, 5, 5, 0);
    dwiPathTextField = new JTextField(55);
    dwiPathTextField.setEditable(false);
    // dwiPathTextField.setBackground(Color.white);
    dwiPathTextField.setBorder(new LineBorder(Color.black));
    mainPanel.add(dwiPathTextField, mainPanelConstraints);

    mainPanelConstraints.gridx = 2;
    mainPanelConstraints.gridy = 0;
    mainPanelConstraints.insets = new Insets(15, 5, 5, 5);
    dwiPathBrowseButton = new JButton("Browse");
    dwiPathBrowseButton.setFont(serif12B);
    dwiPathBrowseButton.addActionListener(this);
    dwiPathBrowseButton.setActionCommand("dwiPathBrowse");
    mainPanel.add(dwiPathBrowseButton, mainPanelConstraints);

    // mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    // interleavedCheckbox = new JCheckBox("  interleaved dataset");
    // mainPanelConstraints.gridx = 1;
    // mainPanelConstraints.gridy = 1;
    // mainPanelConstraints.insets = new Insets(0,5,55,5);
    // mainPanel.add(interleavedCheckbox, mainPanelConstraints);

    mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    JLabel dwiDataInfoLabel =
        new JLabel(
            "For DICOM datasets, select the top level study directory.  For Par/Rec datasets, select the .rec file");
    dwiDataInfoLabel.setFont(serif12B);
    dwiDataInfoLabel.setEnabled(false);
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 1;
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 70, 5);
    mainPanel.add(dwiDataInfoLabel, mainPanelConstraints);

    mainPanelConstraints.anchor = GridBagConstraints.WEST;
    optionsGroup = new ButtonGroup();

    gradFileRadio = new JRadioButton(" gradient file : ");
    gradFileRadio.setFont(serif12B);
    gradFileRadio.setSelected(true);
    gradFileRadio.addActionListener(this);
    gradFileRadio.setActionCommand("gradFileRadio");
    optionsGroup.add(gradFileRadio);
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 2;
    mainPanelConstraints.gridwidth = 1;
    mainPanelConstraints.insets = new Insets(0, 5, 15, 0);
    mainPanel.add(gradFileRadio, mainPanelConstraints);

    mainPanelConstraints.gridx = 1;
    mainPanelConstraints.gridy = 2;
    mainPanelConstraints.insets = new Insets(0, 5, 15, 0);
    gradientFilePathTextField = new JTextField(55);
    gradientFilePathTextField.setEditable(false);
    gradientFilePathTextField.setBorder(new LineBorder(Color.black));
    // gradientFilePathTextField.setBackground(Color.white);
    mainPanel.add(gradientFilePathTextField, mainPanelConstraints);

    mainPanelConstraints.gridx = 2;
    mainPanelConstraints.gridy = 2;
    mainPanelConstraints.insets = new Insets(0, 5, 15, 5);
    gradientFileBrowseButton = new JButton("Browse");
    gradientFileBrowseButton.setFont(serif12B);
    gradientFileBrowseButton.addActionListener(this);
    gradientFileBrowseButton.setActionCommand("gradientFileBrowse");
    mainPanel.add(gradientFileBrowseButton, mainPanelConstraints);

    bmtxtFileRadio = new JRadioButton(" b-matrix file : ");
    bmtxtFileRadio.setFont(serif12B);
    bmtxtFileRadio.setSelected(false);
    bmtxtFileRadio.addActionListener(this);
    bmtxtFileRadio.setActionCommand("bmtxtFileRadio");
    optionsGroup.add(bmtxtFileRadio);
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 5, 0);
    mainPanel.add(bmtxtFileRadio, mainPanelConstraints);

    mainPanelConstraints.gridx = 1;
    mainPanelConstraints.gridy = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 5, 0);
    bmtxtFilePathTextField = new JTextField(55);
    bmtxtFilePathTextField.setText("");
    bmtxtFilePathTextField.setEnabled(false);
    bmtxtFilePathTextField.setEditable(false);
    bmtxtFilePathTextField.setBorder(new LineBorder(Color.gray));
    // bmtxtFilePathTextField.setBackground(Color.lightGray);
    mainPanel.add(bmtxtFilePathTextField, mainPanelConstraints);

    mainPanelConstraints.gridx = 2;
    mainPanelConstraints.gridy = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 5, 5);
    bmtxtFileBrowseButton = new JButton("Browse");
    bmtxtFileBrowseButton.setFont(serif12B);
    bmtxtFileBrowseButton.addActionListener(this);
    bmtxtFileBrowseButton.setActionCommand("bmtxtFileBrowse");
    bmtxtFileBrowseButton.setEnabled(false);
    mainPanel.add(bmtxtFileBrowseButton, mainPanelConstraints);

    mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 4;
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.insets = new Insets(0, 5, 30, 5);
    JLabel parRecInfoLabel =
        new JLabel(
            "Gradient file or b-matrix file must be provided for all DICOM study directories and for versions 4.0 and earlier of Par/Rec");
    parRecInfoLabel.setFont(serif12B);
    parRecInfoLabel.setEnabled(false);
    mainPanel.add(parRecInfoLabel, mainPanelConstraints);

    // mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    // mainPanelConstraints.gridx = 1;
    // mainPanelConstraints.gridy = 4;
    // mainPanelConstraints.insets = new Insets(10,5,5,5);
    // JLabel interleavedLabel = new JLabel("* for interleaved datasets, b-matrix file is
    // required");
    // mainPanel.add(interleavedLabel, mainPanelConstraints);

    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 5;
    mainPanelConstraints.insets = new Insets(15, 5, 15, 0);
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.anchor = GridBagConstraints.CENTER;
    mainPanel.add(regPanel, mainPanelConstraints);

    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 6;
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.insets = new Insets(15, 5, 15, 5);
    outputTextArea = new JTextArea(15, 70);
    outputTextArea.setEditable(false);
    outputTextArea.setBackground(Color.lightGray);
    outputTextArea.setBorder(new LineBorder(Color.black));
    outputTextArea.setForeground(Color.black);
    scrollPane =
        new JScrollPane(
            outputTextArea,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    mainPanel.add(scrollPane, mainPanelConstraints);

    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 7;
    mainPanelConstraints.gridwidth = 3;
    mainPanelConstraints.insets = new Insets(15, 5, 15, 5);
    JLabel refLabel =
        new JLabel(
            "Developed in concert with Dr. Lin-Ching Chang D.Sc.,  Dr. Carlo Pierpaoli MD Ph.D.,  and Lindsay Walker MS from the NIH/NICHD/LIMB/STBB group");
    refLabel.setFont(serif12B);
    mainPanel.add(refLabel, mainPanelConstraints);

    JPanel OKCancelPanel = new JPanel();
    buildOKButton();
    OKButton.setActionCommand("ok");
    OKButton.setFont(serif12B);
    OKCancelPanel.add(OKButton);
    buildCancelButton();
    cancelButton.setActionCommand("cancel");
    cancelButton.setFont(serif12B);
    OKCancelPanel.add(cancelButton);
    buildHelpButton();
    helpButton.setActionCommand("help");
    helpButton.setFont(serif12B);
    OKCancelPanel.add(helpButton);

    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(OKCancelPanel, BorderLayout.SOUTH);

    pack();
    setResizable(false);
    setVisible(true);
  }
Exemplo n.º 14
0
  public StockpileItemDialog(final Program program) {
    super(program, TabsStockpile.get().addStockpileItem(), Images.TOOL_STOCKPILE.getImage());

    ListenerClass listener = new ListenerClass();

    JLabel jItemsLabel = new JLabel(TabsStockpile.get().item());
    jItems = new JComboBox();
    AutoCompleteSupport<Item> itemAutoComplete =
        AutoCompleteSupport.install(
            jItems, EventModels.createSwingThreadProxyList(items), new ItemFilterator());
    itemAutoComplete.setStrict(true);
    itemAutoComplete.setCorrectsCase(true);
    jItems.addItemListener(listener); // Must be added after AutoCompleteSupport

    JLabel jCountMinimumLabel = new JLabel(TabsStockpile.get().countMinimum());
    jCountMinimum = new JTextField();
    jCountMinimum.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(final FocusEvent e) {
            jCountMinimum.selectAll();
          }
        });
    jCountMinimum.addCaretListener(listener);

    jCopy = new JCheckBox(TabsStockpile.get().copy());
    jCopy.setActionCommand(StockpileItemAction.COPY.name());
    jCopy.addActionListener(listener);

    jOK = new JButton(TabsStockpile.get().ok());
    jOK.setActionCommand(StockpileItemAction.OK.name());
    jOK.addActionListener(listener);
    jOK.setEnabled(false);

    jCancel = new JButton(TabsStockpile.get().cancel());
    jCancel.setActionCommand(StockpileItemAction.CANCEL.name());
    jCancel.addActionListener(listener);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.TRAILING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGroup(
                        layout
                            .createParallelGroup()
                            .addComponent(jItemsLabel)
                            .addComponent(jCountMinimumLabel))
                    .addGroup(
                        layout
                            .createParallelGroup()
                            .addComponent(jItems, 300, 300, 300)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(jCountMinimum, 100, 100, Short.MAX_VALUE)
                                    .addComponent(jCopy))))
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(
                        jOK, Program.BUTTONS_WIDTH, Program.BUTTONS_WIDTH, Program.BUTTONS_WIDTH)
                    .addComponent(
                        jCancel,
                        Program.BUTTONS_WIDTH,
                        Program.BUTTONS_WIDTH,
                        Program.BUTTONS_WIDTH)));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(
                        jItemsLabel,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT)
                    .addComponent(
                        jItems,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(
                        jCountMinimumLabel,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT)
                    .addComponent(
                        jCountMinimum,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT)
                    .addComponent(
                        jCopy,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(
                        jOK, Program.BUTTONS_HEIGHT, Program.BUTTONS_HEIGHT, Program.BUTTONS_HEIGHT)
                    .addComponent(
                        jCancel,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT,
                        Program.BUTTONS_HEIGHT)));
  }
  public HexagonViewerAdvance(String[] args) {
    FormPanel panel = new FormPanel("ise/ct/plugins/HexagonViewerForm.jfrm");
    super.add(panel);

    // add references to configurable components on form
    worldMap = panel.getComponentByName("HexagonViewerImage");

    statusTitle = panel.getComponentByName("StatusTitle");
    fileTitle = panel.getLabel("FileTitle");
    fileProgress = panel.getProgressBar("FileProgress");
    iterationTitle = panel.getLabel("IterationTitle");
    iterationProgress = panel.getProgressBar("IterationProgress");
    cycleTitle = panel.getLabel("CycleTitle");
    cycleProgress = panel.getProgressBar("CycleProgress");

    currentTitle = panel.getComponentByName("CurrentTitle");
    commentTitle = panel.getLabel("CommentTitle");
    commentLabel = panel.getLabel("CommentLabel");
    phaseTitle = panel.getLabel("PhaseTitle");
    phaseLabel = panel.getLabel("PhaseLabel");
    turnTitle = panel.getLabel("TurnTitle");
    turnProgress = panel.getProgressBar("TurnProgress");

    showPaths = panel.getCheckBox("ShowPaths");
    showPaths.setActionCommand("showpaths");
    showPaths.setSelected(true);
    doShowPaths = true;
    showPaths.addItemListener(this);

    playButton = panel.getButton("PlayButton");
    stepButton = panel.getButton("StepButton");
    endButton = panel.getButton("EndButton");
    playButton.setActionCommand("play");
    stepButton.setActionCommand("step");
    endButton.setActionCommand("end");
    playButton.addItemListener(this);
    stepButton.addItemListener(this);
    endButton.addItemListener(this);
    playButton.setEnabled(true);
    stepButton.setEnabled(true);
    endButton.setEnabled(true);

    playButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            JButton s = (JButton) ae.getSource();
            if (s.getText().equalsIgnoreCase("Pause")) {
              s.setText("Play");
              Simulator.controlPanel.paused = true;
              Simulator.controlPanel.step = false;
            } else {
              s.setText("Pause");
              Simulator.controlPanel.paused = false;
              Simulator.controlPanel.step = false;
            }
          }
        });

    stepButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            playButton.setText("Play");
            Simulator.controlPanel.paused = true;
            Simulator.controlPanel.step = true;
          }
        });

    endButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            Simulator.experimentLength = Simulator.cycle;
            Simulator.controlPanel.paused = false;
          }
        });

    cycleTitle = panel.getLabel("CycleTitle");
    phaseTitle = panel.getLabel("PhaseTitle");
    inspectorTitle = panel.getLabel("InspectorTitle");
    cycleProgress = panel.getProgressBar("CycleProgress");

    seperator1 = panel.getComponentByName("Seperator1");
    seperator2 = panel.getComponentByName("Seperator2");
    seperator3 = panel.getComponentByName("Seperator3");
    seperator4 = panel.getComponentByName("Seperator4");

    // inspector JScrollPane and JTree
    inspectorScrollPane = panel.getComponentByName("InspectorScrollPane");
    inspectorTree = new JTree();
    inspectorTree.setRowHeight(iconSize);
    inspectorTree.setCellRenderer(
        new DefaultTreeCellRenderer() {
          private static final long serialVersionUID = 1L;

          public Icon getLeafIcon() {
            Icon icon;
            if (this.getText().equals(AUCTION_NAME)) {
              icon = new ImageIcon(createAuctionIcon(iconSize, iconSize));
            } else {
              icon = new ImageIcon(createAgentIcon(this.getText(), iconSize, iconSize));
            }
            return icon;
          }
        });

    getRootPane().setDefaultButton((JButton) playButton);
    super.addComponentListener(this); // resize events etc.

    // set the parameters this frame
    setSize(600, 500);
    setLocation(200, 100);
    setTitle("Hexagon Viewer Advance");
    setVisible(true);
  }
Exemplo n.º 16
0
  private void updateWindow(GraphElementAbstract element) {
    p.removeAll();
    // this.element = element;
    // this.ab = (GraphElementAbstract) graphInstance
    // .getPathwayElement(element);
    original = element;
    PropertyWindowListener pwl = new PropertyWindowListener(element);

    JTextField label = new JTextField(20);
    JTextField name = new JTextField(20);

    if (ref != null) {
      this.ab = ref;
      label.setText(ref.getLabel());
      name.setText(ref.getName());
    } else {
      this.ab = original;
      label.setText(ab.getLabel());
      name.setText(ab.getName());
    }

    reference = new JCheckBox();
    knockedOut = new JCheckBox();
    colorButton = new JButton("Colour");
    hideNeighbours = new JButton("Hide all Neighbours");
    showNeighbours = new JButton("Show all Neighbours");
    parametersButton = new JButton("Parameters");
    showLabels = new JButton("Show Labels");

    colorButton.setBackground(ab.getColor());
    colorButton.setToolTipText("Colour");
    colorButton.setActionCommand("colour");
    colorButton.addActionListener(this);

    // System.out.println("label: "+ab.getLabel());
    // System.out.println("name: "+ab.getName());
    label.setName("label");
    name.setName("name");

    label.addFocusListener(pwl);
    name.addFocusListener(pwl);

    reference.setSelected(ab.isReference());
    reference.setToolTipText("Set this element to a reference");
    reference.setActionCommand("reference");
    reference.addActionListener(this);

    MigLayout headerlayout = new MigLayout("fillx", "[right]rel[grow,fill]", "");
    JPanel headerPanel = new JPanel(headerlayout);
    // headerPanel.setBackground(new Color(192, 215, 227));
    headerPanel.add(new JLabel(ab.getBiologicalElement()), "");
    headerPanel.add(new JSeparator(), "gap 10");

    MigLayout layout = new MigLayout("fillx", "[grow,fill]", "");
    p.setLayout(layout);
    p.add(new JLabel("Element"), "gap 5 ");
    p.add(new JLabel(ab.getBiologicalElement()), "wrap,span 3");
    p.add(new JLabel("Label"), "gap 5 ");
    p.add(label, "wrap,span 3");
    p.add(new JLabel("Name"), "gap 5 ");
    p.add(name, "wrap ,span 3");

    // JCheckBox transitionfire = new JCheckBox("Should transition fire:",
    // true);
    // JTextField transitionStatement = new JTextField("true");

    if (ab.isVertex()) {
      BiologicalNodeAbstract bna = (BiologicalNodeAbstract) original;
      String lbl = "";
      if (bna.hasRef()) {
        lbl = bna.getID() + "_" + bna.getRef().getLabel();
      }
      p.add(new JLabel("Reference:"), "gap 5 ");
      p.add(new JLabel(lbl), "wrap ,span 3");

      if (bna.hasRef()) {
        this.deleteRef = new JButton("Delete Reference");
        deleteRef.setToolTipText("Delete Reference");
        deleteRef.setActionCommand("deleteRef");
        deleteRef.addActionListener(this);
        p.add(deleteRef);
        this.pickOrigin = new JButton("Highlight Origin");
        pickOrigin.setToolTipText("Highlight Origin");
        pickOrigin.setActionCommand("pickOrigin");
        pickOrigin.addActionListener(this);
        p.add(pickOrigin);

      } else {
        this.chooseRef = new JButton("Choose Reference");
        chooseRef.setToolTipText("Choose Reference");
        chooseRef.setActionCommand("chooseRef");
        chooseRef.addActionListener(this);
        p.add(chooseRef);
        if (bna.getRefs().size() > 0) {
          this.pickRefs = new JButton("Highlight References");
          pickRefs.setToolTipText("Highlight References");
          pickRefs.setActionCommand("pickRefs");
          pickRefs.addActionListener(this);
          p.add(pickRefs);
        }
      }

      showLabels.setToolTipText("Show all Labels");
      showLabels.setActionCommand("showLabels");
      showLabels.addActionListener(this);
      p.add(showLabels, "wrap");

      JComboBox<String> compartment = new JComboBox<String>();
      addCompartmentItems(compartment);
      AutoCompleteDecorator.decorate(compartment);

      compartment.setSelectedItem(bna.getCompartment());
      compartment.addItemListener(this);

      p.add(new JLabel("Compartment"), "gap 5 ");
      p.add(compartment, "wrap ,span 3");

      // ADDing Attributes (for all nodes)

      // Show Database IDs
      JTextArea dbids = new JTextArea();
      String dbidstring = new String();
      dbids.setEditable(false);
      dbids.setFont(dbids.getFont().deriveFont(Font.BOLD));
      dbids.setBackground(Color.WHITE);

      p.add(new JLabel("IDs known:"), "gap 5");
      p.add(dbids, "wrap, span 3");

      // Show Experiment names and values
      JTextArea experiments = new JTextArea();
      String experimentstring = new String();
      experiments.setEditable(false);
      experiments.setBackground(Color.WHITE);

      p.add(new JLabel("Dataset:"), "gap 5");
      p.add(experiments, "wrap, span 3");

      // Show GO annotations
      JTextArea goannoations = new JTextArea();
      String annotationstring = new String();
      goannoations.setEditable(false);
      goannoations.setForeground(Color.BLUE);
      goannoations.setBackground(Color.WHITE);

      p.add(new JLabel("Gene Ontology:"), "gap 5");
      p.add(goannoations, "wrap, span 3");

      // Show graph properties (local property)
      JTextArea graphproperties = new JTextArea();
      String propertiesstring = new String();
      graphproperties.setEditable(false);
      graphproperties.setForeground(new Color(255, 55, 55));
      graphproperties.setBackground(Color.WHITE);

      p.add(new JLabel("Graph properties:"), "gap 5");
      p.add(graphproperties, "wrap, span 3");

      // JTextField aaSequence = new JTextField(20);
      // aaSequence.setText(protein.getAaSequence());
      // aaSequence.setName("protein");
      // aaSequence.addFocusListener(pwl);
      // p.add(new JLabel("AA-Sequence"), "gap 5 ");
      // p.add(aaSequence, "wrap, span 3");

      String atname, atsvalue;
      double atdvalue;

      ArrayList<String> experimententries = new ArrayList<>(),
          databaseidentries = new ArrayList<>(),
          annotationentries = new ArrayList<>(),
          graphpropertiesentries = new ArrayList<>();

      for (NodeAttribute att : bna.getNodeAttributes()) {
        atname = att.getName();
        atsvalue = att.getStringvalue();
        atdvalue = att.getDoublevalue();

        switch (att.getType()) {
          case NodeAttributeTypes.EXPERIMENT:
            experimententries.add(atname + ":\t" + atdvalue + "\n");
            break;

          case NodeAttributeTypes.DATABASE_ID:
            databaseidentries.add(atname + ":\t" + atsvalue + "\n");
            break;

          case NodeAttributeTypes.ANNOTATION:
            annotationentries.add(atname + ":\t" + atsvalue + "\n");
            break;

          case NodeAttributeTypes.GRAPH_PROPERTY:
            graphpropertiesentries.add(atname + ":\t" + atdvalue + "\n");
            break;

          default:
            break;
        }
      }

      // Sort for more convenient display
      Collections.sort(experimententries);
      for (String exp : experimententries) experimentstring += exp;

      Collections.sort(databaseidentries);
      for (String dbid : databaseidentries) dbidstring += dbid;

      Collections.sort(annotationentries);
      for (String ann : annotationentries) annotationstring += ann;

      Collections.sort(graphpropertiesentries);
      for (String gprop : graphpropertiesentries) propertiesstring += gprop;

      experiments.setText(experimentstring);
      dbids.setText(dbidstring);
      goannoations.setText(annotationstring);
      graphproperties.setText(propertiesstring);

      if (ab instanceof PathwayMap) {
        p.add(new JLabel("Linked to Pathway"), "gap 5 ");
        boolean b = ((PathwayMap) ab).getPathwayLink() == null;
        JCheckBox linked = new JCheckBox("", !b);
        linked.setToolTipText(
            "Shows whether there is a connected Pathway in Memory to this Map (uncheck the Box to delete that Pathway)");
        linked.setActionCommand("pathwayLink");
        linked.addActionListener(this);
        linked.setEnabled(!b);
        p.add(linked, "wrap ,span 3");
      } else if (ab instanceof Protein) {
        Protein protein = (Protein) ab;
        JTextField aaSequence = new JTextField(20);
        aaSequence.setText(protein.getAaSequence());
        aaSequence.setName("protein");
        aaSequence.addFocusListener(pwl);
        p.add(new JLabel("AA-Sequence"), "gap 5 ");
        p.add(aaSequence, "wrap, span 3");
      } else if (ab instanceof DNA) {
        DNA dna = (DNA) ab;
        JTextField ntSequence = new JTextField(20);
        ntSequence.setText(dna.getNtSequence());
        ntSequence.setName("dna");
        ntSequence.addFocusListener(pwl);
        p.add(new JLabel("NT-Sequence"), "gap 5 ");
        p.add(ntSequence, "wrap, span 3");
      } else if (ab instanceof Gene) {
        Gene dna = (Gene) ab;
        JTextField ntSequence = new JTextField(20);
        ntSequence.setText(dna.getNtSequence());
        ntSequence.setName("gene");
        ntSequence.addFocusListener(pwl);
        p.add(new JLabel("NT-Sequence"), "gap 5 ");
        p.add(ntSequence, "wrap, span 3");
      } else if (ab instanceof RNA) {
        RNA rna = (RNA) ab;
        JTextField ntSequence = new JTextField(20);
        ntSequence.setText(rna.getNtSequence());
        ntSequence.setName("rna");
        ntSequence.addFocusListener(pwl);
        p.add(new JLabel("NT-Sequence"), "gap 5 ");
        p.add(ntSequence, "wrap, span 3");
      } else if (ab instanceof Place) {
        p.add(new JLabel("ID"), "gap 5 ");
        JTextField id = new JTextField(20);
        id.setText("P" + Integer.toString(ab.getID()));
        id.setEditable(false);
        p.add(id, "wrap ,span 3");
        Place place = (Place) ab;

        JLabel lswitchPlace = new JLabel("Place Type");
        JComboBox<String> placeList =
            new JComboBox<String>(new String[] {"discrete", "continuous"});
        if (place.isDiscrete()) placeList.setSelectedItem("discrete");
        else placeList.setSelectedItem("continuous");
        placeList.setName("placeList");
        placeList.addFocusListener(pwl);
        p.add(lswitchPlace, "gap 5 ");
        p.add(placeList, "wrap");

        MyJFormattedTextField token;
        MyJFormattedTextField tokenStart;

        JLabel lblTokenStart = new JLabel("Token Start");
        if (place.isDiscrete()) {
          token = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          tokenStart = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          tokenMin = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          tokenMax = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          token.setText((int) place.getToken() + "");
          tokenStart.setText((int) place.getTokenStart() + "");
          tokenMin.setText((int) place.getTokenMin() + "");
          tokenMax.setText((int) place.getTokenMax() + "");
        } else {
          token = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          tokenStart = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          tokenMin = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          tokenMax = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          token.setText(place.getToken() + "");
          tokenStart.setText(place.getTokenStart() + "");
          tokenMin.setText(place.getTokenMin() + "");
          tokenMax.setText(place.getTokenMax() + "");
        }
        JLabel lblToken = new JLabel("Token");

        token.setName("token");
        // token.addFocusListener(pwl);
        token.setEditable(false);
        token.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);

        tokenStart.setName("tokenStart");
        tokenStart.setFocusLostBehavior(JFormattedTextField.COMMIT);
        tokenStart.addFocusListener(pwl);

        tokenMin.setName("tokenMin");
        tokenMin.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);
        tokenMin.addFocusListener(pwl);
        JLabel lblTokenMin = new JLabel("min Tokens");

        tokenMax.setName("tokenMax");
        tokenMax.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);
        tokenMax.addFocusListener(pwl);
        JLabel lblTokenMax = new JLabel("max Tokens");
        p.add(lblToken, "gap 5 ");
        p.add(token, "wrap");

        p.add(lblTokenStart, "gap 5 ");
        p.add(tokenStart, "");

        constCheck = new JCheckBox("constant");
        constCheck.setActionCommand("constCheck");
        constCheck.addActionListener(this);
        constCheck.setSelected(place.isConstant());
        p.add(constCheck, "wrap");

        if (constCheck.isSelected()) {
          tokenMin.setEnabled(false);
          tokenMax.setEnabled(false);
        }
        p.add(lblTokenMin, "gap 5 ");
        p.add(tokenMin, "wrap");
        p.add(lblTokenMax, "gap 5");
        p.add(tokenMax, "wrap");
      } else if (ab instanceof Transition) {
        JLabel lswitchTrans = new JLabel("Transition Type");
        JComboBox<String> transList =
            new JComboBox<String>(
                new String[] {
                  DiscreteTransition.class.getName(),
                  ContinuousTransition.class.getName(),
                  StochasticTransition.class.getName()
                });
        transList.setSelectedItem(ab.getClass().getCanonicalName());
        transList.setName("transList");
        transList.addFocusListener(pwl);
        p.add(lswitchTrans, "gap 5");
        p.add(transList, "wrap");

        JTextField firingCondition = new JTextField(4);
        JLabel lblFiringCondition = new JLabel("Firing Condition");
        firingCondition.setText(((Transition) ab).getFiringCondition());
        firingCondition.setName("firingCondition");
        firingCondition.addFocusListener(pwl);

        p.add(lblFiringCondition, "gap 5");
        p.add(firingCondition, "wrap");

        if (ab instanceof DiscreteTransition) {
          DiscreteTransition trans = (DiscreteTransition) ab;
          JTextField delay = new JTextField(4);
          JLabel lbldelay = new JLabel("Delay");
          delay.setText(trans.getDelay() + "");
          delay.setName("delay");
          delay.addFocusListener(pwl);

          p.add(lbldelay, "gap 5");
          p.add(delay, "wrap");
        } else if (ab instanceof StochasticTransition) {
          StochasticTransition trans = (StochasticTransition) ab;
          String[] disStrings = {"norm", "exp"};
          // Create the combo box, select item at index 4.
          // Indices start at 0, so 4 specifies the pig.
          JComboBox<String> distributionList = new JComboBox<String>(disStrings);
          distributionList.setSelectedItem(trans.getDistribution());
          distributionList.setName("disList");
          distributionList.addFocusListener(pwl);
          p.add(new JLabel("Distribution"), "gap 5");
          p.add(distributionList, "wrap");
        } else if (ab instanceof ContinuousTransition) {
          ContinuousTransition trans = (ContinuousTransition) ab;
          JTextField maxSpeed = new JTextField(4);
          JLabel lblMaxSpeed = new JLabel("Maximum Speed");
          maxSpeed.setText(trans.getMaximumSpeed());
          maxSpeed.setName("maximumSpeed");
          maxSpeed.addFocusListener(pwl);

          p.add(lblMaxSpeed, "gap 5");
          p.add(maxSpeed, "wrap");

          if (trans.isKnockedOut()) {
            maxSpeed.setEnabled(false);
          }
        }
      }

    } else if (ab.isEdge()) {
      // System.out.println("edge");
      if (ab instanceof PNEdge) {

        PNEdge e = (PNEdge) ab;
        JTextField prob = new JTextField(4);
        prob.setText(e.getActivationProbability() + "");
        prob.setName("activationProb");
        prob.addFocusListener(pwl);
        JLabel lblProb = new JLabel("activation Probability");
        JTextField function = new JTextField(5);
        function.setText(e.getFunction());
        function.setName("function");
        function.addFocusListener(pwl);
        JLabel lblpassingTokens = new JLabel("Edge Function");
        JTextField lowBoundary = new JTextField(5);
        lowBoundary.setText(e.getLowerBoundary() + "");
        lowBoundary.setName("lowBoundary");
        lowBoundary.addFocusListener(pwl);
        JLabel lblLow = new JLabel("lower Boundary");
        JTextField upBoundary = new JTextField(5);
        upBoundary.setText(e.getUpperBoundary() + "");
        upBoundary.setName("upBoundary");
        upBoundary.addFocusListener(pwl);
        JLabel lblUp = new JLabel("upper Boundary");

        // String[] types = { "discrete", "continuous", "inhibition" };
        // Create the combo box, select item at index 4.
        // Indices start at 0, so 4 specifies the pig.
        // JLabel typeList = new JComboBox(types);

        p.add(new JLabel("Edge Type"), "gap 5 ");
        p.add(new JLabel(e.getType()), "wrap");

        JButton dirChanger = new JButton("Change Direction");
        dirChanger.setActionCommand("dirChanger");
        dirChanger.addActionListener(this);
        p.add(dirChanger, "wrap");

        p.add(lblProb, "gap 5");
        p.add(prob, "wrap");
        p.add(lblpassingTokens, "gap 5");
        p.add(function, "wrap");
        p.add(lblLow, "gap 5");
        p.add(lowBoundary, "wrap");
        p.add(lblUp, "gap 5");
        p.add(upBoundary, "wrap");
      }
    }

    p.add(new JLabel("Reference"), "gap 5 ");
    p.add(reference, "wrap, span 3");
    if (ab instanceof Transition) {
      knockedOut.setSelected(((Transition) ab).isKnockedOut());
      knockedOut.setToolTipText("Knock out");
      knockedOut.setActionCommand("knockedOut");
      knockedOut.addActionListener(this);
      p.add(new JLabel("Knocked out"), "gap 5 ");
      p.add(knockedOut, "wrap ,span 3");
    }

    if (ab.isVertex()) {
      hideNeighbours.setToolTipText("Sets all Neighbors of the selected Node to Reference");
      hideNeighbours.setActionCommand("hideNeighbours");
      hideNeighbours.addActionListener(this);
      hideNeighbours.setMaximumSize(new Dimension(120, 30));
      showNeighbours.setToolTipText("Delete Reference flag of all Neighbours of the current Node");
      showNeighbours.setActionCommand("showNeighbours");
      showNeighbours.addActionListener(this);
      showNeighbours.setMaximumSize(new Dimension(120, 30));
      p.add(showNeighbours);
      p.add(hideNeighbours);
    }
    parametersButton.setToolTipText("Show all Parameters");
    parametersButton.setActionCommand("showParameters");
    parametersButton.addActionListener(this);
    p.add(parametersButton);

    p.add(colorButton, "gap 5");
  }
  /** Create the frame. */
  public GuiLauncher() {
    setResizable(false);
    setTitle("PCEE Single Domain with IT and Multipath Support");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 650, 550);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    startServer = new JButton("Start Server");
    startServer.addActionListener(this);
    startServer.setActionCommand("start");
    startServer.setBounds(10, 11, 614, 32);
    contentPane.add(startServer);

    makeRequest = new JButton("Make Request");
    makeRequest.addActionListener(this);
    makeRequest.setActionCommand("request");
    makeRequest.setBounds(10, 212, 614, 32);
    contentPane.add(makeRequest);

    itRequest = new JCheckBox("IT Request");
    itRequest.addActionListener(this);
    itRequest.setActionCommand("it");
    itRequest.setBounds(20, 98, 87, 38);
    contentPane.add(itRequest);

    cpu = new JComboBox();
    cpu.setModel(new DefaultComboBoxModel(new String[] {"1", "2", "3", "4", "5", "6", "7", "8"}));
    cpu.setBounds(142, 107, 46, 20);
    cpu.setEnabled(false);
    contentPane.add(cpu);

    ram = new JComboBox();
    ram.setModel(new DefaultComboBoxModel(new String[] {"32", "64", "128", "256"}));
    ram.setBounds(231, 107, 46, 20);
    ram.setEnabled(false);
    contentPane.add(ram);

    storage = new JComboBox();
    storage.setModel(
        new DefaultComboBoxModel(new String[] {"10", "20", "30", "40", "50", "60", "70", "80"}));
    storage.setBounds(332, 107, 46, 20);
    storage.setEnabled(false);
    contentPane.add(storage);

    JLabel lblCpu = new JLabel("CPU:");
    lblCpu.setBounds(113, 110, 32, 14);
    contentPane.add(lblCpu);

    JLabel lblRam = new JLabel("RAM:");
    lblRam.setBounds(198, 110, 46, 14);
    contentPane.add(lblRam);

    JLabel lblStorage = new JLabel("Storage:");
    lblStorage.setBounds(287, 110, 46, 14);
    contentPane.add(lblStorage);

    JLabel lblSource = new JLabel("Source: ");
    lblSource.setBounds(20, 185, 46, 14);
    contentPane.add(lblSource);

    JLabel lblDestination = new JLabel("Destination:");
    lblDestination.setBounds(215, 185, 72, 14);
    contentPane.add(lblDestination);

    source = new JTextField();
    source.setBounds(86, 182, 80, 20);
    source.setText("192.169.2.1");
    contentPane.add(source);
    source.setColumns(20);

    destination = new JTextField();
    destination.setColumns(20);
    destination.setText("192.169.2.14");
    destination.setBounds(286, 182, 87, 20);
    contentPane.add(destination);

    JLabel lblResult = new JLabel("Result: ");
    lblResult.setBounds(20, 418, 72, 14);
    contentPane.add(lblResult);

    result = new JLabel("");
    result.setHorizontalAlignment(SwingConstants.CENTER);
    result.setBounds(76, 340, 548, 161);
    wResult = result;
    contentPane.add(result);

    btnInitConnection = new JButton("Init Connection");
    btnInitConnection.addActionListener(this);
    btnInitConnection.setActionCommand("init");
    btnInitConnection.setBounds(10, 55, 614, 32);
    contentPane.add(btnInitConnection);

    JLabel lblBandwidth = new JLabel("Bandwidth:");
    lblBandwidth.setBounds(402, 185, 72, 14);
    contentPane.add(lblBandwidth);

    bw = new JComboBox();
    bw.setModel(
        new DefaultComboBoxModel(
            new String[] {"10", "20", "30", "40", "50", "60", "70", "80", "90", "100"}));
    bw.setBounds(476, 182, 46, 20);
    contentPane.add(bw);

    singlePath = new JRadioButton("Single Path");
    singlePath.setBounds(448, 106, 87, 23);
    contentPane.add(singlePath);

    multiPath = new JRadioButton("Multi Path");
    multiPath.setBounds(537, 106, 87, 23);
    contentPane.add(multiPath);

    ButtonGroup bg = new ButtonGroup();
    bg.add(singlePath);
    bg.add(multiPath);
    singlePath.setSelected(true);

    lblDelay = new JLabel("Delay:");
    lblDelay.setBounds(532, 185, 46, 14);
    contentPane.add(lblDelay);

    dl = new JComboBox();
    dl.setModel(new DefaultComboBoxModel(new String[] {"40", "80", "120", "160"}));
    dl.setBounds(578, 181, 46, 20);
    contentPane.add(dl);

    JLabel lblRequestFormat = new JLabel("Request Format: ");
    lblRequestFormat.setBounds(20, 277, 125, 14);
    contentPane.add(lblRequestFormat);

    requestFormat = new JLabel("");
    requestFormat.setHorizontalAlignment(SwingConstants.CENTER);
    requestFormat.setBounds(113, 255, 477, 74);
    contentPane.add(requestFormat);
  }
Exemplo n.º 18
0
  FilterPanel(final FilterGui<E> gui, final FilterControl<E> filterControl) {
    this.gui = gui;
    this.filterControl = filterControl;

    ListenerClass listener = new ListenerClass();

    allColumns = new ArrayList<EnumTableColumn<E>>();
    allColumns.add(new AllColumn<E>());
    allColumns.addAll(filterControl.getColumns());

    numericColumns = new ArrayList<EnumTableColumn<E>>();
    for (EnumTableColumn<E> object : filterControl.getColumns()) {
      if (filterControl.isNumeric(object)) {
        numericColumns.add(object);
      }
    }

    dateColumns = new ArrayList<EnumTableColumn<E>>();
    for (EnumTableColumn<E> object : filterControl.getColumns()) {
      if (filterControl.isDate(object)) {
        dateColumns.add(object);
      }
    }

    jEnabled = new JCheckBox();
    jEnabled.setSelected(true);
    jEnabled.addActionListener(listener);
    jEnabled.setActionCommand(FilterPanelAction.FILTER.name());

    jLogic = new JComboBox<LogicType>(LogicType.values());
    jLogic.setPrototypeDisplayValue(LogicType.AND);
    jLogic.addActionListener(listener);
    jLogic.setActionCommand(FilterPanelAction.FILTER.name());

    JComboBox<String> jComboBox = new JComboBox<String>();
    FontMetrics fontMetrics = jComboBox.getFontMetrics(jComboBox.getFont());
    EnumTableColumn<E> longestColumn = null;
    for (EnumTableColumn<E> column : allColumns) {
      if (longestColumn == null
          || fontMetrics.stringWidth(longestColumn.getColumnName())
              < fontMetrics.stringWidth(column.getColumnName())) {
        longestColumn = column;
      }
    }

    jColumn =
        new JComboBox<EnumTableColumn<E>>(new ListComboBoxModel<EnumTableColumn<E>>(allColumns));
    jColumn.setPrototypeDisplayValue(longestColumn);
    jColumn.addActionListener(listener);
    jColumn.setActionCommand(FilterPanelAction.FILTER.name());

    jCompare = new JComboBox<CompareType>();
    jCompare.setPrototypeDisplayValue(CompareType.CONTAINS_NOT_COLUMN);
    jCompare.addActionListener(listener);
    jCompare.setActionCommand(FilterPanelAction.FILTER.name());

    jText = new JTextField();
    jText.getDocument().addDocumentListener(listener);
    jText.addKeyListener(listener);

    jCompareColumn = new JComboBox<EnumTableColumn<E>>();
    jCompareColumn.setPrototypeDisplayValue(longestColumn);
    jCompareColumn.addActionListener(listener);
    jCompareColumn.setActionCommand(FilterPanelAction.FILTER.name());

    jDate = new JDateChooser(false);
    jDate.addDateChangeListener(listener);

    jSpacing = new JLabel();

    jRemove = new JButton();
    jRemove.setIcon(Images.EDIT_DELETE.getIcon());
    jRemove.addActionListener(listener);
    jRemove.setActionCommand(FilterPanelAction.REMOVE.name());

    timer = new Timer(500, listener);
    timer.setActionCommand(FilterPanelAction.FILTER_TIMER.name());

    jPanel = new JPanel();

    layout = new GroupLayout(jPanel);
    jPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(false);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addComponent(jEnabled, 30, 30, 30)
            .addComponent(
                jLogic,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE)
            .addComponent(
                jColumn,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE)
            .addComponent(
                jCompare,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE)
            .addComponent(jText, 100, 100, Integer.MAX_VALUE)
            .addComponent(
                jCompareColumn,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE)
            .addComponent(
                jDate,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.PREFERRED_SIZE)
            .addComponent(jSpacing, 0, 0, Integer.MAX_VALUE)
            .addComponent(jRemove, 30, 30, 30));
    layout.setVerticalGroup(
        layout
            .createParallelGroup()
            .addComponent(
                jEnabled,
                Program.getButtonsHeight(),
                Program.getButtonsHeight(),
                Program.getButtonsHeight())
            .addComponent(
                jLogic,
                Program.getButtonsHeight(),
                Program.getButtonsHeight(),
                Program.getButtonsHeight())
            .addComponent(
                jColumn,
                Program.getButtonsHeight(),
                Program.getButtonsHeight(),
                Program.getButtonsHeight())
            .addComponent(
                jCompare,
                Program.getButtonsHeight(),
                Program.getButtonsHeight(),
                Program.getButtonsHeight())
            .addComponent(
                jText,
                Program.getButtonsHeight(),
                Program.getButtonsHeight(),
                Program.getButtonsHeight())
            .addComponent(
                jCompareColumn,
                Program.getButtonsHeight(),
                Program.getButtonsHeight(),
                Program.getButtonsHeight())
            .addComponent(
                jDate,
                Program.getButtonsHeight(),
                Program.getButtonsHeight(),
                Program.getButtonsHeight())
            .addComponent(
                jSpacing,
                Program.getButtonsHeight(),
                Program.getButtonsHeight(),
                Program.getButtonsHeight())
            .addComponent(
                jRemove,
                Program.getButtonsHeight(),
                Program.getButtonsHeight(),
                Program.getButtonsHeight()));
    updateNumeric(false);
  }