Search in sources :

Example 91 with GridLayout

use of java.awt.GridLayout in project vcell by virtualcell.

the class MicroscopeMeasurementPanel method createFluorescentSpeciesPanel.

private JPanel createFluorescentSpeciesPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    int gridy = 0;
    JLabel label = new JLabel("Choose Fluorescent Species");
    Font boldFont = label.getFont().deriveFont(Font.BOLD);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setFont(boldFont);
    JPanel p = new JPanel();
    p.setBackground(ItemBackgroundColor);
    p.add(label);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(p, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.LINE_START;
    panel.add(new JSeparator(), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.insets = new Insets(4, 10, 4, 4);
    gbc.weightx = 1;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    JScrollPane scrollPane1 = new JScrollPane(allSpeciesContextList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane1.setPreferredSize(new Dimension(200, 200));
    panel.add(scrollPane1, gbc);
    JPanel buttonPanel = new JPanel(new GridLayout(2, 1, 0, 10));
    buttonPanel.add(addButton);
    buttonPanel.add(removeButton);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.insets = new Insets(4, 4, 4, 4);
    panel.add(buttonPanel, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = gridy;
    gbc.insets = new Insets(4, 4, 4, 10);
    gbc.weightx = 1;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    JScrollPane scrollPane2 = new JScrollPane(fluorescentSpeciesContextList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane2.setPreferredSize(scrollPane1.getPreferredSize());
    panel.add(scrollPane2, gbc);
    panel.setBorder(GuiConstants.TAB_PANEL_BORDER);
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridLayout(java.awt.GridLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Font(java.awt.Font) JSeparator(javax.swing.JSeparator)

Example 92 with GridLayout

use of java.awt.GridLayout in project vcell by virtualcell.

the class MicroscopeMeasurementPanel method createPSFPanel.

private JPanel createPSFPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    JLabel label = new JLabel("Point Spread Function");
    Font boldFont = label.getFont().deriveFont(Font.BOLD);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setFont(boldFont);
    JPanel p = new JPanel();
    p.setBackground(ItemBackgroundColor);
    p.add(label);
    int gridy = 0;
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.FIRST_LINE_START;
    panel.add(p, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.LINE_START;
    panel.add(new JSeparator(), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.insets = new Insets(0, 4, 2, 4);
    gbc.anchor = GridBagConstraints.LINE_START;
    panel.add(rdbtnZprojection, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.insets = new Insets(0, 4, 2, 4);
    gbc.anchor = GridBagConstraints.LINE_START;
    panel.add(radioButtonGaussian, gbc);
    gaussianPsfPanel = createGaussianPsfPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(0, 4, 2, 4);
    gbc.anchor = GridBagConstraints.LINE_START;
    panel.add(gaussianPsfPanel, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.insets = new Insets(0, 4, 4, 4);
    gbc.anchor = GridBagConstraints.LINE_START;
    panel.add(rdbtnExperimental, gbc);
    experimentalPsfPanel = new JPanel(new GridLayout(1, 2, 10, 0));
    experimentalPsfPanel.add(pointSpreadFunctionsComboBox);
    experimentalPsfPanel.add(importPsfButton);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(0, 4, 4, 4);
    gbc.anchor = GridBagConstraints.LINE_START;
    panel.add(experimentalPsfPanel, gbc);
    panel.setBorder(GuiConstants.TAB_PANEL_BORDER);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridLayout(java.awt.GridLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Font(java.awt.Font) JSeparator(javax.swing.JSeparator)

Example 93 with GridLayout

use of java.awt.GridLayout in project gitblit by gitblit.

the class SettingsPanel method editSetting.

protected void editSetting(final SettingModel settingModel) {
    final JTextField textField = new JTextField(settingModel.currentValue);
    JPanel editPanel = new JPanel(new GridLayout(0, 1));
    editPanel.add(new JLabel("New Value"));
    editPanel.add(textField);
    JPanel settingPanel = new JPanel(new BorderLayout());
    settingPanel.add(new SettingPanel(settingModel), BorderLayout.CENTER);
    settingPanel.add(editPanel, BorderLayout.SOUTH);
    settingPanel.setPreferredSize(new Dimension(800, 200));
    String[] options;
    if (settingModel.currentValue.equals(settingModel.defaultValue)) {
        options = new String[] { Translation.get("gb.cancel"), Translation.get("gb.save") };
    } else {
        options = new String[] { Translation.get("gb.cancel"), Translation.get("gb.setDefault"), Translation.get("gb.save") };
    }
    String defaultOption = options[0];
    int selection = JOptionPane.showOptionDialog(SettingsPanel.this, settingPanel, settingModel.name, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, new ImageIcon(getClass().getResource("/settings_16x16.png")), options, defaultOption);
    if (selection <= 0) {
        return;
    }
    if (options[selection].equals(Translation.get("gb.setDefault"))) {
        textField.setText(settingModel.defaultValue);
    }
    final Map<String, String> newSettings = new HashMap<String, String>();
    newSettings.put(settingModel.name, textField.getText().trim());
    GitblitWorker worker = new GitblitWorker(SettingsPanel.this, RpcRequest.EDIT_SETTINGS) {

        @Override
        protected Boolean doRequest() throws IOException {
            boolean success = gitblit.updateSettings(newSettings);
            if (success) {
                gitblit.refreshSettings();
            }
            return success;
        }

        @Override
        protected void onSuccess() {
            updateTable(false);
        }
    };
    worker.execute();
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) HashMap(java.util.HashMap) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout)

Example 94 with GridLayout

use of java.awt.GridLayout in project gitblit by gitblit.

the class EditRepositoryDialog method initialize.

private void initialize(int protocolVersion, RepositoryModel anRepository) {
    nameField = new JTextField(anRepository.name == null ? "" : anRepository.name, 35);
    descriptionField = new JTextField(anRepository.description == null ? "" : anRepository.description, 35);
    JTextField originField = new JTextField(anRepository.origin == null ? "" : anRepository.origin, 40);
    originField.setEditable(false);
    if (ArrayUtils.isEmpty(anRepository.availableRefs)) {
        headRefField = new JComboBox();
        headRefField.setEnabled(false);
    } else {
        headRefField = new JComboBox(anRepository.availableRefs.toArray());
        headRefField.setSelectedItem(anRepository.HEAD);
    }
    Integer[] gcPeriods = { 1, 2, 3, 4, 5, 7, 10, 14 };
    gcPeriod = new JComboBox(gcPeriods);
    gcPeriod.setSelectedItem(anRepository.gcPeriod);
    gcThreshold = new JTextField(8);
    gcThreshold.setText(anRepository.gcThreshold);
    ownersPalette = new JPalette<String>(true);
    acceptNewTickets = new JCheckBox(Translation.get("gb.acceptsNewTicketsDescription"), anRepository.acceptNewTickets);
    acceptNewPatchsets = new JCheckBox(Translation.get("gb.acceptsNewPatchsetsDescription"), anRepository.acceptNewPatchsets);
    requireApproval = new JCheckBox(Translation.get("gb.requireApprovalDescription"), anRepository.requireApproval);
    if (ArrayUtils.isEmpty(anRepository.availableRefs)) {
        mergeToField = new JComboBox();
        mergeToField.setEnabled(false);
    } else {
        mergeToField = new JComboBox(anRepository.availableRefs.toArray());
        mergeToField.setSelectedItem(anRepository.mergeTo);
    }
    useIncrementalPushTags = new JCheckBox(Translation.get("gb.useIncrementalPushTagsDescription"), anRepository.useIncrementalPushTags);
    showRemoteBranches = new JCheckBox(Translation.get("gb.showRemoteBranchesDescription"), anRepository.showRemoteBranches);
    skipSizeCalculation = new JCheckBox(Translation.get("gb.skipSizeCalculationDescription"), anRepository.skipSizeCalculation);
    skipSummaryMetrics = new JCheckBox(Translation.get("gb.skipSummaryMetricsDescription"), anRepository.skipSummaryMetrics);
    isFrozen = new JCheckBox(Translation.get("gb.isFrozenDescription"), anRepository.isFrozen);
    maxActivityCommits = new JComboBox(new Integer[] { -1, 0, 25, 50, 75, 100, 150, 250, 500 });
    maxActivityCommits.setSelectedItem(anRepository.maxActivityCommits);
    mailingListsField = new JTextField(ArrayUtils.isEmpty(anRepository.mailingLists) ? "" : StringUtils.flattenStrings(anRepository.mailingLists, " "), 50);
    accessRestriction = new JComboBox(AccessRestrictionType.values());
    accessRestriction.setRenderer(new AccessRestrictionRenderer());
    accessRestriction.setSelectedItem(anRepository.accessRestriction);
    accessRestriction.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                AccessRestrictionType art = (AccessRestrictionType) accessRestriction.getSelectedItem();
                EditRepositoryDialog.this.setupAccessPermissions(art);
            }
        }
    });
    boolean authenticated = anRepository.authorizationControl != null && AuthorizationControl.AUTHENTICATED.equals(anRepository.authorizationControl);
    allowAuthenticated = new JRadioButton(Translation.get("gb.allowAuthenticatedDescription"));
    allowAuthenticated.setSelected(authenticated);
    allowAuthenticated.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                usersPalette.setEnabled(false);
                teamsPalette.setEnabled(false);
            }
        }
    });
    allowNamed = new JRadioButton(Translation.get("gb.allowNamedDescription"));
    allowNamed.setSelected(!authenticated);
    allowNamed.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                usersPalette.setEnabled(true);
                teamsPalette.setEnabled(true);
            }
        }
    });
    ButtonGroup group = new ButtonGroup();
    group.add(allowAuthenticated);
    group.add(allowNamed);
    JPanel authorizationPanel = new JPanel(new GridLayout(0, 1));
    authorizationPanel.add(allowAuthenticated);
    authorizationPanel.add(allowNamed);
    allowForks = new JCheckBox(Translation.get("gb.allowForksDescription"), anRepository.allowForks);
    verifyCommitter = new JCheckBox(Translation.get("gb.verifyCommitterDescription"), anRepository.verifyCommitter);
    // federation strategies - remove ORIGIN choice if this repository has
    // no origin.
    List<FederationStrategy> federationStrategies = new ArrayList<FederationStrategy>(Arrays.asList(FederationStrategy.values()));
    if (StringUtils.isEmpty(anRepository.origin)) {
        federationStrategies.remove(FederationStrategy.FEDERATE_ORIGIN);
    }
    federationStrategy = new JComboBox(federationStrategies.toArray());
    federationStrategy.setRenderer(new FederationStrategyRenderer());
    federationStrategy.setSelectedItem(anRepository.federationStrategy);
    JPanel fieldsPanel = new JPanel(new GridLayout(0, 1));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.name"), nameField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.description"), descriptionField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.origin"), originField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.headRef"), headRefField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.gcPeriod"), gcPeriod));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.gcThreshold"), gcThreshold));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.acceptsNewTickets"), acceptNewTickets));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.acceptsNewPatchsets"), acceptNewPatchsets));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.requireApproval"), requireApproval));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.mergeTo"), mergeToField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.enableIncrementalPushTags"), useIncrementalPushTags));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.showRemoteBranches"), showRemoteBranches));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.skipSizeCalculation"), skipSizeCalculation));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.skipSummaryMetrics"), skipSummaryMetrics));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.maxActivityCommits"), maxActivityCommits));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.mailingLists"), mailingListsField));
    JPanel clonePushPanel = new JPanel(new GridLayout(0, 1));
    clonePushPanel.add(newFieldPanel(Translation.get("gb.isFrozen"), isFrozen));
    clonePushPanel.add(newFieldPanel(Translation.get("gb.allowForks"), allowForks));
    clonePushPanel.add(newFieldPanel(Translation.get("gb.verifyCommitter"), verifyCommitter));
    usersPalette = new RegistrantPermissionsPanel(RegistrantType.USER);
    JPanel northFieldsPanel = new JPanel(new BorderLayout(0, 5));
    northFieldsPanel.add(newFieldPanel(Translation.get("gb.owners"), ownersPalette), BorderLayout.NORTH);
    northFieldsPanel.add(newFieldPanel(Translation.get("gb.accessRestriction"), accessRestriction), BorderLayout.CENTER);
    JPanel northAccessPanel = new JPanel(new BorderLayout(5, 5));
    northAccessPanel.add(northFieldsPanel, BorderLayout.NORTH);
    northAccessPanel.add(newFieldPanel(Translation.get("gb.authorizationControl"), authorizationPanel), BorderLayout.CENTER);
    northAccessPanel.add(clonePushPanel, BorderLayout.SOUTH);
    JPanel accessPanel = new JPanel(new BorderLayout(5, 5));
    accessPanel.add(northAccessPanel, BorderLayout.NORTH);
    accessPanel.add(newFieldPanel(Translation.get("gb.userPermissions"), usersPalette), BorderLayout.CENTER);
    teamsPalette = new RegistrantPermissionsPanel(RegistrantType.TEAM);
    JPanel teamsPanel = new JPanel(new BorderLayout(5, 5));
    teamsPanel.add(newFieldPanel(Translation.get("gb.teamPermissions"), teamsPalette), BorderLayout.CENTER);
    setsPalette = new JPalette<String>();
    JPanel federationPanel = new JPanel(new BorderLayout(5, 5));
    federationPanel.add(newFieldPanel(Translation.get("gb.federationStrategy"), federationStrategy), BorderLayout.NORTH);
    federationPanel.add(newFieldPanel(Translation.get("gb.federationSets"), setsPalette), BorderLayout.CENTER);
    indexedBranchesPalette = new JPalette<String>();
    JPanel indexedBranchesPanel = new JPanel(new BorderLayout(5, 5));
    indexedBranchesPanel.add(newFieldPanel(Translation.get("gb.indexedBranches"), indexedBranchesPalette), BorderLayout.CENTER);
    preReceivePalette = new JPalette<String>(true);
    preReceiveInherited = new JLabel();
    JPanel preReceivePanel = new JPanel(new BorderLayout(5, 5));
    preReceivePanel.add(preReceivePalette, BorderLayout.CENTER);
    preReceivePanel.add(preReceiveInherited, BorderLayout.WEST);
    postReceivePalette = new JPalette<String>(true);
    postReceiveInherited = new JLabel();
    JPanel postReceivePanel = new JPanel(new BorderLayout(5, 5));
    postReceivePanel.add(postReceivePalette, BorderLayout.CENTER);
    postReceivePanel.add(postReceiveInherited, BorderLayout.WEST);
    customFieldsPanel = new JPanel();
    customFieldsPanel.setLayout(new BoxLayout(customFieldsPanel, BoxLayout.Y_AXIS));
    JScrollPane customFieldsScrollPane = new JScrollPane(customFieldsPanel);
    customFieldsScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    customFieldsScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    JTabbedPane panel = new JTabbedPane(JTabbedPane.TOP);
    panel.addTab(Translation.get("gb.general"), fieldsPanel);
    panel.addTab(Translation.get("gb.accessRestriction"), accessPanel);
    if (protocolVersion >= 2) {
        panel.addTab(Translation.get("gb.teams"), teamsPanel);
    }
    panel.addTab(Translation.get("gb.federation"), federationPanel);
    if (protocolVersion >= 3) {
        panel.addTab(Translation.get("gb.indexedBranches"), indexedBranchesPanel);
    }
    panel.addTab(Translation.get("gb.preReceiveScripts"), preReceivePanel);
    panel.addTab(Translation.get("gb.postReceiveScripts"), postReceivePanel);
    panel.addTab(Translation.get("gb.customFields"), customFieldsScrollPane);
    setupAccessPermissions(anRepository.accessRestriction);
    JButton createButton = new JButton(Translation.get("gb.save"));
    createButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            if (validateFields()) {
                canceled = false;
                setVisible(false);
            }
        }
    });
    JButton cancelButton = new JButton(Translation.get("gb.cancel"));
    cancelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            canceled = true;
            setVisible(false);
        }
    });
    JPanel controls = new JPanel();
    controls.add(cancelButton);
    controls.add(createButton);
    final Insets _insets = new Insets(5, 5, 5, 5);
    JPanel centerPanel = new JPanel(new BorderLayout(5, 5)) {

        private static final long serialVersionUID = 1L;

        @Override
        public Insets getInsets() {
            return _insets;
        }
    };
    centerPanel.add(panel, BorderLayout.CENTER);
    centerPanel.add(controls, BorderLayout.SOUTH);
    getContentPane().setLayout(new BorderLayout(5, 5));
    getContentPane().add(centerPanel, BorderLayout.CENTER);
    pack();
    nameField.requestFocus();
}
Also used : JPanel(javax.swing.JPanel) ItemEvent(java.awt.event.ItemEvent) JRadioButton(javax.swing.JRadioButton) Insets(java.awt.Insets) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JTabbedPane(javax.swing.JTabbedPane) ArrayList(java.util.ArrayList) JButton(javax.swing.JButton) JTextField(javax.swing.JTextField) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) AccessRestrictionType(com.gitblit.Constants.AccessRestrictionType) JScrollPane(javax.swing.JScrollPane) JComboBox(javax.swing.JComboBox) FederationStrategy(com.gitblit.Constants.FederationStrategy) JLabel(javax.swing.JLabel) JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) ItemListener(java.awt.event.ItemListener)

Example 95 with GridLayout

use of java.awt.GridLayout in project gitblit by gitblit.

the class EditTeamDialog method initialize.

private void initialize(int protocolVersion, TeamModel aTeam) {
    teamnameField = new JTextField(aTeam.name == null ? "" : aTeam.name, 25);
    canAdminCheckbox = new JCheckBox(Translation.get("gb.canAdminDescription"), aTeam.canAdmin);
    canForkCheckbox = new JCheckBox(Translation.get("gb.canForkDescription"), aTeam.canFork);
    canCreateCheckbox = new JCheckBox(Translation.get("gb.canCreateDescription"), aTeam.canCreate);
    mailingListsField = new JTextField(aTeam.mailingLists == null ? "" : StringUtils.flattenStrings(aTeam.mailingLists, " "), 50);
    JPanel fieldsPanel = new JPanel(new GridLayout(0, 1));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.teamName"), teamnameField));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.canAdmin"), canAdminCheckbox));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.canFork"), canForkCheckbox));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.canCreate"), canCreateCheckbox));
    fieldsPanel.add(newFieldPanel(Translation.get("gb.mailingLists"), mailingListsField));
    final Insets _insets = new Insets(5, 5, 5, 5);
    repositoryPalette = new RegistrantPermissionsPanel(RegistrantType.REPOSITORY);
    userPalette = new JPalette<String>();
    JPanel fieldsPanelTop = new JPanel(new BorderLayout());
    fieldsPanelTop.add(fieldsPanel, BorderLayout.NORTH);
    JPanel repositoriesPanel = new JPanel(new BorderLayout()) {

        private static final long serialVersionUID = 1L;

        @Override
        public Insets getInsets() {
            return _insets;
        }
    };
    repositoriesPanel.add(repositoryPalette, BorderLayout.CENTER);
    JPanel usersPanel = new JPanel(new BorderLayout()) {

        private static final long serialVersionUID = 1L;

        @Override
        public Insets getInsets() {
            return _insets;
        }
    };
    usersPanel.add(userPalette, BorderLayout.CENTER);
    preReceivePalette = new JPalette<String>(true);
    preReceiveInherited = new JLabel();
    JPanel preReceivePanel = new JPanel(new BorderLayout(5, 5));
    preReceivePanel.add(preReceivePalette, BorderLayout.CENTER);
    preReceivePanel.add(preReceiveInherited, BorderLayout.WEST);
    postReceivePalette = new JPalette<String>(true);
    postReceiveInherited = new JLabel();
    JPanel postReceivePanel = new JPanel(new BorderLayout(5, 5));
    postReceivePanel.add(postReceivePalette, BorderLayout.CENTER);
    postReceivePanel.add(postReceiveInherited, BorderLayout.WEST);
    JTabbedPane panel = new JTabbedPane(JTabbedPane.TOP);
    panel.addTab(Translation.get("gb.general"), fieldsPanelTop);
    panel.addTab(Translation.get("gb.teamMembers"), usersPanel);
    panel.addTab(Translation.get("gb.restrictedRepositories"), repositoriesPanel);
    panel.addTab(Translation.get("gb.preReceiveScripts"), preReceivePanel);
    panel.addTab(Translation.get("gb.postReceiveScripts"), postReceivePanel);
    JButton createButton = new JButton(Translation.get("gb.save"));
    createButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            if (validateFields()) {
                canceled = false;
                setVisible(false);
            }
        }
    });
    JButton cancelButton = new JButton(Translation.get("gb.cancel"));
    cancelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            canceled = true;
            setVisible(false);
        }
    });
    JPanel controls = new JPanel();
    controls.add(cancelButton);
    controls.add(createButton);
    JPanel centerPanel = new JPanel(new BorderLayout(5, 5)) {

        private static final long serialVersionUID = 1L;

        @Override
        public Insets getInsets() {
            return _insets;
        }
    };
    centerPanel.add(panel, BorderLayout.CENTER);
    centerPanel.add(controls, BorderLayout.SOUTH);
    getContentPane().setLayout(new BorderLayout(5, 5));
    getContentPane().add(centerPanel, BorderLayout.CENTER);
    pack();
}
Also used : JPanel(javax.swing.JPanel) Insets(java.awt.Insets) ActionEvent(java.awt.event.ActionEvent) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener)

Aggregations

GridLayout (java.awt.GridLayout)189 JPanel (javax.swing.JPanel)149 JLabel (javax.swing.JLabel)79 BorderLayout (java.awt.BorderLayout)67 Dimension (java.awt.Dimension)51 JButton (javax.swing.JButton)41 ActionEvent (java.awt.event.ActionEvent)36 JScrollPane (javax.swing.JScrollPane)34 ActionListener (java.awt.event.ActionListener)32 Insets (java.awt.Insets)28 JCheckBox (javax.swing.JCheckBox)28 JTextField (javax.swing.JTextField)28 GridBagConstraints (java.awt.GridBagConstraints)24 GridBagLayout (java.awt.GridBagLayout)23 ButtonGroup (javax.swing.ButtonGroup)22 FlowLayout (java.awt.FlowLayout)21 BoxLayout (javax.swing.BoxLayout)21 TitledBorder (javax.swing.border.TitledBorder)19 PlotCanvas (smile.plot.PlotCanvas)16 EmptyBorder (javax.swing.border.EmptyBorder)15