Search in sources :

Example 1 with JBCardLayout

use of com.intellij.ui.JBCardLayout in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoSdkConfigurable method createUIComponents.

private void createUIComponents() {
    myVersionLabel = new JBLabel();
    myDefaultLabelColor = myVersionLabel.getForeground();
    myVersionPanel = new JPanel(new JBCardLayout());
    JPanel gettingVersionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
    AsyncProcessIcon gettingVersionIcon = new AsyncProcessIcon("Getting Go version");
    gettingVersionPanel.add(gettingVersionIcon);
    gettingVersionPanel.add(new JLabel("Getting..."));
    myVersionPanel.add(gettingVersionPanel, VERSION_GETTING);
    myVersionPanel.add(myVersionLabel, VERSION_RESULT);
    setVersion(null);
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) AsyncProcessIcon(com.intellij.util.ui.AsyncProcessIcon) JBCardLayout(com.intellij.ui.JBCardLayout)

Example 2 with JBCardLayout

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

the class AbstractWizard method initWizard.

private void initWizard(final String title) {
    setTitle(title);
    myCurrentStep = 0;
    myPreviousButton = new JButton(IdeBundle.message("button.wizard.previous"));
    myNextButton = new JButton(IdeBundle.message("button.wizard.next"));
    myCancelButton = new JButton(CommonBundle.getCancelButtonText());
    myHelpButton = new JButton(CommonBundle.getHelpButtonText());
    myContentPanel = new JPanel(new JBCardLayout());
    myIcon = new TallImageComponent(null);
    JRootPane rootPane = getRootPane();
    if (rootPane != null) {
        // it will be null in headless mode, i.e. tests
        rootPane.registerKeyboardAction(new ActionListener() {

            public void actionPerformed(final ActionEvent e) {
                helpAction();
            }
        }, KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
        rootPane.registerKeyboardAction(new ActionListener() {

            public void actionPerformed(final ActionEvent e) {
                helpAction();
            }
        }, KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    }
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JBCardLayout(com.intellij.ui.JBCardLayout)

Example 3 with JBCardLayout

use of com.intellij.ui.JBCardLayout in project android by JetBrains.

the class ActivityGalleryStep method createGallery.

private JComponent createGallery() {
    myGallery = new ASGallery<>();
    Dimension thumbnailSize = DEFAULT_GALLERY_THUMBNAIL_SIZE;
    myGallery.setThumbnailSize(thumbnailSize);
    myGallery.setMinimumSize(new Dimension(thumbnailSize.width * 2 + 1, thumbnailSize.height));
    myGallery.setLabelProvider(new Function<Optional<TemplateEntry>, String>() {

        @Override
        public String apply(Optional<TemplateEntry> template) {
            if (template.isPresent()) {
                return template.get().getTitle();
            } else {
                return "Add No Activity";
            }
        }
    });
    myGallery.setDefaultAction(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DynamicWizard wizard = getWizard();
            assert wizard != null;
            wizard.doNextAction();
        }
    });
    myGallery.setImageProvider(new Function<Optional<TemplateEntry>, Image>() {

        @Override
        public Image apply(Optional<TemplateEntry> input) {
            return input.isPresent() ? input.get().getImage() : null;
        }
    });
    myGallery.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            saveState(myGallery);
        }
    });
    myGallery.setName("Templates Gallery");
    AccessibleContext accessibleContext = myGallery.getAccessibleContext();
    if (accessibleContext != null) {
        accessibleContext.setAccessibleDescription(getStepTitle());
    }
    JPanel panel = new JPanel(new JBCardLayout());
    panel.add("only card", new JBScrollPane(myGallery));
    return panel;
}
Also used : Optional(java.util.Optional) AccessibleContext(javax.accessibility.AccessibleContext) ActionEvent(java.awt.event.ActionEvent) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener) DynamicWizard(com.android.tools.idea.wizard.dynamic.DynamicWizard) JBCardLayout(com.intellij.ui.JBCardLayout) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 4 with JBCardLayout

use of com.intellij.ui.JBCardLayout in project android by JetBrains.

the class NlPropertiesPanel method setAllPropertiesPanelVisible.

@Override
public void setAllPropertiesPanelVisible(boolean viewAllProperties) {
    myAllPropertiesPanelVisible = viewAllProperties;
    JBCardLayout cardLayout = (JBCardLayout) myCardPanel.getLayout();
    String name = viewAllProperties ? CARD_ADVANCED : CARD_DEFAULT;
    Component next = viewAllProperties ? myTable : myInspectorPanel;
    cardLayout.swipe(myCardPanel, name, JBCardLayout.SwipeDirection.AUTO, next::requestFocus);
}
Also used : JBCardLayout(com.intellij.ui.JBCardLayout) NlComponent(com.android.tools.idea.uibuilder.model.NlComponent)

Example 5 with JBCardLayout

use of com.intellij.ui.JBCardLayout in project android by JetBrains.

the class ChooseModuleTypeStep method createGallery.

private JPanel createGallery() {
    Dimension thumbnailSize = DEFAULT_GALLERY_THUMBNAIL_SIZE;
    myFormFactorGallery = new ASGallery<ModuleTemplate>(JBList.createDefaultListModel(), new Function<ModuleTemplate, Image>() {

        @Override
        public Image apply(ModuleTemplate input) {
            return IconUtil.toImage(input.getIcon());
        }
    }, new Function<ModuleTemplate, String>() {

        @Override
        public String apply(@Nullable ModuleTemplate input) {
            return input == null ? "<none>" : input.getName();
        }
    }, thumbnailSize, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DynamicWizard wizard = getWizard();
            assert wizard != null;
            getWizard().doNextAction();
        }
    }) {

        @Override
        public Dimension getPreferredScrollableViewportSize() {
            Dimension preferred = getPreferredSize();
            int heightInsets = getInsets().top + getInsets().bottom;
            // Don't want to show an exact number of rows, since then it's not obvious there's another row available.
            return new Dimension(preferred.width, (int) (computeCellSize().height * 2.2) + heightInsets);
        }
    };
    myFormFactorGallery.setMinimumSize(new Dimension(thumbnailSize.width * 2 + 1, thumbnailSize.height));
    myFormFactorGallery.setBorder(BorderFactory.createLineBorder(JBColor.border()));
    AccessibleContext accessibleContext = myFormFactorGallery.getAccessibleContext();
    if (accessibleContext != null) {
        accessibleContext.setAccessibleDescription(getStepTitle());
    }
    JPanel panel = new JPanel(new JBCardLayout());
    panel.add("only card", new JBScrollPane(myFormFactorGallery));
    return panel;
}
Also used : AccessibleContext(javax.accessibility.AccessibleContext) ModuleTemplate(com.android.tools.idea.npw.ModuleTemplate) ActionEvent(java.awt.event.ActionEvent) Function(com.google.common.base.Function) DynamicWizard(com.android.tools.idea.wizard.dynamic.DynamicWizard) JBCardLayout(com.intellij.ui.JBCardLayout) Nullable(org.jetbrains.annotations.Nullable) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Aggregations

JBCardLayout (com.intellij.ui.JBCardLayout)5 ActionEvent (java.awt.event.ActionEvent)3 DynamicWizard (com.android.tools.idea.wizard.dynamic.DynamicWizard)2 JBScrollPane (com.intellij.ui.components.JBScrollPane)2 AccessibleContext (javax.accessibility.AccessibleContext)2 ModuleTemplate (com.android.tools.idea.npw.ModuleTemplate)1 NlComponent (com.android.tools.idea.uibuilder.model.NlComponent)1 Function (com.google.common.base.Function)1 JBLabel (com.intellij.ui.components.JBLabel)1 AsyncProcessIcon (com.intellij.util.ui.AsyncProcessIcon)1 ActionListener (java.awt.event.ActionListener)1 Optional (java.util.Optional)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1 Nullable (org.jetbrains.annotations.Nullable)1