/* * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * @author max */ package com.intellij.openapi.wm.impl.welcomeScreen; import com.intellij.icons.AllIcons; import com.intellij.ide.DataManager; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.impl.ActionButtonWithText; import com.intellij.openapi.actionSystem.impl.PresentationFactory; import com.intellij.openapi.ui.GraphicsConfig; import com.intellij.openapi.util.IconLoader; import com.intellij.ui.JBCardLayout; import com.intellij.ui.LightColors; import com.intellij.util.ui.CenteredIcon; import com.intellij.util.ui.GraphicsUtil; import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.util.ArrayList; import java.util.List; public class CardActionsPanel extends JPanel { private final boolean USE_ICONS = true; private final JBCardLayout myLayout = new JBCardLayout(); private final JPanel myContent = new JPanel(myLayout); private int nCards = 0; public CardActionsPanel(ActionGroup rootGroup) { setLayout(new GridLayout(1, 1)); add(myContent); createCardForGroup(rootGroup, "root", null); } private void createCardForGroup(ActionGroup group, String cardId, final String parentId) { JPanel card = new JPanel(new BorderLayout()); if (!USE_ICONS) { card.setOpaque(false); } JPanel withBottomFiller = new JPanel(new BorderLayout()); if (!USE_ICONS) { withBottomFiller.setOpaque(true); withBottomFiller.setBackground(Color.white); } withBottomFiller.add(card, BorderLayout.NORTH); myContent.add(withBottomFiller, cardId); List