Search in sources :

Example 6 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.

the class MemberChooser method createSouthPanel.

@Override
protected JComponent createSouthPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    customizeOptionsPanel();
    JPanel optionsPanel = new JPanel(new VerticalFlowLayout());
    for (final JComponent component : myOptionControls) {
        optionsPanel.add(component);
    }
    panel.add(optionsPanel, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
    if (!myAllowEmptySelection && (myElements == null || myElements.length == 0)) {
        setOKActionEnabled(false);
    }
    panel.add(super.createSouthPanel(), new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.SOUTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    return panel;
}
Also used : VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 7 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.

the class ChangeSignatureDialogBase method createOptionsPanel.

protected JComponent createOptionsPanel() {
    final JPanel panel = new JPanel(new BorderLayout());
    if (myAllowDelegation) {
        myDelegationPanel = createDelegationPanel();
        panel.add(myDelegationPanel, BorderLayout.WEST);
    }
    myPropagateParamChangesButton = new AnActionButton(RefactoringBundle.message("changeSignature.propagate.parameters.title"), null, AllIcons.Hierarchy.Caller) {

        @Override
        public void actionPerformed(AnActionEvent e) {
            final Ref<CallerChooserBase<Method>> chooser = new Ref<>();
            Consumer<Set<Method>> callback = callers -> {
                myMethodsToPropagateParameters = callers;
                myParameterPropagationTreeToReuse = chooser.get().getTree();
            };
            try {
                String message = RefactoringBundle.message("changeSignature.parameter.caller.chooser");
                chooser.set(createCallerChooser(message, myParameterPropagationTreeToReuse, callback));
            } catch (ProcessCanceledException ex) {
                // user cancelled initial callers search, don't show dialog
                return;
            }
            chooser.get().show();
        }
    };
    final JPanel result = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP));
    result.add(panel);
    return result;
}
Also used : Ref(com.intellij.openapi.util.Ref) Consumer(com.intellij.util.Consumer) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 8 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.

the class MoveInstanceMethodDialog method createParametersPanel.

@Nullable
private JPanel createParametersPanel() {
    myThisClassesMap = MoveInstanceMembersUtil.getThisClassesToMembers(myMethod);
    myOldClassParameterNameFields = new HashMap<>();
    if (myThisClassesMap.size() == 0)
        return null;
    JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, true));
    for (PsiClass aClass : myThisClassesMap.keySet()) {
        final String text = RefactoringBundle.message("move.method.this.parameter.label", ObjectUtils.notNull(aClass.getName(), ""));
        panel.add(new TitledSeparator(text, null));
        String suggestedName = MoveInstanceMethodHandler.suggestParameterNameForThisClass(aClass);
        final EditorTextField field = new EditorTextField(suggestedName, getProject(), StdFileTypes.JAVA);
        field.setMinimumSize(new Dimension(field.getPreferredSize()));
        myOldClassParameterNameFields.put(aClass, field);
        panel.add(field);
    }
    panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    return panel;
}
Also used : TitledSeparator(com.intellij.ui.TitledSeparator) EditorTextField(com.intellij.ui.EditorTextField) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) Nullable(org.jetbrains.annotations.Nullable)

Example 9 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project intellij-community by JetBrains.

the class EntryPointsManagerImpl method configureAnnotations.

@Override
public void configureAnnotations() {
    final List<String> list = new ArrayList<>(ADDITIONAL_ANNOTATIONS);
    final List<String> writeList = new ArrayList<>(myWriteAnnotations);
    final JPanel listPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(list, "Mark as entry point if annotated by", true);
    Condition<PsiClass> applicableToField = psiClass -> {
        Set<PsiAnnotation.TargetType> annotationTargets = AnnotationTargetUtil.getAnnotationTargets(psiClass);
        return annotationTargets != null && annotationTargets.contains(PsiAnnotation.TargetType.FIELD);
    };
    final JPanel writtenAnnotationsPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(writeList, "Mark field as implicitly written if annotated by", false, applicableToField);
    new DialogWrapper(myProject) {

        {
            init();
            setTitle("Configure Annotations");
        }

        @Override
        protected JComponent createCenterPanel() {
            final JPanel panel = new JPanel(new VerticalFlowLayout());
            panel.add(listPanel);
            panel.add(writtenAnnotationsPanel);
            return panel;
        }

        @Override
        protected void doOKAction() {
            ADDITIONAL_ANNOTATIONS.clear();
            ADDITIONAL_ANNOTATIONS.addAll(list);
            myWriteAnnotations.clear();
            myWriteAnnotations.addAll(writeList);
            DaemonCodeAnalyzer.getInstance(myProject).restart();
            super.doOKAction();
        }
    }.show();
}
Also used : SpecialAnnotationsUtil(com.intellij.codeInspection.util.SpecialAnnotationsUtil) ActionListener(java.awt.event.ActionListener) PersistentStateComponent(com.intellij.openapi.components.PersistentStateComponent) Set(java.util.Set) DaemonCodeAnalyzer(com.intellij.codeInsight.daemon.DaemonCodeAnalyzer) ProjectUtil(com.intellij.openapi.project.ProjectUtil) ActionEvent(java.awt.event.ActionEvent) AnnotationTargetUtil(com.intellij.codeInsight.AnnotationTargetUtil) ArrayList(java.util.ArrayList) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) Nullable(org.jetbrains.annotations.Nullable) PsiClass(com.intellij.psi.PsiClass) List(java.util.List) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) State(com.intellij.openapi.components.State) PsiAnnotation(com.intellij.psi.PsiAnnotation) Project(com.intellij.openapi.project.Project) Messages(com.intellij.openapi.ui.Messages) Element(org.jdom.Element) LinkedHashSet(java.util.LinkedHashSet) Condition(com.intellij.openapi.util.Condition) javax.swing(javax.swing) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) ArrayList(java.util.ArrayList) PsiClass(com.intellij.psi.PsiClass) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) PsiAnnotation(com.intellij.psi.PsiAnnotation) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 10 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project android by JetBrains.

the class PreviewIconsPanel method initializeIconComponents.

private void initializeIconComponents(@NotNull Collection<Density> densities) {
    // Sort the densities, so that we always line up icons from highest to lowest densities.
    Ordering<Density> densityOrdering = new Ordering<Density>() {

        @Override
        public int compare(Density left, Density right) {
            // The lower the enum index, the higher the density
            return Ints.compare(left.ordinal(), right.ordinal());
        }
    };
    densities = densityOrdering.immutableSortedCopy(densities);
    for (Density density : densities) {
        JPanel iconPanel = new JPanel(new VerticalFlowLayout(false, false));
        iconPanel.setBackground(myTheme.getMainColor());
        iconPanel.setOpaque(myTheme != Theme.TRANSPARENT);
        JBLabel title = new JBLabel(density.getResourceValue());
        title.setForeground(myTheme.getAltColor());
        iconPanel.add(title);
        ImageComponent iconImage = new ImageComponent(null);
        iconImage.setBorder(new LineBorder(myTheme.getAltColor()));
        iconImage.setOpaque(false);
        iconPanel.add(iconImage);
        GridBagConstraints c = new GridBagConstraints();
        c.anchor = GridBagConstraints.PAGE_START;
        myIconsPanel.add(iconPanel, c);
        myIconImages.put(density, iconImage);
    }
}
Also used : ImageComponent(com.android.tools.idea.ui.ImageComponent) JBLabel(com.intellij.ui.components.JBLabel) LineBorder(javax.swing.border.LineBorder) Ordering(com.google.common.collect.Ordering) Density(com.android.resources.Density) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Aggregations

VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)34 Nullable (org.jetbrains.annotations.Nullable)8 JBLabel (com.intellij.ui.components.JBLabel)7 NotNull (org.jetbrains.annotations.NotNull)6 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4 EditorTextField (com.intellij.ui.EditorTextField)3 TitledSeparator (com.intellij.ui.TitledSeparator)3 JBList (com.intellij.ui.components.JBList)3 JBScrollPane (com.intellij.ui.components.JBScrollPane)3 FormBuilder (com.intellij.util.ui.FormBuilder)3 ArrayList (java.util.ArrayList)3 Document (com.intellij.openapi.editor.Document)2 ComboBox (com.intellij.openapi.ui.ComboBox)2 JBPanel (com.intellij.ui.components.JBPanel)2 JCheckBox (javax.swing.JCheckBox)2 JPanel (javax.swing.JPanel)2 Density (com.android.resources.Density)1 LegendComponent (com.android.tools.adtui.LegendComponent)1 ImageComponent (com.android.tools.idea.ui.ImageComponent)1