public void apply(UiDecorator.UiDecoration decoration) { if (decoration.getLabelFont() != null) { setFont(decoration.getLabelFont()); getLabelComponent().setFont(decoration.getLabelFont()); } Insets insets = decoration.getLabelInsets(); if (insets != null) { Insets current = JBTabsImpl.ourDefaultDecorator.getDecoration().getLabelInsets(); if (current != null) { setBorder( new EmptyBorder(getValue(current.top, insets.top), getValue(current.left, insets.left), getValue(current.bottom, insets.bottom), getValue(current.right, insets.right))); } } }
@NotNull private TabbedPaneWrapper.AsJBTabs createTabbedPaneWrapper(FileEditor[] editors) { PrevNextActionsDescriptor descriptor = new PrevNextActionsDescriptor(IdeActions.ACTION_NEXT_EDITOR_TAB, IdeActions.ACTION_PREVIOUS_EDITOR_TAB); final TabbedPaneWrapper.AsJBTabs wrapper = new TabbedPaneWrapper.AsJBTabs(myFileEditorManager.getProject(), SwingConstants.BOTTOM, descriptor, this); wrapper.getTabs().getPresentation().setPaintBorder(0, 0, 0, 0).setTabSidePaintBorder(1).setGhostsAlwaysVisible(true).setUiDecorator(new UiDecorator() { @Override @NotNull public UiDecoration getDecoration() { return new UiDecoration(null, new Insets(0, 8, 0, 8)); } }); wrapper.getTabs().getComponent().setBorder(new EmptyBorder(0, 0, 1, 0)); boolean firstEditor = true; for (FileEditor editor : editors) { JComponent component = firstEditor && myComponent != null ? (JComponent)myComponent.getComponent(0) : createEditorComponent(editor); wrapper.addTab(getDisplayName(editor), component); firstEditor = false; } wrapper.addChangeListener(new MyChangeListener()); return wrapper; }
public void apply(UiDecorator.UiDecoration decoration) { if (decoration.getLabelFont() != null) { setFont(decoration.getLabelFont()); myLabel.setFont(decoration.getLabelFont()); } Insets insets = decoration.getLabelInsets(); if (insets != null) { Insets current = JBTabsImpl.ourDefaultDecorator.getDecoration().getLabelInsets(); if (current != null) { setBorder( new EmptyBorder(getValue(current.top, insets.top), getValue(current.left, insets.left), getValue(current.bottom, insets.bottom), getValue(current.right, insets.right))); } } }
@Nonnull private TabbedPaneWrapper.AsJBTabs createTabbedPaneWrapper(FileEditor[] editors) { PrevNextActionsDescriptor descriptor = new PrevNextActionsDescriptor(IdeActions.ACTION_NEXT_EDITOR_TAB, IdeActions.ACTION_PREVIOUS_EDITOR_TAB); final TabbedPaneWrapper.AsJBTabs wrapper = new TabbedPaneWrapper.AsJBTabs(myFileEditorManager.getProject(), SwingConstants.BOTTOM, descriptor, this); wrapper.getTabs().getPresentation().setPaintBorder(0, 0, 0, 0).setTabSidePaintBorder(1).setGhostsAlwaysVisible(true).setUiDecorator( () -> new UiDecorator.UiDecoration(null, new Insets(0, 8, 0, 8))); wrapper.getTabs().getComponent().setBorder(new EmptyBorder(0, 0, 1, 0)); boolean firstEditor = true; for (FileEditor editor : editors) { JComponent component = firstEditor && myComponent != null ? (JComponent)myComponent.getComponent(0) : createEditorComponent(editor); wrapper.addTab(getDisplayName(editor), component); firstEditor = false; } wrapper.addChangeListener(new MyChangeListener()); return wrapper; }
public void apply(UiDecorator.UiDecoration decoration) { if (decoration.getLabelFont() != null) { setFont(decoration.getLabelFont()); getLabelComponent().setFont(decoration.getLabelFont()); } Insets insets = decoration.getLabelInsets(); if (insets != null) { Insets current = JBTabsImpl.ourDefaultDecorator.getDecoration().getLabelInsets(); if (current != null) { setBorder(new EmptyBorder(getValue(current.top, insets.top), getValue(current.left, insets.left), getValue(current.bottom, insets.bottom), getValue(current.right, insets.right))); } } }
@Override public void apply(UiDecorator.UiDecoration decoration) { setBorder(new EmptyBorder(5, 5, 7, 5)); }
public UiDebugger() { Disposer.register(Disposer.get("ui"), this); myTabs = new JBTabsImpl(null, ActionManager.getInstance(), null, this); myTabs.getPresentation().setInnerInsets(new Insets(4, 0, 0, 0)).setPaintBorder(1, 0, 0, 0).setActiveTabFillIn(JBColor.GRAY).setUiDecorator(new UiDecorator() { @Override @NotNull public UiDecoration getDecoration() { return new UiDecoration(null, new Insets(4, 4, 4, 4)); } }); myExtensions = Extensions.getExtensions(UiDebuggerExtension.EP_NAME); addToUi(myExtensions); myDialog = new DialogWrapper((Project)null, true) { { init(); } @Override protected JComponent createCenterPanel() { Disposer.register(getDisposable(), UiDebugger.this); return myTabs.getComponent(); } @Override public JComponent getPreferredFocusedComponent() { return myTabs.getComponent(); } @Override protected String getDimensionServiceKey() { return "UiDebugger"; } @Override protected JComponent createSouthPanel() { final JPanel result = new JPanel(new BorderLayout()); result.add(super.createSouthPanel(), BorderLayout.EAST); final JSlider slider = new JSlider(0, 100); slider.setValue(100); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { final int value = slider.getValue(); float alpha = value / 100f; final Window wnd = SwingUtilities.getWindowAncestor(slider); if (wnd != null) { final WindowManagerEx mgr = WindowManagerEx.getInstanceEx(); if (value == 100) { mgr.setAlphaModeEnabled(wnd, false); } else { mgr.setAlphaModeEnabled(wnd, true); mgr.setAlphaModeRatio(wnd, 1f - alpha); } } } }); result.add(slider, BorderLayout.WEST); return result; } @NotNull @Override protected Action[] createActions() { return new Action[] {new AbstractAction("Close") { @Override public void actionPerformed(ActionEvent e) { doOKAction(); } }}; } }; myDialog.setModal(false); myDialog.setTitle("UI Debugger"); myDialog.setResizable(true); myDialog.show(); }
@Override public void apply(UiDecorator.UiDecoration decoration) { setBorder(JBUI.Borders.empty(5, 5, 7, 5)); }