Java 类com.intellij.ui.components.panels.Wrapper 实例源码

项目:intellij-ce-playground    文件:DiffPanelBase.java   
public DiffPanelBase(@Nullable Project project,
                     @NotNull DataProvider provider,
                     @NotNull DiffContext context) {
  super(new BorderLayout());
  myProject = project;
  myDataProvider = provider;
  myContext = context;

  myCardLayout = new CardLayout();
  myContentPanel = new JPanel(myCardLayout);

  myNotificationsPanel = new JPanel();
  myNotificationsPanel.setLayout(new BoxLayout(myNotificationsPanel, BoxLayout.Y_AXIS));

  myNorthPanel = new Wrapper();
  mySouthPanel = new Wrapper();

  add(myContentPanel, BorderLayout.CENTER);
  add(myNorthPanel, BorderLayout.NORTH);
  add(mySouthPanel, BorderLayout.SOUTH);
}
项目:intellij-ce-playground    文件:BalloonImpl.java   
private MyComponent(JComponent content, BalloonImpl balloon, EmptyBorder shapeBorder) {
  setOpaque(false);
  setLayout(null);
  myBalloon = balloon;

  setFocusCycleRoot(true);
  putClientProperty(Balloon.KEY, BalloonImpl.this);

  myContent = new JPanel(new BorderLayout(2, 2));
  Wrapper contentWrapper = new Wrapper(content);
  if (myTitle != null) {
    myTitleLabel = new JLabel(myTitle, SwingConstants.CENTER);
    myTitleLabel.setForeground(UIManager.getColor("List.background"));
    myTitleLabel.setBorder(new EmptyBorder(0, 4, 0, 4));
    myContent.add(myTitleLabel, BorderLayout.NORTH);
    contentWrapper.setBorder(new EmptyBorder(1, 1, 1, 1));
  }
  myContent.add(contentWrapper, BorderLayout.CENTER);
  myContent.setBorder(shapeBorder);
  myContent.setOpaque(false);

  add(myContent);


}
项目:intellij-ce-playground    文件:ContentManagerImpl.java   
@NotNull
@Override
public JComponent getComponent() {
  if (myComponent == null) {
    myComponent = new MyNonOpaquePanel();

    myFocusProxy = new Wrapper.FocusHolder();
    myFocusProxy.setOpaque(false);
    myFocusProxy.setPreferredSize(JBUI.emptySize());

    MyContentComponent contentComponent = new MyContentComponent();
    contentComponent.setContent(myUI.getComponent());
    contentComponent.setFocusCycleRoot(true);

    myComponent.add(myFocusProxy, BorderLayout.NORTH);
    myComponent.add(contentComponent, BorderLayout.CENTER);
  }
  return myComponent;
}
项目:intellij-ce-playground    文件:IdeTooltipManager.java   
private void queueShow(final JComponent c, final MouseEvent me, final boolean toCenter, int shift, int posChangeX, int posChangeY) {
  String aText = String.valueOf(c.getToolTipText(me));
  final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null, /*new Object()*/c, aText) {
    @Override
    protected boolean beforeShow() {
      myCurrentEvent = me;

      if (!c.isShowing()) return false;

      String text = c.getToolTipText(myCurrentEvent);
      if (text == null || text.trim().isEmpty()) return false;

      JLayeredPane layeredPane = IJSwingUtilities.findParentOfType(c, JLayeredPane.class);

      final JEditorPane pane = initPane(text, new HintHint(me).setAwtTooltip(true), layeredPane);
      final Wrapper wrapper = new Wrapper(pane);
      setTipComponent(wrapper);
      return true;
    }
  }.setToCenter(toCenter).setCalloutShift(shift).setPositionChangeShift(posChangeX, posChangeY).setLayer(Balloon.Layer.top);

  show(tooltip, false);
}
项目:intellij-ce-playground    文件:VcsCommitInfoBalloon.java   
public VcsCommitInfoBalloon(@NotNull JTree tree) {
  myTree = tree;
  myEditorPane = new JEditorPane(UIUtil.HTML_MIME, "");
  myEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
  myEditorPane.setEditable(false);
  myEditorPane.setBackground(HintUtil.INFORMATION_COLOR);
  myEditorPane.setFont(UIUtil.getToolTipFont());
  myEditorPane.setBorder(HintUtil.createHintBorder());
  Border margin = IdeBorderFactory.createEmptyBorder(3, 3, 3, 3);
  myEditorPane.setBorder(new CompoundBorder(myEditorPane.getBorder(), margin));
  myEditorPane.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      BrowserUtil.browse(e.getURL());
    }
  });
  myWrapper = new Wrapper(myEditorPane);
  myPopupBuilder = JBPopupFactory.getInstance().createComponentPopupBuilder(myWrapper, null);
  myPopupBuilder.setCancelOnClickOutside(true).setResizable(true).setMovable(true).setRequestFocus(false)
    .setMinSize(new Dimension(80, 30));
}
项目:intellij-ce-playground    文件:RunnerContentUi.java   
@Override
public List<SwitchTarget> getTargets(boolean onlyVisible, boolean originalProvider) {
  List<SwitchTarget> result = new ArrayList<SwitchTarget>();

  result.addAll(myTabs.getTargets(true, false));
  GridImpl grid = getSelectedGrid();
  if (grid != null) {
    result.addAll(grid.getTargets(onlyVisible));
  }

  for (Wrapper wrapper : myMinimizedButtonsPlaceholder.values()) {
    if (!wrapper.isShowing()) continue;
    JComponent target = wrapper.getTargetComponent();
    if (target instanceof ActionToolbar) {
      ActionToolbar tb = (ActionToolbar)target;
      result.addAll(tb.getTargets(onlyVisible, false));
    }
  }

  return result;
}
项目:tools-idea    文件:BalloonImpl.java   
private MyComponent(JComponent content, BalloonImpl balloon, EmptyBorder shapeBorder) {
  setOpaque(false);
  setLayout(null);
  myBalloon = balloon;

  setFocusCycleRoot(true);
  putClientProperty(Balloon.KEY, BalloonImpl.this);

  myContent = new JPanel(new BorderLayout(2, 2));
  Wrapper contentWrapper = new Wrapper(content);
  if (myTitle != null) {
    myTitleLabel = new JLabel(myTitle, CENTER);
    myTitleLabel.setForeground(UIManager.getColor("List.background"));
    myTitleLabel.setBorder(new EmptyBorder(0, 4, 0, 4));
    myContent.add(myTitleLabel, BorderLayout.NORTH);
    contentWrapper.setBorder(new EmptyBorder(1, 1, 1, 1));
  }
  myContent.add(contentWrapper, BorderLayout.CENTER);
  myContent.setBorder(shapeBorder);
  myContent.setOpaque(false);

  add(myContent);


}
项目:tools-idea    文件:IdeTooltipManager.java   
private void queueShow(final JComponent c, final MouseEvent me, final boolean toCenter, int shift, int posChangeX, int posChangeY) {
  final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null, new Object()) {
    @Override
    protected boolean beforeShow() {
      myCurrentEvent = me;

      if (!c.isShowing()) return false;

      String text = c.getToolTipText(myCurrentEvent);
      if (text == null || text.trim().isEmpty()) return false;

      JLayeredPane layeredPane = IJSwingUtilities.findParentOfType(c, JLayeredPane.class);

      final JEditorPane pane = initPane(text, new HintHint(me).setAwtTooltip(true), layeredPane);
      final Wrapper wrapper = new Wrapper(pane);
      setTipComponent(wrapper);
      return true;
    }
  }.setToCenter(toCenter).setCalloutShift(shift).setPositionChangeShift(posChangeX, posChangeY).setLayer(Balloon.Layer.top);

  show(tooltip, false);
}
项目:tools-idea    文件:RunnerContentUi.java   
@Override
public List<SwitchTarget> getTargets(boolean onlyVisible, boolean originalProvider) {
  List<SwitchTarget> result = new ArrayList<SwitchTarget>();

  result.addAll(myTabs.getTargets(true, false));
  GridImpl grid = getSelectedGrid();
  if (grid != null) {
    result.addAll(grid.getTargets(onlyVisible));
  }

  for (Wrapper wrapper : myMinimizedButtonsPlaceholder.values()) {
    if (!wrapper.isShowing()) continue;
    JComponent target = wrapper.getTargetComponent();
    if (target instanceof ActionToolbar) {
      ActionToolbar tb = (ActionToolbar)target;
      result.addAll(tb.getTargets(onlyVisible, false));
    }
  }

  return result;
}
项目:PerfCakeIDEA-deprecated    文件:ColorComponents.java   
/**
 * Apply current colors to all open Scenario Editors
 */
private static void applyColors() {
    Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
    for (Project p : openProjects) {
        FileEditor[] allEditors = FileEditorManager.getInstance(p).getAllEditors();
        for (FileEditor e : allEditors) {
            //all scenario editors are wrapped by Intellij
            if (e.getName().equals("Designer") && e.getComponent() instanceof Wrapper) {
                JComponent targetComponent = ((Wrapper) e.getComponent()).getTargetComponent();
                if (targetComponent instanceof EditorPanel) {
                    ScenarioPanel scenarioPanel = ((EditorPanel) targetComponent).getScenarioPanel();
                    updateColorAdjustableTree(new Component[]{scenarioPanel});
                }
            }
        }
    }
}
项目:consulo    文件:DiffPanelBase.java   
public DiffPanelBase(@Nullable Project project,
                     @Nonnull DataProvider provider,
                     @Nonnull DiffContext context) {
  super(new BorderLayout());
  myProject = project;
  myDataProvider = provider;
  myContext = context;

  myCardLayout = new CardLayout();
  myContentPanel = new JPanel(myCardLayout);

  myNotificationsPanel = new JPanel();
  myNotificationsPanel.setLayout(new BoxLayout(myNotificationsPanel, BoxLayout.Y_AXIS));

  myNorthPanel = new Wrapper();
  mySouthPanel = new Wrapper();

  add(myContentPanel, BorderLayout.CENTER);
  add(myNorthPanel, BorderLayout.NORTH);
  add(mySouthPanel, BorderLayout.SOUTH);
}
项目:consulo    文件:IdeTooltipManager.java   
private void queueShow(final JComponent c, final MouseEvent me, final boolean toCenter, int shift, int posChangeX, int posChangeY) {
  String aText = String.valueOf(c.getToolTipText(me));
  final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null, /*new Object()*/c, aText) {
    @Override
    protected boolean beforeShow() {
      myCurrentEvent = me;

      if (!c.isShowing()) return false;

      String text = c.getToolTipText(myCurrentEvent);
      if (text == null || text.trim().isEmpty()) return false;

      JLayeredPane layeredPane = IJSwingUtilities.findParentOfType(c, JLayeredPane.class);

      final JEditorPane pane = initPane(text, new HintHint(me).setAwtTooltip(true), layeredPane);
      final Wrapper wrapper = new Wrapper(pane);
      setTipComponent(wrapper);
      return true;
    }
  }.setToCenter(toCenter).setCalloutShift(shift).setPositionChangeShift(posChangeX, posChangeY).setLayer(Balloon.Layer.top);

  show(tooltip, false);
}
项目:consulo    文件:VcsCommitInfoBalloon.java   
public VcsCommitInfoBalloon(@Nonnull JTree tree) {
  myTree = tree;
  myEditorPane = new JEditorPane(UIUtil.HTML_MIME, "");
  myEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
  myEditorPane.setEditable(false);
  myEditorPane.setBackground(HintUtil.INFORMATION_COLOR);
  myEditorPane.setFont(UIUtil.getToolTipFont());
  myEditorPane.setBorder(HintUtil.createHintBorder());
  Border margin = IdeBorderFactory.createEmptyBorder(3, 3, 3, 3);
  myEditorPane.setBorder(new CompoundBorder(myEditorPane.getBorder(), margin));
  myEditorPane.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      BrowserUtil.browse(e.getURL());
    }
  });
  myWrapper = new Wrapper(myEditorPane);
  myPopupBuilder = JBPopupFactory.getInstance().createComponentPopupBuilder(myWrapper, null);
  myPopupBuilder.setCancelOnClickOutside(true).setResizable(true).setMovable(true).setRequestFocus(false)
          .setMinSize(new Dimension(80, 30));
}
项目:consulo    文件:RunnerContentUi.java   
@Override
public List<SwitchTarget> getTargets(boolean onlyVisible, boolean originalProvider) {
  List<SwitchTarget> result = new ArrayList<>();

  result.addAll(myTabs.getTargets(true, false));
  GridImpl grid = getSelectedGrid();
  if (grid != null) {
    result.addAll(grid.getTargets(onlyVisible));
  }

  for (Wrapper wrapper : myMinimizedButtonsPlaceholder.values()) {
    if (!wrapper.isShowing()) continue;
    JComponent target = wrapper.getTargetComponent();
    if (target instanceof ActionToolbar) {
      ActionToolbar tb = (ActionToolbar)target;
      result.addAll(tb.getTargets(onlyVisible, false));
    }
  }

  return result;
}
项目:intellij-ce-playground    文件:MergeRequestProcessor.java   
public MergeRequestProcessor(@Nullable Project project, @NotNull MergeRequest request) {
  myProject = project;
  myRequest = request;

  myContext = new MyDiffContext();
  myContext.putUserData(DiffUserDataKeys.PLACE, DiffPlaces.MERGE);

  myAvailableTools = DiffManagerEx.getInstance().getMergeTools();

  myMainPanel = new MyPanel();
  myContentPanel = new Wrapper();
  myToolbarPanel = new Wrapper();
  myToolbarPanel.setFocusable(true);
  myToolbarStatusPanel = new Wrapper();

  myPanel = JBUI.Panels.simplePanel(myMainPanel);

  JPanel topPanel = JBUI.Panels.simplePanel(myToolbarPanel).addToRight(myToolbarStatusPanel);

  myMainPanel.add(topPanel, BorderLayout.NORTH);
  myMainPanel.add(myContentPanel, BorderLayout.CENTER);

  myMainPanel.setFocusTraversalPolicyProvider(true);
  myMainPanel.setFocusTraversalPolicy(new MyFocusTraversalPolicy());

  MergeTool.MergeViewer viewer;
  try {
    viewer = getFittedTool().createComponent(myContext, myRequest);
  }
  catch (Throwable e) {
    LOG.error(e);
    viewer = ErrorMergeTool.INSTANCE.createComponent(myContext, myRequest);
  }

  myViewer = viewer;
  updateBottomActions();
}
项目:intellij-ce-playground    文件:InfoAndProgressPanel.java   
private void buildInProcessCount() {
  removeAll();
  setLayout(new BorderLayout());

  final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0));
  progressCountPanel.setOpaque(false);
  String processWord = myOriginals.size() == 1 ? " process" : " processes";
  final LinkLabel label = new LinkLabel(myOriginals.size() + processWord + " running...", null, new LinkListener() {
    @Override
    public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
      triggerPopupShowing();
    }
  });

  if (SystemInfo.isMac) label.setFont(JBUI.Fonts.label(11));

  label.setOpaque(false);

  final Wrapper labelComp = new Wrapper(label);
  labelComp.setOpaque(false);
  progressCountPanel.add(labelComp, BorderLayout.CENTER);

  //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder());
  progressCountPanel.add(myProgressIcon, BorderLayout.WEST);

  add(myRefreshAndInfoPanel, BorderLayout.CENTER);

  progressCountPanel.setBorder(JBUI.Borders.emptyRight(4));
  add(progressCountPanel, BorderLayout.EAST);

  revalidate();
  repaint();
}
项目:intellij-ce-playground    文件:RunnerContentUi.java   
private boolean rebuildMinimizedActions() {
  for (Map.Entry<GridImpl, Wrapper> entry : myMinimizedButtonsPlaceholder.entrySet()) {
    Wrapper eachPlaceholder = entry.getValue();
    ActionToolbar tb = myActionManager.createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, myMinimizedViewActions, true);
    tb.getComponent().setBorder(null);
    tb.setReservePlaceAutoPopupIcon(false);
    JComponent minimized = tb.getComponent();
    eachPlaceholder.setContent(minimized);
  }

  myTabs.getComponent().revalidate();
  myTabs.getComponent().repaint();

  return myMinimizedViewActions.getChildrenCount() > 0;
}
项目:intellij-ce-playground    文件:ProjectProfileSelectionDialog.java   
private static void removeEmptyBorder(@NotNull DetailsComponent details) {
  JComponent gutter = details.getContentGutter();
  for (Component child : gutter.getComponents()) {
    if (child instanceof Wrapper) {
      ((Wrapper)child).setBorder(null);
    }
  }
}
项目:intellij-ce-playground    文件:SvnDiffViewer.java   
public SvnDiffViewer(@NotNull DiffContext context, @NotNull DiffRequest propertyRequest, @NotNull DiffViewer wrappingViewer) {
  myProject = context.getProject();
  myContext = context;
  myPropertyRequest = propertyRequest;
  myContentViewer = wrappingViewer;

  myPropertyRequest.onAssigned(true);

  mySettings = initSettings(context);

  mySplitter = new MySplitter("Property Changes");
  mySplitter.setProportion(mySettings.getSplitterProportion());
  mySplitter.setFirstComponent(myContentViewer.getComponent());

  myNotificationPanel = new Wrapper();

  MyPropertyContext propertyContext = initPropertyContext(context);
  myPropertiesViewer = createPropertiesViewer(propertyRequest, propertyContext);

  myPanel = new JPanel(new BorderLayout());
  myPanel.add(mySplitter, BorderLayout.CENTER);
  myPanel.add(myNotificationPanel, BorderLayout.SOUTH);
  DataManager.registerDataProvider(myPanel, new DataProvider() {
    @Override
    public Object getData(@NonNls String dataId) {
      DataProvider propertiesDataProvider = DataManagerImpl.getDataProviderEx(myPropertiesViewer.getComponent());
      DataProvider contentDataProvider = DataManagerImpl.getDataProviderEx(myContentViewer.getComponent());
      DataProvider defaultDP = myPropertiesViewerFocused ? propertiesDataProvider : contentDataProvider;
      DataProvider fallbackDP = myPropertiesViewerFocused ? contentDataProvider : propertiesDataProvider;
      return DiffUtil.getData(defaultDP, fallbackDP, dataId);
    }
  });

  updatePropertiesPanel();
}
项目:tools-idea    文件:FramesPanel.java   
public FramesPanel(Project project, DebuggerStateManager stateManager) {
  super(project, stateManager);
  myStateManager = stateManager;

  setLayout(new BorderLayout());

  myThreadsCombo = new ComboBoxWithWidePopup();
  myThreadsCombo.setRenderer(new DebuggerComboBoxRenderer(myThreadsCombo.getRenderer()));
  myThreadsListener = new ThreadsListener();
  myThreadsCombo.addItemListener(myThreadsListener);

  myFramesList = new FramesList(project);
  myFramesListener = new FramesListener();
  myFramesList.addListSelectionListener(myFramesListener);

  myFramesList.addMouseListener(new MouseAdapter() {
    public void mousePressed(final MouseEvent e) {
      int index = myFramesList.locationToIndex(e.getPoint());
      if (index >= 0 && myFramesList.isSelectedIndex(index)) {
        processListValue(myFramesList.getModel().getElementAt(index));
      }
    }
  });

  registerThreadsPopupMenu(myFramesList);

  setBorder(null);

  final ActionToolbar toolbar = createToolbar();
  Wrapper threads = new Wrapper();
  CustomLineBorder border = new CustomLineBorder(CaptionPanel.CNT_ACTIVE_BORDER_COLOR, 0, 0, 1, 0);
  threads.setBorder(border);
  threads.add(toolbar.getComponent(), BorderLayout.EAST);
  threads.add(myThreadsCombo, BorderLayout.CENTER);
  add(threads, BorderLayout.NORTH);
  add(ScrollPaneFactory.createScrollPane(myFramesList), BorderLayout.CENTER);
}
项目:tools-idea    文件:InfoAndProgressPanel.java   
private void buildInProcessCount() {
  removeAll();
  setLayout(new BorderLayout());

  final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0));
  progressCountPanel.setOpaque(false);
  String processWord = myOriginals.size() == 1 ? " process" : " processes";
  final LinkLabel label = new LinkLabel(myOriginals.size() + processWord + " running...", null, new LinkListener() {
    @Override
    public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
      triggerPopupShowing();
    }
  });

  if (SystemInfo.isMac) label.setFont(UIUtil.getLabelFont().deriveFont(11.0f));

  label.setOpaque(false);

  final Wrapper labelComp = new Wrapper(label);
  labelComp.setOpaque(false);
  progressCountPanel.add(labelComp, BorderLayout.CENTER);

  //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder());
  progressCountPanel.add(myProgressIcon, BorderLayout.WEST);

  add(myRefreshAndInfoPanel, BorderLayout.CENTER);

  progressCountPanel.setBorder(new EmptyBorder(0, 0, 0, 4));
  add(progressCountPanel, BorderLayout.EAST);

  revalidate();
  repaint();
}
项目:tools-idea    文件:RunnerContentUi.java   
private boolean rebuildMinimizedActions() {
  for (Map.Entry<GridImpl, Wrapper> entry : myMinimizedButtonsPlaceholder.entrySet()) {
    Wrapper eachPlaceholder = entry.getValue();
    ActionToolbar tb = myActionManager.createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, myMinimizedViewActions, true);
    tb.getComponent().setBorder(null);
    tb.setReservePlaceAutoPopupIcon(false);
    JComponent minimized = tb.getComponent();
    eachPlaceholder.setContent(minimized);
  }

  myTabs.getComponent().revalidate();
  myTabs.getComponent().repaint();

  return myMinimizedViewActions.getChildrenCount() > 0;
}
项目:consulo    文件:MergeRequestProcessor.java   
public MergeRequestProcessor(@javax.annotation.Nullable Project project, @Nonnull MergeRequest request) {
  myProject = project;
  myRequest = request;

  myContext = new MyDiffContext();
  myContext.putUserData(DiffUserDataKeys.PLACE, DiffPlaces.MERGE);

  myAvailableTools = DiffManagerEx.getInstance().getMergeTools();

  myMainPanel = new MyPanel();
  myContentPanel = new Wrapper();
  myToolbarPanel = new Wrapper();
  myToolbarPanel.setFocusable(true);
  myToolbarStatusPanel = new Wrapper();

  myPanel = JBUI.Panels.simplePanel(myMainPanel);

  JPanel topPanel = JBUI.Panels.simplePanel(myToolbarPanel).addToRight(myToolbarStatusPanel);

  myMainPanel.add(topPanel, BorderLayout.NORTH);
  myMainPanel.add(myContentPanel, BorderLayout.CENTER);

  myMainPanel.setFocusTraversalPolicyProvider(true);
  myMainPanel.setFocusTraversalPolicy(new MyFocusTraversalPolicy());

  MergeTool.MergeViewer viewer;
  try {
    viewer = getFittedTool().createComponent(myContext, myRequest);
  }
  catch (Throwable e) {
    LOG.error(e);
    viewer = ErrorMergeTool.INSTANCE.createComponent(myContext, myRequest);
  }

  myViewer = viewer;
  updateBottomActions();
}
项目:consulo    文件:MainFrame.java   
private JComponent createActionsToolbar() {
  DefaultActionGroup toolbarGroup = new DefaultActionGroup();
  toolbarGroup.add(ActionManager.getInstance().getAction(VcsLogActionPlaces.TOOLBAR_ACTION_GROUP));

  DefaultActionGroup mainGroup = new DefaultActionGroup();
  mainGroup.add(ActionManager.getInstance().getAction(VcsLogActionPlaces.VCS_LOG_TEXT_FILTER_SETTINGS_ACTION));
  mainGroup.add(new AnSeparator());
  mainGroup.add(myFilterUi.createActionGroup());
  mainGroup.addSeparator();
  if (BekUtil.isBekEnabled()) {
    if (BekUtil.isLinearBekEnabled()) {
      mainGroup.add(new IntelliSortChooserPopupAction());
      // can not register both of the actions in xml file, choosing to register an action for the "outer world"
      // I can of course if linear bek is enabled replace the action on start but why bother
    }
    else {
      mainGroup.add(ActionManager.getInstance().getAction(VcsLogActionPlaces.VCS_LOG_INTELLI_SORT_ACTION));
    }
  }
  mainGroup.add(toolbarGroup);
  ActionToolbar toolbar = createActionsToolbar(mainGroup);

  Wrapper textFilter = new Wrapper(myTextFilter);
  textFilter.setVerticalSizeReferent(toolbar.getComponent());
  textFilter.setBorder(JBUI.Borders.emptyLeft(5));

  ActionToolbar settings =
          createActionsToolbar(new DefaultActionGroup(ActionManager.getInstance().getAction(VcsLogActionPlaces.VCS_LOG_QUICK_SETTINGS_ACTION)));
  settings.setReservePlaceAutoPopupIcon(false);
  settings.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);

  JPanel panel = new JPanel(new MigLayout("ins 0, fill", "[left]0[left, fill]push[right]", "center"));
  panel.add(textFilter);
  panel.add(toolbar.getComponent());
  panel.add(settings.getComponent());
  return panel;
}
项目:consulo    文件:GraphTableController.java   
private void showToolTip(@Nonnull String text, @Nonnull MouseEvent e) {
  // standard tooltip does not allow to customize its location, and locating tooltip above can obscure some important info
  Point point = new Point(e.getX() + 5, e.getY());

  JEditorPane tipComponent = IdeTooltipManager.initPane(text, new HintHint(myTable, point).setAwtTooltip(true), null);
  IdeTooltip tooltip = new IdeTooltip(myTable, point, new Wrapper(tipComponent)).setPreferredPosition(Balloon.Position.atRight);
  IdeTooltipManager.getInstance().show(tooltip, false);
}
项目:consulo    文件:GraphTableController.java   
private boolean showTooltip(int row, int column, @Nonnull Point point, boolean now) {
  JComponent tipComponent = myCommitRenderer.getTooltip(myTable.getValueAt(row, column), calcPoint4Graph(point), row);

  if (tipComponent != null) {
    myTable.getExpandableItemsHandler().setEnabled(false);
    IdeTooltip tooltip =
            new IdeTooltip(myTable, point, new Wrapper(tipComponent)).setPreferredPosition(Balloon.Position.below);
    IdeTooltipManager.getInstance().show(tooltip, now);
    return true;
  }
  return false;
}
项目:consulo    文件:InfoAndProgressPanel.java   
private void buildInProcessCount() {
  removeAll();
  setLayout(new BorderLayout());

  final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0));
  progressCountPanel.setOpaque(false);
  String processWord = myOriginals.size() == 1 ? " process" : " processes";
  final LinkLabel<Object> label = new LinkLabel<>(myOriginals.size() + processWord + " running...", null,
                                                  (aSource, aLinkData) -> triggerPopupShowing());

  if (SystemInfo.isMac) label.setFont(JBUI.Fonts.label(11));

  label.setOpaque(false);

  final Wrapper labelComp = new Wrapper(label);
  labelComp.setOpaque(false);
  progressCountPanel.add(labelComp, BorderLayout.CENTER);

  //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder());
  progressCountPanel.add(myProgressIcon, BorderLayout.WEST);

  add(myRefreshAndInfoPanel, BorderLayout.CENTER);

  progressCountPanel.setBorder(JBUI.Borders.emptyRight(4));
  add(progressCountPanel, BorderLayout.EAST);

  revalidate();
  repaint();
}
项目:consulo    文件:EditorComposite.java   
private static int calcComponentInsertionIndex(@Nonnull JComponent newComponent, @Nonnull JComponent container) {
  for (int i = 0, max = container.getComponentCount(); i < max; i++) {
    Component childWrapper = container.getComponent(i);
    Component childComponent = childWrapper instanceof Wrapper ? ((Wrapper)childWrapper).getTargetComponent() : childWrapper;
    boolean weighted1 = newComponent instanceof Weighted;
    boolean weighted2 = childComponent instanceof Weighted;
    if (!weighted2) continue;
    if (!weighted1) return i;

    double w1 = ((Weighted)newComponent).getWeight();
    double w2 = ((Weighted)childComponent).getWeight();
    if (w1 < w2) return i;
  }
  return -1;
}
项目:consulo    文件:BalloonImpl.java   
private MyComponent(JComponent content, BalloonImpl balloon, EmptyBorder shapeBorder) {
  setOpaque(false);
  setLayout(null);
  myBalloon = balloon;

  // When a screen reader is active, TAB/Shift-TAB should allow moving the focus
  // outside the balloon in the event the balloon acquired the focus.
  if (!ScreenReader.isActive()) {
    setFocusCycleRoot(true);
  }
  putClientProperty(Balloon.KEY, BalloonImpl.this);

  myContent = new JPanel(new BorderLayout(2, 2));
  Wrapper contentWrapper = new Wrapper(content);
  if (myTitle != null) {
    myTitleLabel = new JLabel(myTitle, SwingConstants.CENTER);
    myTitleLabel.setForeground(UIManager.getColor("List.background"));
    myTitleLabel.setBorder(new EmptyBorder(0, 4, 0, 4));
    myContent.add(myTitleLabel, BorderLayout.NORTH);
    contentWrapper.setBorder(new EmptyBorder(1, 1, 1, 1));
  }
  myContent.add(contentWrapper, BorderLayout.CENTER);
  myContent.setBorder(shapeBorder);
  myContent.setOpaque(false);

  add(myContent);
}
项目:consulo    文件:RunnerContentUi.java   
private boolean rebuildMinimizedActions() {
  for (Map.Entry<GridImpl, Wrapper> entry : myMinimizedButtonsPlaceholder.entrySet()) {
    Wrapper eachPlaceholder = entry.getValue();
    ActionToolbar tb = myActionManager.createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, myMinimizedViewActions, true);
    tb.getComponent().setBorder(null);
    tb.setReservePlaceAutoPopupIcon(false);
    JComponent minimized = tb.getComponent();
    eachPlaceholder.setContent(minimized);
  }

  myTabs.getComponent().revalidate();
  myTabs.getComponent().repaint();

  return myMinimizedViewActions.getChildrenCount() > 0;
}
项目:intellij-ce-playground    文件:DiffRequestProcessor.java   
public DiffRequestProcessor(@Nullable Project project, @NotNull UserDataHolder context) {
  myProject = project;

  myContext = new MyDiffContext(context);
  myActiveRequest = new LoadingDiffRequest();

  mySettings = DiffSettingsHolder.getInstance().getSettings(myContext.getUserData(DiffUserDataKeys.PLACE));

  myAvailableTools = DiffManagerEx.getInstance().getDiffTools();
  myToolOrder = new LinkedList<DiffTool>(getToolOrderFromSettings(myAvailableTools));

  // UI

  myMainPanel = new MyPanel();
  myContentPanel = new Wrapper();
  myToolbarPanel = new Wrapper();
  myToolbarPanel.setFocusable(true);
  myToolbarStatusPanel = new Wrapper();
  myProgressBar = new MyProgressBar();

  myPanel = JBUI.Panels.simplePanel(myMainPanel);

  JPanel statusPanel = JBUI.Panels.simplePanel(myToolbarStatusPanel).addToLeft(myProgressBar);
  JPanel topPanel = JBUI.Panels.simplePanel(myToolbarPanel).addToRight(statusPanel);

  myMainPanel.add(topPanel, BorderLayout.NORTH);
  myMainPanel.add(myContentPanel, BorderLayout.CENTER);

  myMainPanel.setFocusTraversalPolicyProvider(true);
  myMainPanel.setFocusTraversalPolicy(new MyFocusTraversalPolicy());

  JComponent bottomPanel = myContext.getUserData(DiffUserDataKeysEx.BOTTOM_PANEL);
  if (bottomPanel != null) myMainPanel.add(bottomPanel, BorderLayout.SOUTH);
  if (bottomPanel instanceof Disposable) Disposer.register(this, (Disposable)bottomPanel);

  myState = EmptyState.INSTANCE;
  myContentPanel.setContent(DiffUtil.createMessagePanel(((LoadingDiffRequest)myActiveRequest).getMessage()));

  myOpenInEditorAction = new OpenInEditorAction(new Runnable() {
    @Override
    public void run() {
      onAfterNavigate();
    }
  });
}
项目:intellij-ce-playground    文件:InlineProgressIndicator.java   
public InlineProgressIndicator(boolean compact, @NotNull TaskInfo processInfo) {
  myCompact = compact;
  myInfo = processInfo;

  myCancelButton = new InplaceButton(new IconButton(processInfo.getCancelTooltipText(),
                                                    AllIcons.Process.Stop,
                                                    AllIcons.Process.StopHovered) {
  }, new ActionListener() {
    public void actionPerformed(final ActionEvent e) {
      cancelRequest();
    }
  }).setFillBg(true);

  myCancelButton.setVisible(myInfo.isCancellable());
  myCancelButton.setOpaque(false);
  myCancelButton.setToolTipText(processInfo.getCancelTooltipText());
  myCancelButton.setFillBg(false);

  myProgress = new JProgressBar(SwingConstants.HORIZONTAL);
  myProgress.putClientProperty("JComponent.sizeVariant", "mini");

  myComponent = new MyComponent(compact, myProcessName);
  if (myCompact) {
    myComponent.setOpaque(false);
    myComponent.setLayout(new BorderLayout(2, 0));
    final JPanel textAndProgress = new JPanel(new BorderLayout());
    textAndProgress.setOpaque(false);
    textAndProgress.add(myText, BorderLayout.CENTER);

    final NonOpaquePanel progressWrapper = new NonOpaquePanel(new GridBagLayout());
    progressWrapper.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
    final GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1;
    c.weighty = 1;
    c.insets = new Insets(SystemInfo.isMacOSLion ? 1 : 0, 0, 1, myInfo.isCancellable() ? 0 : 4);
    c.fill = GridBagConstraints.HORIZONTAL;
    progressWrapper.add(myProgress, c);

    textAndProgress.add(progressWrapper, BorderLayout.EAST);
    myComponent.add(textAndProgress, BorderLayout.CENTER);
    myComponent.add(myCancelButton, BorderLayout.EAST);
    myComponent.setToolTipText(processInfo.getTitle() + ". " + IdeBundle.message("progress.text.clickToViewProgressWindow"));
  } else {
    myComponent.setLayout(new BorderLayout());
    myProcessName.setText(processInfo.getTitle());
    myComponent.add(myProcessName, BorderLayout.NORTH);
    myProcessName.setForeground(UIUtil.getPanelBackground().brighter().brighter());
    myProcessName.setBorder(new EmptyBorder(2, 2, 2, 2));

    final NonOpaquePanel content = new NonOpaquePanel(new BorderLayout());
    content.setBorder(new EmptyBorder(2, 2, 2, myInfo.isCancellable() ? 2 : 4));
    myComponent.add(content, BorderLayout.CENTER);

    final Wrapper cancelWrapper = new Wrapper(myCancelButton);
    cancelWrapper.setOpaque(false);
    cancelWrapper.setBorder(new EmptyBorder(0, 3, 0, 2));

    content.add(cancelWrapper, BorderLayout.EAST);
    content.add(myText, BorderLayout.NORTH);
    content.add(myProgress, BorderLayout.CENTER);
    content.add(myText2, BorderLayout.SOUTH);

    myComponent.setBorder(new EmptyBorder(2, 2, 2, 2));
  }

  if (!myCompact) {
    myProcessName.recomputeSize();
    myText.recomputeSize();
    myText2.recomputeSize();
  }

}
项目:intellij-ce-playground    文件:RunnerContentUi.java   
private boolean rebuildCommonActions() {
  boolean hasToolbarContent = false;
  for (Map.Entry<GridImpl, Wrapper> entry : myCommonActionsPlaceholder.entrySet()) {
    Wrapper eachPlaceholder = entry.getValue();
    List<Content> contentList = entry.getKey().getContents();

    Set<Content> contents = new HashSet<Content>();
    contents.addAll(contentList);

    DefaultActionGroup groupToBuild;
    JComponent contextComponent = null;
    if (isHorizontalToolbar() && contents.size() == 1) {
      Content content = contentList.get(0);
      groupToBuild = new DefaultActionGroup();
      if (content.getActions() != null) {
        groupToBuild.addAll(content.getActions());
        groupToBuild.addSeparator();
        contextComponent = content.getActionsContextComponent();
      }
      groupToBuild.addAll(myTopActions);
    }
    else {
      final DefaultActionGroup group = new DefaultActionGroup();
      group.addAll(myTopActions);
      groupToBuild = group;
    }

    final AnAction[] actions = groupToBuild.getChildren(null);
    if (!Arrays.equals(actions, myContextActions.get(entry.getKey()))) {
      ActionToolbar tb = myActionManager.createActionToolbar(myActionsPlace, groupToBuild, true);
      tb.getComponent().setBorder(null);
      tb.setTargetComponent(contextComponent);
      eachPlaceholder.setContent(tb.getComponent());
    }

    if (groupToBuild.getChildrenCount() > 0) {
      hasToolbarContent = true;
    }

    myContextActions.put(entry.getKey(), actions);
  }

  return hasToolbarContent;
}
项目:intellij-ce-playground    文件:PerspectiveFileEditor.java   
public Wrapper getWrapper() {
  return myWrapper;
}
项目:tools-idea    文件:InlineProgressIndicator.java   
public InlineProgressIndicator(boolean compact, TaskInfo processInfo) {
  myCompact = compact;
  myInfo = processInfo;

  myCancelButton = new InplaceButton(new IconButton(processInfo.getCancelTooltipText(),
                                                    AllIcons.Process.Stop,
                                                    AllIcons.Process.StopHovered) {
  }, new ActionListener() {
    public void actionPerformed(final ActionEvent e) {
      cancelRequest();
    }
  }).setFillBg(true);

  myCancelButton.setVisible(myInfo.isCancellable());
  myCancelButton.setOpaque(false);
  myCancelButton.setToolTipText(processInfo.getCancelTooltipText());
  myCancelButton.setFillBg(false);

  myProgress = new MyProgressBar(JProgressBar.HORIZONTAL, compact);

  myComponent = new MyComponent(compact, myProcessName);
  if (myCompact) {
    myComponent.setOpaque(false);
    myComponent.setLayout(new BorderLayout(2, 0));
    final JPanel textAndProgress = new JPanel(new BorderLayout());
    textAndProgress.setOpaque(false);
    textAndProgress.add(myText, BorderLayout.CENTER);

    final NonOpaquePanel progressWrapper = new NonOpaquePanel(new GridBagLayout());
    progressWrapper.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
    final GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1;
    c.weighty = 1;
    c.insets = new Insets(SystemInfo.isMacOSLion ? 1 : 0, 0, 1, myInfo.isCancellable() ? 0 : 4);
    c.fill = GridBagConstraints.HORIZONTAL;
    progressWrapper.add(myProgress, c);

    textAndProgress.add(progressWrapper, BorderLayout.EAST);
    myComponent.add(textAndProgress, BorderLayout.CENTER);
    myComponent.add(myCancelButton, BorderLayout.EAST);
    myComponent.setToolTipText(processInfo.getTitle() + ". " + IdeBundle.message("progress.text.clickToViewProgressWindow"));
    myProgress.setActive(false);
  } else {
    myComponent.setLayout(new BorderLayout());
    myProcessName.setText(processInfo.getTitle());
    myComponent.add(myProcessName, BorderLayout.NORTH);
    myProcessName.setForeground(UIUtil.getPanelBackground().brighter().brighter());
    myProcessName.setBorder(new EmptyBorder(2, 2, 2, 2));
    myProcessName.setDecorate(false);

    final NonOpaquePanel content = new NonOpaquePanel(new BorderLayout());
    content.setBorder(new EmptyBorder(2, 2, 2, myInfo.isCancellable() ? 2 : 4));
    myComponent.add(content, BorderLayout.CENTER);

    final Wrapper cancelWrapper = new Wrapper(myCancelButton);
    cancelWrapper.setOpaque(false);
    cancelWrapper.setBorder(new EmptyBorder(0, 3, 0, 2));

    content.add(cancelWrapper, BorderLayout.EAST);
    content.add(myText, BorderLayout.NORTH);
    content.add(myProgress, BorderLayout.CENTER);
    content.add(myText2, BorderLayout.SOUTH);

    myText.setDecorate(false);
    myText2.setDecorate(false);

    myComponent.setBorder(new EmptyBorder(2, 2, 2, 2));
    myProgress.setActive(false);
  }

  if (!myCompact) {
    myProcessName.recomputeSize();
    myText.recomputeSize();
    myText2.recomputeSize();
  }

}
项目:tools-idea    文件:RunnerContentUi.java   
private boolean rebuildCommonActions() {
  boolean hasToolbarContent = false;
  for (Map.Entry<GridImpl, Wrapper> entry : myCommonActionsPlaceholder.entrySet()) {
    Wrapper eachPlaceholder = entry.getValue();
    List<Content> contentList = entry.getKey().getContents();

    Set<Content> contents = new HashSet<Content>();
    contents.addAll(contentList);

    DefaultActionGroup groupToBuild;
    JComponent contextComponent = null;
    if (isHorizontalToolbar() && contents.size() == 1) {
      Content content = contentList.get(0);
      groupToBuild = new DefaultActionGroup();
      if (content.getActions() != null) {
        groupToBuild.addAll(content.getActions());
        groupToBuild.addSeparator();
        contextComponent = content.getActionsContextComponent();
      }
      groupToBuild.addAll(myTopActions);
    }
    else {
      final DefaultActionGroup group = new DefaultActionGroup();
      group.addAll(myTopActions);
      groupToBuild = group;
    }

    final AnAction[] actions = groupToBuild.getChildren(null);
    if (!Arrays.equals(actions, myContextActions.get(entry.getKey()))) {
      ActionToolbar tb = myActionManager.createActionToolbar(myActionsPlace, groupToBuild, true);
      tb.getComponent().setBorder(null);
      tb.setTargetComponent(contextComponent);
      eachPlaceholder.setContent(tb.getComponent());
    }

    if (groupToBuild.getChildrenCount() > 0) {
      hasToolbarContent = true;
    }

    myContextActions.put(entry.getKey(), actions);
  }

  return hasToolbarContent;
}
项目:tools-idea    文件:PerspectiveFileEditor.java   
public Wrapper getWrapper() {
  return myWrapprer;
}
项目:consulo    文件:DiffRequestProcessor.java   
public DiffRequestProcessor(@javax.annotation.Nullable Project project, @Nonnull UserDataHolder context) {
  myProject = project;

  myContext = new MyDiffContext(context);
  myActiveRequest = new LoadingDiffRequest();

  mySettings = DiffSettingsHolder.getInstance().getSettings(myContext.getUserData(DiffUserDataKeys.PLACE));

  myAvailableTools = DiffManagerEx.getInstance().getDiffTools();
  myToolOrder = new LinkedList<DiffTool>(getToolOrderFromSettings(myAvailableTools));

  // UI

  myMainPanel = new MyPanel();
  myContentPanel = new Wrapper();
  myToolbarPanel = new Wrapper();
  myToolbarPanel.setFocusable(true);
  myToolbarStatusPanel = new Wrapper();
  myProgressBar = new MyProgressBar();

  myPanel = JBUI.Panels.simplePanel(myMainPanel);

  JPanel statusPanel = JBUI.Panels.simplePanel(myToolbarStatusPanel).addToLeft(myProgressBar);
  JPanel topPanel = JBUI.Panels.simplePanel(myToolbarPanel).addToRight(statusPanel);

  myMainPanel.add(topPanel, BorderLayout.NORTH);
  myMainPanel.add(myContentPanel, BorderLayout.CENTER);

  myMainPanel.setFocusTraversalPolicyProvider(true);
  myMainPanel.setFocusTraversalPolicy(new MyFocusTraversalPolicy());

  JComponent bottomPanel = myContext.getUserData(DiffUserDataKeysEx.BOTTOM_PANEL);
  if (bottomPanel != null) myMainPanel.add(bottomPanel, BorderLayout.SOUTH);
  if (bottomPanel instanceof Disposable) Disposer.register(this, (Disposable)bottomPanel);

  myState = EmptyState.INSTANCE;
  myContentPanel.setContent(DiffUtil.createMessagePanel(((LoadingDiffRequest)myActiveRequest).getMessage()));

  myOpenInEditorAction = new OpenInEditorAction(new Runnable() {
    @Override
    public void run() {
      onAfterNavigate();
    }
  });
}
项目:consulo    文件:ServersToolWindowContent.java   
public ServersToolWindowContent(@Nonnull Project project) {
  super(new BorderLayout());
  myProject = project;

  myTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode());
  myTree = new Tree(myTreeModel);
  myTree.setRootVisible(false);

  myTree.setShowsRootHandles(true);
  myTree.setCellRenderer(new NodeRenderer());
  myTree.setLineStyleAngled();

  getMainPanel().add(createToolbar(), BorderLayout.WEST);
  Splitter splitter = new OnePixelSplitter(false, 0.3f);
  splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree, SideBorder.LEFT));
  myPropertiesPanelLayout = new CardLayout();
  myPropertiesPanel = new JPanel(myPropertiesPanelLayout);
  myMessageLabel = new JLabel(EMPTY_SELECTION_MESSAGE, SwingConstants.CENTER);
  myPropertiesPanel.add(MESSAGE_CARD, new Wrapper(myMessageLabel));
  splitter.setSecondComponent(myPropertiesPanel);
  getMainPanel().add(splitter, BorderLayout.CENTER);

  setupBuilder(project);

  for (RemoteServersViewContributor contributor : RemoteServersViewContributor.EP_NAME.getExtensions()) {
    contributor.setupTree(myProject, myTree, myBuilder);
  }

  myTree.addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      onSelectionChanged();
    }
  });
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent event) {
      Set<ServersTreeStructure.RemoteServerNode> nodes = getSelectedRemoteServerNodes();
      if (nodes.size() == 1) {
        RemoteServer<?> server = nodes.iterator().next().getValue();
        ServerConnectionManager.getInstance().getOrCreateConnection(server).computeDeployments(EmptyRunnable.INSTANCE);
        return true;
      }
      return false;
    }
  }.installOn(myTree);
}
项目:consulo    文件:ReferencesPanel.java   
private void addWrapped(@Nonnull JBLabel label, @Nonnull JBLabel referent) {
  Wrapper wrapper = new Wrapper(label);
  wrapper.setVerticalSizeReferent(referent);
  add(wrapper);
}