Esempio n. 1
0
 /** Layout the panel */
 private void layoutPanel() {
   GroupLayout gl = new GroupLayout(this);
   gl.setHonorsVisibility(false);
   gl.setAutoCreateGaps(false);
   gl.setAutoCreateContainerGaps(false);
   gl.setHorizontalGroup(createHorizontalGroup(gl));
   gl.setVerticalGroup(createVerticalGroup(gl));
   setLayout(gl);
 }
  public UninstallationProgressDialogue(Window parent, Set<AddOn> addOns) {
    super(parent, true);

    keyBaseStatusMessage = "";
    listeners = Collections.emptyList();

    setTitle(Constant.messages.getString("cfu.uninstallation.progress.dialogue.title"));
    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

    int max = 0;
    for (AddOn addOn : addOns) {
      max += addOn.getFiles().size();
      max += addOn.getAscanrules().size();
      max += addOn.getPscanrules().size();
      max += addOn.getLoadedExtensions().size() * EXTENSION_UNINSTALL_WEIGHT;
    }

    getProgressBar().setValue(0);
    getProgressBar().setMaximum(max);

    getStatusLabel().setText(" ");
    getCustomLabel().setText(" ");

    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    layout.setHonorsVisibility(false);

    JLabel messageLabel =
        new JLabel(
            Constant.messages.getString("cfu.uninstallation.progress.dialogue.uninstalling"));

    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(messageLabel)
            .addComponent(getStatusLabel())
            .addComponent(getProgressBar(), 200, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE)
            .addComponent(getCustomLabel()));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(messageLabel)
            .addComponent(getStatusLabel())
            .addComponent(getProgressBar())
            .addComponent(getCustomLabel()));

    setContentPane(panel);
    pack();
  }
 private void setLayout() {
   GroupLayout layout = new GroupLayout(dialog.getContentPane());
   dialog.getContentPane().setLayout(layout);
   dialog.setResizable(true);
   layout.setAutoCreateContainerGaps(true);
   layout.setHorizontalGroup(layout.createParallelGroup().addComponent(tabbedPane));
   layout.setVerticalGroup(layout.createParallelGroup().addComponent(tabbedPane));
   layout.setHonorsVisibility(tabbedPane, true);
   // TODO set color here
   dialog.getContentPane().setBackground(new Color(0x132638));
   dialog.validate();
   dialog.repaint();
 }
Esempio n. 4
0
  private void initLayout() { // {{{
    layout = new javax.swing.GroupLayout(listPanel);

    super.setLayout(blayout);
    layout.setHonorsVisibility(true);
    // layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);

    ParallelGroup pg = layout.createParallelGroup(Alignment.LEADING);
    SequentialGroup sg = layout.createSequentialGroup();
    pg = pg.addGroup(sg);
    // add components to this one.
    vgroup = layout.createParallelGroup(Alignment.LEADING);
    sg.addGroup(vgroup);
    layout.setHorizontalGroup(pg);

    // Add out components to this one.
    hgroup = layout.createSequentialGroup();
    ParallelGroup pg1 = layout.createParallelGroup(Alignment.LEADING).addGroup(hgroup);
    layout.setVerticalGroup(pg1);
    // Add the listPanel to our layout
    listPanel.setLayout(layout);
    add(userListPane, BorderLayout.CENTER);
    setupToolBar();
    add(toolbar, BorderLayout.NORTH);
    btnNext.setEnabled(false);
    btnPrev.setEnabled(false);

    userListPane.setHorizontalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    userListPane.setVerticalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    userListPane.setAutoscrolls(true);
    userListPane.setName("userListPane"); // NOI18N
    userListPane.setViewportView(listPanel);
    javax.swing.JScrollBar bar = userListPane.getVerticalScrollBar();
    bar.setUnitIncrement(50);
    TwitzMainView.fixJScrollPaneBarsSize(userListPane);
  } // }}}
Esempio n. 5
0
  protected void setLayout(final Editor editor, boolean activateErrorPanel, boolean isLoading) {
    if (progressBar == null) {
      progressBar = new JProgressBar();
      progressBar.setVisible(false);

      createComponents();
      buildErrorPanel();

      loaderLabel = new JLabel(Toolkit.getLibIcon("manager/loader.gif"));
      loaderLabel.setOpaque(false);
      loaderLabel.setBackground(Color.WHITE);
    }

    int scrollBarWidth =
        contributionListPanel.scrollPane.getVerticalScrollBar().getPreferredSize().width;

    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    //    layout.setAutoCreateContainerGaps(true);
    //    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.CENTER)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGap(ContributionManagerDialog.STATUS_WIDTH)
                    .addComponent(
                        filterField,
                        ContributionManagerDialog.FILTER_WIDTH,
                        ContributionManagerDialog.FILTER_WIDTH,
                        ContributionManagerDialog.FILTER_WIDTH)
                    //                  .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addPreferredGap(
                        LayoutStyle.ComponentPlacement.RELATED,
                        GroupLayout.PREFERRED_SIZE,
                        Short.MAX_VALUE)
                    .addComponent(
                        categoryChooser,
                        ContributionManagerDialog.AUTHOR_WIDTH,
                        ContributionManagerDialog.AUTHOR_WIDTH,
                        ContributionManagerDialog.AUTHOR_WIDTH)
                    .addGap(scrollBarWidth))
            .addComponent(loaderLabel)
            .addComponent(contributionListPanel)
            .addComponent(errorPanel)
            .addComponent(statusPanel));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addContainerGap()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(categoryChooser)
                    .addComponent(filterField))
            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(loaderLabel)
                    .addComponent(contributionListPanel))
            .addComponent(errorPanel)
            .addComponent(
                statusPanel,
                GroupLayout.PREFERRED_SIZE,
                GroupLayout.DEFAULT_SIZE,
                GroupLayout.PREFERRED_SIZE));
    layout.linkSize(SwingConstants.VERTICAL, categoryChooser, filterField);

    // these will occupy space even if not visible
    layout.setHonorsVisibility(contributionListPanel, false);
    layout.setHonorsVisibility(categoryChooser, false);

    setBackground(Color.WHITE);
    setBorder(null);
  }
  /** Default constructor. */
  public ConvexHullPolygonPanel() {
    JLabel lblAlgorithm =
        new JLabel(Messages.getString("panel.hull.algorithm"), Icons.INFO, JLabel.LEFT);
    lblAlgorithm.setToolTipText(Messages.getString("panel.hull.algorithm.tooltip"));
    JLabel lblSource = new JLabel(Messages.getString("panel.hull.source"), Icons.INFO, JLabel.LEFT);
    lblSource.setToolTipText(Messages.getString("panel.hull.source.tooltip"));

    this.cmbAlgorithms = new JComboBox(ITEMS);
    this.cmbAlgorithms.setSelectedItem(DEFAULT_ALGORITHM);
    this.cmbAlgorithms.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            ComboItem item = (ComboItem) cmbAlgorithms.getSelectedItem();
            HullGenerator hullGenerator = (HullGenerator) item.getValue();

            pnlArbitraryPolygon.setHullGenerator(hullGenerator);
            pnlFromFilePolygon.setHullGenerator(hullGenerator);
          }
        });

    HullGenerator hullGenerator = (HullGenerator) DEFAULT_ALGORITHM.getValue();

    this.pnlArbitraryPolygon = new ArbitraryConvexHullPolygonPanel(hullGenerator);
    this.pnlFromFilePolygon = new FromFileConvexHullPolygonPanel(hullGenerator);

    this.rdoArbitrary = new JRadioButton(Messages.getString("panel.hull.source.cloud"));
    this.rdoFromFile = new JRadioButton(Messages.getString("panel.hull.source.file"));

    // set arbitrary as the current one
    this.rdoArbitrary.setSelected(true);

    this.rdoArbitrary.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent event) {
            JRadioButton radio = (JRadioButton) event.getSource();
            CardLayout cl = (CardLayout) pnlSource.getLayout();
            if (radio.isSelected()) {
              cl.show(pnlSource, "arbitrary");
            } else {
              cl.show(pnlSource, "fromFile");
            }
          }
        });

    ButtonGroup bg = new ButtonGroup();
    bg.add(this.rdoFromFile);
    bg.add(this.rdoArbitrary);

    this.pnlSource = new JPanel();
    this.pnlSource.setLayout(new CardLayout());
    this.pnlSource.add(this.pnlArbitraryPolygon, "arbitrary");
    this.pnlSource.add(this.pnlFromFilePolygon, "fromFile");

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);

    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHonorsVisibility(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGroup(
                        layout
                            .createParallelGroup()
                            .addComponent(lblAlgorithm)
                            .addComponent(lblSource))
                    .addGroup(
                        layout
                            .createParallelGroup()
                            .addComponent(this.cmbAlgorithms)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(this.rdoFromFile)
                                    .addComponent(this.rdoArbitrary))))
            .addComponent(this.pnlSource));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(lblAlgorithm)
                    .addComponent(
                        this.cmbAlgorithms,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.CENTER)
                    .addComponent(lblSource)
                    .addComponent(
                        this.rdoFromFile,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addComponent(
                        this.rdoArbitrary,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE))
            .addComponent(this.pnlSource));
  }
Esempio n. 7
0
  /**
   * Creates the panel and adds it to the main window (splitpane) on te left
   *
   * @param splitPane = main windows split into two sides, left and right.
   */
  protected static void addLeftPanel(JSplitPane splitPane) {

    JPanel windowLeft = new JPanel();
    // windowLeft.setBorder(BorderFactory.createLineBorder(Color.black));
    GroupLayout windowLeftLayout = new GroupLayout(windowLeft);
    windowLeft.setLayout(windowLeftLayout); // one column, start with no rows.
    windowLeftLayout.setAutoCreateContainerGaps(true);
    windowLeftLayout.setAutoCreateGaps(true);

    JLabel patientLabel =
        new ByFontSize_JLabel(
            "<html><br><b>Create or Load a New Patient File<br></b></html>",
            ByFontSize_JLabel.Size.L);
    patientLabelPointer =
        patientLabel; // global pointer to use for dynamic updating of label upon every relevant
                      // action
    patientLabel.setVerticalAlignment(JLabel.TOP);

    JLabel chooseResultText =
        new ByFontSize_JLabel("Choose Desired Reult to View:", ByFontSize_JLabel.Size.L);

    JPanel patientDataPanel = new JPanel();
    GroupLayout dataPanelLayout =
        new GroupLayout(
            patientDataPanel); // foolishly using grouplayot when starting out. way more complicated
                               // than it needs to be
    patientDataPanel.setLayout(dataPanelLayout);
    dataPanelLayout.setHonorsVisibility(true);
    dataPanelLayoutPointer =
        dataPanelLayout; // global pointer to use for dynamic updating of label upon every relevant
                         // action

    Component strut50 = Box.createVerticalStrut(50);

    resultChoiceList = new JComboBox<String>(ResultTypes.resultNames());
    resultChoiceList.setSelectedIndex(-1);
    resultChoiceList.setPreferredSize(new Dimension(4000, 25));
    resultChoiceList.setMaximumSize(resultChoiceList.getPreferredSize());
    resultChoiceList.setVisible(false); // invisible till we know there is valid data to work with

    noDataText =
        new ByFontSize_JLabel(
            "<html>No information to show. Please run test to collect data.<html>",
            ByFontSize_JLabel.Size.L);
    noDataText.setVisible(false);

    collectDataButton = new JButton("Begin Test");
    collectDataButton.setVisible(false);
    collectDataButton.setHorizontalAlignment(JButton.CENTER);
    collectDataButton.setToolTipText("Click here to begin sound lateralization test");
    collectDataButton.setFont(new Font("Serif", Font.PLAIN, 18));

    editPatientInfoButton = new JButton("View Patient Information");
    editPatientInfoButton.setVisible(false);
    editPatientInfoButton.setHorizontalAlignment(JButton.CENTER);
    editPatientInfoButton.setToolTipText("Click to edit patient info and add notes");
    editPatientInfoButton.setFont(new Font("Serif", Font.PLAIN, 18));

    ///////////

    windowLeftLayout.setHorizontalGroup(
        windowLeftLayout
            .createParallelGroup(GroupLayout.Alignment.TRAILING)
            .addComponent(patientLabel)
            .addComponent(strut50)
            .addComponent(patientDataPanel));

    windowLeftLayout.setVerticalGroup(
        windowLeftLayout
            .createSequentialGroup()
            .addComponent(patientLabel)
            .addComponent(strut50)
            .addComponent(patientDataPanel));

    //////////////

    currentHorizontalDataGroup =
        dataPanelLayoutPointer
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(chooseResultText)
            .addComponent(strut50)
            .addComponent(resultChoiceList)
            .addComponent(noDataText)
            .addComponent(strut50)
            .addComponent(collectDataButton, GroupLayout.Alignment.CENTER)
            .addComponent(strut50)
            .addComponent(editPatientInfoButton, GroupLayout.Alignment.CENTER);

    currentVerticalDataGroup =
        dataPanelLayoutPointer
            .createSequentialGroup()
            .addComponent(chooseResultText)
            .addComponent(strut50)
            .addComponent(resultChoiceList)
            .addComponent(noDataText)
            .addComponent(strut50)
            .addComponent(collectDataButton)
            .addComponent(strut50)
            .addComponent(editPatientInfoButton);

    dataPanelLayoutPointer.setHorizontalGroup(currentHorizontalDataGroup);
    dataPanelLayoutPointer.setVerticalGroup(currentVerticalDataGroup);

    //////////////

    splitPane.setLeftComponent(windowLeft);
  }