Search in sources :

Example 1 with PREFERRED_SIZE

use of javax.swing.GroupLayout.PREFERRED_SIZE in project EnrichmentMapApp by BaderLab.

the class HeatMapMainPanel method createToolbarPanel.

private JPanel createToolbarPanel() {
    gradientLegendPanel = new GradientLegendPanel(table);
    showValuesCheck = new JCheckBox("Show Values");
    JLabel operatorLabel = new JLabel("Genes:");
    operatorCombo = new JComboBox<>();
    JLabel normLabel = new JLabel("Expressions:");
    normCombo = new JComboBox<>();
    SwingUtil.makeSmall(operatorLabel, operatorCombo, normLabel, normCombo, showValuesCheck);
    operatorCombo.addItem(new ComboItem<>(Operator.UNION, "Union"));
    operatorCombo.addItem(new ComboItem<>(Operator.INTERSECTION, "Intersection"));
    operatorCombo.setSelectedItem(ComboItem.of(Operator.UNION));
    normCombo.addItem(new ComboItem<>(Transform.AS_IS, "Expression Values"));
    normCombo.addItem(new ComboItem<>(Transform.ROW_NORMALIZE, "Row Normalize"));
    normCombo.addItem(new ComboItem<>(Transform.LOG_TRANSFORM, "Log Transform"));
    normCombo.addItem(new ComboItem<>(Transform.COMPRESS_MEDIAN, "Compress (Median)"));
    normCombo.addItem(new ComboItem<>(Transform.COMPRESS_MIN, "Compress (Min)"));
    normCombo.addItem(new ComboItem<>(Transform.COMPRESS_MAX, "Compress (Max)"));
    normCombo.setSelectedItem(ComboItem.of(Transform.COMPRESS_MEDIAN));
    operatorCombo.addActionListener(operatorActionListener = e -> updateSetting_Operator(getOperator()));
    normCombo.addActionListener(normActionListener = e -> updateSetting_Transform(getTransform()));
    showValuesCheck.addActionListener(showValueActionListener = e -> updateSetting_ShowValues(isShowValues()));
    JButton plusButton = SwingUtil.createIconButton(iconManager, IconManager.ICON_PLUS, "Add Rankings...");
    JButton gearButton = SwingUtil.createIconButton(iconManager, IconManager.ICON_GEAR, "Settings");
    JButton menuButton = SwingUtil.createIconButton(iconManager, IconManager.ICON_EXTERNAL_LINK, "Export");
    LookAndFeelUtil.equalizeSize(gearButton, menuButton);
    plusButton.addActionListener(e -> addRankings());
    gearButton.addActionListener(e -> settingsPanel.popup(gearButton));
    menuButton.addActionListener(this::showExportMenu);
    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(false);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(gradientLegendPanel, 180, 180, 180).addGap(0, 0, Short.MAX_VALUE).addComponent(operatorLabel).addComponent(operatorCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(5).addComponent(normLabel).addComponent(normCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(5).addComponent(showValuesCheck).addGap(5).addComponent(plusButton).addComponent(gearButton).addComponent(menuButton));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(gradientLegendPanel).addComponent(operatorLabel).addComponent(operatorCombo).addComponent(normLabel).addComponent(normCombo).addComponent(showValuesCheck).addComponent(plusButton).addComponent(gearButton).addComponent(menuButton));
    panel.setOpaque(false);
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) Arrays(java.util.Arrays) Inject(com.google.inject.Inject) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection) HeatMapTableModel(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.HeatMapTableModel) Operator(org.baderlab.csplugins.enrichmentmap.view.heatmap.HeatMapParams.Operator) JTableHeader(javax.swing.table.JTableHeader) TableCellRenderer(javax.swing.table.TableCellRenderer) IconManager(org.cytoscape.util.swing.IconManager) Assisted(com.google.inject.assistedinject.Assisted) ComboItem(org.baderlab.csplugins.enrichmentmap.view.util.ComboItem) Map(java.util.Map) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) DEFAULT_SIZE(javax.swing.GroupLayout.DEFAULT_SIZE) Set(java.util.Set) ColorAndValueRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.ColorAndValueRenderer) Distance(org.baderlab.csplugins.enrichmentmap.view.heatmap.HeatMapParams.Distance) Component(java.awt.Component) Collectors(java.util.stream.Collectors) TableRowSorter(javax.swing.table.TableRowSorter) Sets(com.google.common.collect.Sets) PREFERRED_SIZE(javax.swing.GroupLayout.PREFERRED_SIZE) List(java.util.List) Alignment(javax.swing.GroupLayout.Alignment) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) LookAndFeelUtil(org.cytoscape.util.swing.LookAndFeelUtil) SwingUtil(org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil) ColumnHeaderRankOptionRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.ColumnHeaderRankOptionRenderer) JCheckBox(javax.swing.JCheckBox) Optional(java.util.Optional) JTable(javax.swing.JTable) ColumnHeaderVerticalRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.ColumnHeaderVerticalRenderer) RankValue(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.RankValue) JPanel(javax.swing.JPanel) ListSelectionModel(javax.swing.ListSelectionModel) ActionListener(java.awt.event.ActionListener) TableColumnModel(javax.swing.table.TableColumnModel) SortKey(javax.swing.RowSorter.SortKey) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) CompletableFuture(java.util.concurrent.CompletableFuture) GradientLegendPanel(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.GradientLegendPanel) ArrayList(java.util.ArrayList) SwingUtilities(javax.swing.SwingUtilities) EMStyleBuilder(org.baderlab.csplugins.enrichmentmap.style.EMStyleBuilder) JButton(javax.swing.JButton) Transform(org.baderlab.csplugins.enrichmentmap.view.heatmap.HeatMapParams.Transform) TableColumn(javax.swing.table.TableColumn) JPopupMenu(javax.swing.JPopupMenu) ActionEvent(java.awt.event.ActionEvent) RankOptionErrorHeader(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.RankOptionErrorHeader) RankValueRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.RankValueRenderer) JScrollPane(javax.swing.JScrollPane) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout) ColorRenderer(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.ColorRenderer) Comparator(java.util.Comparator) JPanel(javax.swing.JPanel) GradientLegendPanel(org.baderlab.csplugins.enrichmentmap.view.heatmap.table.GradientLegendPanel) JButton(javax.swing.JButton) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel)

Example 2 with PREFERRED_SIZE

use of javax.swing.GroupLayout.PREFERRED_SIZE in project EnrichmentMapApp by BaderLab.

the class PostAnalysisWeightPanel method createHypergeomPanel.

private JPanel createHypergeomPanel() {
    ActionListener universeSelectActionListener = e -> {
        boolean enable = e.getActionCommand().equals("User Defined");
        universeSelectionTextField.setEnabled(enable);
    };
    gmtRadioButton = new JRadioButton();
    gmtRadioButton.setActionCommand("GMT");
    gmtRadioButton.addActionListener(universeSelectActionListener);
    gmtRadioButton.setSelected(true);
    expressionSetRadioButton = new JRadioButton();
    expressionSetRadioButton.setActionCommand("Expression Set");
    expressionSetRadioButton.addActionListener(universeSelectActionListener);
    intersectionRadioButton = new JRadioButton();
    intersectionRadioButton.setActionCommand("Intersection");
    intersectionRadioButton.addActionListener(universeSelectActionListener);
    userDefinedRadioButton = new JRadioButton("User Defined:");
    userDefinedRadioButton.setActionCommand("User Defined");
    userDefinedRadioButton.addActionListener(universeSelectActionListener);
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(gmtRadioButton);
    buttonGroup.add(expressionSetRadioButton);
    buttonGroup.add(intersectionRadioButton);
    buttonGroup.add(userDefinedRadioButton);
    DecimalFormat intFormat = new DecimalFormat();
    intFormat.setParseIntegerOnly(true);
    universeSelectionTextField = new JFormattedTextField(intFormat);
    universeSelectionTextField.addPropertyChangeListener("value", e -> {
        Number val = (Number) universeSelectionTextField.getValue();
        if (val == null || val.intValue() < 0) {
            universeSelectionTextField.setValue(1);
            CySwingApplication application = serviceRegistrar.getService(CySwingApplication.class);
            JOptionPane.showMessageDialog(application.getJFrame(), "Universe value must be greater than zero", "Parameter out of bounds", JOptionPane.WARNING_MESSAGE);
        }
    });
    universeSelectionTextField.setEnabled(false);
    gmtRadioButton.setText("GMT");
    expressionSetRadioButton.setText("Expression Set");
    intersectionRadioButton.setText("Intersection");
    universeSelectionTextField.setValue(0);
    makeSmall(gmtRadioButton, expressionSetRadioButton, intersectionRadioButton, userDefinedRadioButton, universeSelectionTextField);
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Advanced Hypergeometric Universe"));
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(gmtRadioButton).addComponent(expressionSetRadioButton).addComponent(intersectionRadioButton).addGroup(layout.createSequentialGroup().addComponent(userDefinedRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(universeSelectionTextField, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(gmtRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(expressionSetRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(intersectionRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(userDefinedRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(universeSelectionTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : Arrays(java.util.Arrays) CardLayout(java.awt.CardLayout) ActionListener(java.awt.event.ActionListener) PostAnalysisParameters(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisParameters) JTextField(javax.swing.JTextField) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) Ranking(org.baderlab.csplugins.enrichmentmap.model.Ranking) IconManager(org.cytoscape.util.swing.IconManager) PostAnalysisFilterParameters(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterParameters) GeneExpressionMatrix(org.baderlab.csplugins.enrichmentmap.model.GeneExpressionMatrix) Map(java.util.Map) EnablementComboBoxRenderer(org.baderlab.csplugins.enrichmentmap.view.EnablementComboBoxRenderer) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) SwingUtil.makeSmall(org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil.makeSmall) JComboBox(javax.swing.JComboBox) JFrame(javax.swing.JFrame) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) DEFAULT_SIZE(javax.swing.GroupLayout.DEFAULT_SIZE) UniverseType(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisParameters.UniverseType) JFormattedTextField(javax.swing.JFormattedTextField) ButtonGroup(javax.swing.ButtonGroup) DecimalFormat(java.text.DecimalFormat) ComponentPlacement(javax.swing.LayoutStyle.ComponentPlacement) JOptionPane(javax.swing.JOptionPane) JRadioButton(javax.swing.JRadioButton) PREFERRED_SIZE(javax.swing.GroupLayout.PREFERRED_SIZE) List(java.util.List) Alignment(javax.swing.GroupLayout.Alignment) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) PostAnalysisFilterType(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterType) LookAndFeelUtil(org.cytoscape.util.swing.LookAndFeelUtil) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) Optional(java.util.Optional) Collections(java.util.Collections) JPanel(javax.swing.JPanel) JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) DecimalFormat(java.text.DecimalFormat) JFormattedTextField(javax.swing.JFormattedTextField) GroupLayout(javax.swing.GroupLayout)

Example 3 with PREFERRED_SIZE

use of javax.swing.GroupLayout.PREFERRED_SIZE in project EnrichmentMapApp by BaderLab.

the class CutoffPropertiesPanel method createFilterEdgesPanel.

private JPanel createFilterEdgesPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Similarity Filtering (Edges)"));
    JLabel cutoffLabel = new JLabel("Cutoff:");
    JLabel metricLabel = new JLabel("Metric:");
    SwingUtil.makeSmall(cutoffLabel, metricLabel);
    SimilarityMetric defaultMetric = propertyManager.getDefaultSimilarityMetric();
    double defaultCutoff = propertyManager.getDefaultCutOff(defaultMetric);
    similarityCutoffText = new JFormattedTextField(getFormatterFactory(false));
    similarityCutoffText.setValue(defaultCutoff);
    cutoffMetricCombo = new JComboBox<>();
    cutoffMetricCombo.addItem(new ComboItem<>(SimilarityMetric.JACCARD, "Jaccard"));
    cutoffMetricCombo.addItem(new ComboItem<>(SimilarityMetric.OVERLAP, "Overlap"));
    cutoffMetricCombo.addItem(new ComboItem<>(SimilarityMetric.COMBINED, "Jaccard+Overlap Combined"));
    SwingUtil.makeSmall(similarityCutoffText, cutoffMetricCombo);
    ActionListener sliderUpdate = e -> {
        SimilarityMetric type = getSimilarityMetric();
        similarityCutoffText.setValue(cutoffValues.get(type));
        combinedConstantSlider.setVisible(type == SimilarityMetric.COMBINED);
    };
    double combinedConstant = propertyManager.getDefaultCombinedConstant();
    int tick = (int) (combinedConstant * 100.0);
    combinedConstantSlider = new CombinedConstantSlider(tick);
    combinedConstantSlider.setOpaque(false);
    // default
    cutoffMetricCombo.setSelectedItem(ComboItem.of(defaultMetric));
    cutoffMetricCombo.addActionListener(sliderUpdate);
    similarityCutoffText.addPropertyChangeListener("value", e -> {
        double value = ((Number) e.getNewValue()).doubleValue();
        cutoffValues.put(getSimilarityMetric(), value);
    });
    sliderUpdate.actionPerformed(null);
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup().addComponent(cutoffLabel).addComponent(metricLabel)).addGroup(layout.createParallelGroup().addComponent(similarityCutoffText, PREFERRED_SIZE, 100, PREFERRED_SIZE).addComponent(cutoffMetricCombo, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE).addComponent(combinedConstantSlider, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)).addGap(0, 0, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(cutoffLabel).addComponent(similarityCutoffText)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(metricLabel).addComponent(cutoffMetricCombo)).addComponent(combinedConstantSlider, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : ActionListener(java.awt.event.ActionListener) Inject(com.google.inject.Inject) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection) NumberFormat(java.text.NumberFormat) SimilarityMetric(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric) NESFilter(org.baderlab.csplugins.enrichmentmap.model.EnrichmentResultFilterParams.NESFilter) ComboItem(org.baderlab.csplugins.enrichmentmap.view.util.ComboItem) InternationalFormatter(javax.swing.text.InternationalFormatter) Map(java.util.Map) JComboBox(javax.swing.JComboBox) AbstractFormatterFactory(javax.swing.JFormattedTextField.AbstractFormatterFactory) JFormattedTextField(javax.swing.JFormattedTextField) EnumMap(java.util.EnumMap) DecimalFormat(java.text.DecimalFormat) PREFERRED_SIZE(javax.swing.GroupLayout.PREFERRED_SIZE) Alignment(javax.swing.GroupLayout.Alignment) LookAndFeelUtil(org.cytoscape.util.swing.LookAndFeelUtil) JLabel(javax.swing.JLabel) SwingUtil(org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil) GroupLayout(javax.swing.GroupLayout) JCheckBox(javax.swing.JCheckBox) AbstractFormatter(javax.swing.JFormattedTextField.AbstractFormatter) Optional(java.util.Optional) PropertyManager(org.baderlab.csplugins.enrichmentmap.PropertyManager) JPanel(javax.swing.JPanel) JPanel(javax.swing.JPanel) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) SimilarityMetric(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric) ActionListener(java.awt.event.ActionListener) GroupLayout(javax.swing.GroupLayout)

Aggregations

ActionListener (java.awt.event.ActionListener)3 Map (java.util.Map)3 Optional (java.util.Optional)3 GroupLayout (javax.swing.GroupLayout)3 Alignment (javax.swing.GroupLayout.Alignment)3 PREFERRED_SIZE (javax.swing.GroupLayout.PREFERRED_SIZE)3 JComboBox (javax.swing.JComboBox)3 JLabel (javax.swing.JLabel)3 JPanel (javax.swing.JPanel)3 LookAndFeelUtil (org.cytoscape.util.swing.LookAndFeelUtil)3 Inject (com.google.inject.Inject)2 DecimalFormat (java.text.DecimalFormat)2 Arrays (java.util.Arrays)2 List (java.util.List)2 DEFAULT_SIZE (javax.swing.GroupLayout.DEFAULT_SIZE)2 JCheckBox (javax.swing.JCheckBox)2 JFormattedTextField (javax.swing.JFormattedTextField)2 EMDataSet (org.baderlab.csplugins.enrichmentmap.model.EMDataSet)2 EnrichmentMap (org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap)2 IconManager (org.cytoscape.util.swing.IconManager)2