Java Code Examples for com.intellij.openapi.wm.ToolWindowAnchor#BOTTOM
The following examples show how to use
com.intellij.openapi.wm.ToolWindowAnchor#BOTTOM .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void run() { try { final ToolWindowAnchor anchor = myInfo.getAnchor(); if (ToolWindowAnchor.TOP == anchor) { myTopStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.LEFT == anchor) { myLeftStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.BOTTOM == anchor) { myBottomStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.RIGHT == anchor) { myRightStripe.addButton(myButton, myComparator); } else { LOGGER.error("unknown anchor: " + anchor); } getVaadinComponent().markAsDirtyRecursive(); } finally { finish(); } }
Example 2
Source File: WebToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
private void setComponent(@Nullable ToolWindowInternalDecorator d, @Nonnull ToolWindowAnchor anchor, final float weight) { WebToolWindowInternalDecorator decorator = (WebToolWindowInternalDecorator)d; consulo.ui.Component component = decorator == null ? null : decorator.getComponent(); if (ToolWindowAnchor.TOP == anchor) { //myVerticalSplitter.setFirstComponent(component); //myVerticalSplitter.setFirstSize((int)(myLayeredPane.getHeight() * weight)); } else if (ToolWindowAnchor.LEFT == anchor) { myHorizontalSplitter.setFirstComponent(component); //myHorizontalSplitter.setFirstSize((int)(myLayeredPane.getWidth() * weight)); } else if (ToolWindowAnchor.BOTTOM == anchor) { //myVerticalSplitter.setLastComponent(component); //myVerticalSplitter.setLastSize((int)(myLayeredPane.getHeight() * weight)); } else if (ToolWindowAnchor.RIGHT == anchor) { myHorizontalSplitter.setSecondComponent(component); //myHorizontalSplitter.setLastSize((int)(myLayeredPane.getWidth() * weight)); } else { //LOG.error("unknown anchor: " + anchor); } }
Example 3
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
/** * Sets (docks) specified component to the specified anchor. */ private void setComponent(final JComponent component, @Nonnull ToolWindowAnchor anchor, final float weight) { if (ToolWindowAnchor.TOP == anchor) { myVerticalSplitter.setFirstComponent(component); myVerticalSplitter.setFirstSize((int)(myLayeredPane.getHeight() * weight)); } else if (ToolWindowAnchor.LEFT == anchor) { myHorizontalSplitter.setFirstComponent(component); myHorizontalSplitter.setFirstSize((int)(myLayeredPane.getWidth() * weight)); } else if (ToolWindowAnchor.BOTTOM == anchor) { myVerticalSplitter.setLastComponent(component); myVerticalSplitter.setLastSize((int)(myLayeredPane.getHeight() * weight)); } else if (ToolWindowAnchor.RIGHT == anchor) { myHorizontalSplitter.setLastComponent(component); myHorizontalSplitter.setLastSize((int)(myLayeredPane.getWidth() * weight)); } else { LOG.error("unknown anchor: " + anchor); } }
Example 4
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
private JComponent getComponentAt(@Nonnull ToolWindowAnchor anchor) { if (ToolWindowAnchor.TOP == anchor) { return myVerticalSplitter.getFirstComponent(); } else if (ToolWindowAnchor.LEFT == anchor) { return myHorizontalSplitter.getFirstComponent(); } else if (ToolWindowAnchor.BOTTOM == anchor) { return myVerticalSplitter.getLastComponent(); } else if (ToolWindowAnchor.RIGHT == anchor) { return myHorizontalSplitter.getLastComponent(); } else { LOG.error("unknown anchor: " + anchor); return null; } }
Example 5
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Nullable DesktopStripePanelImpl getStripeFor(String id) { ToolWindow window = myManager.getToolWindow(id); if (window == null) { return null; } final ToolWindowAnchor anchor = myManager.getToolWindow(id).getAnchor(); if (ToolWindowAnchor.TOP == anchor) { return myTopStripe; } if (ToolWindowAnchor.BOTTOM == anchor) { return myBottomStripe; } if (ToolWindowAnchor.LEFT == anchor) { return myLeftStripe; } if (ToolWindowAnchor.RIGHT == anchor) { return myRightStripe; } throw new IllegalArgumentException("Anchor=" + anchor); }
Example 6
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void run() { try { final ToolWindowAnchor anchor = myInfo.getAnchor(); if (ToolWindowAnchor.TOP == anchor) { myTopStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.LEFT == anchor) { myLeftStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.BOTTOM == anchor) { myBottomStripe.addButton(myButton, myComparator); } else if (ToolWindowAnchor.RIGHT == anchor) { myRightStripe.addButton(myButton, myComparator); } else { LOG.error("unknown anchor: " + anchor); } validate(); repaint(); } finally { finish(); } }
Example 7
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void run() { try { final ToolWindowAnchor anchor = myInfo.getAnchor(); if (ToolWindowAnchor.TOP == anchor) { myTopStripe.removeButton(myButton); } else if (ToolWindowAnchor.LEFT == anchor) { myLeftStripe.removeButton(myButton); } else if (ToolWindowAnchor.BOTTOM == anchor) { myBottomStripe.removeButton(myButton); } else if (ToolWindowAnchor.RIGHT == anchor) { myRightStripe.removeButton(myButton); } else { LOG.error("unknown anchor: " + anchor); } validate(); repaint(); } finally { finish(); } }
Example 8
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
final void setBoundsInPaletteLayer(@Nonnull Component component, @Nonnull ToolWindowAnchor anchor, float weight) { if (weight < .0f) { weight = WindowInfoImpl.DEFAULT_WEIGHT; } else if (weight > 1.0f) { weight = 1.0f; } if (ToolWindowAnchor.TOP == anchor) { component.setBounds(0, 0, getWidth(), (int)(getHeight() * weight + .5f)); } else if (ToolWindowAnchor.LEFT == anchor) { component.setBounds(0, 0, (int)(getWidth() * weight + .5f), getHeight()); } else if (ToolWindowAnchor.BOTTOM == anchor) { final int height = (int)(getHeight() * weight + .5f); component.setBounds(0, getHeight() - height, getWidth(), height); } else if (ToolWindowAnchor.RIGHT == anchor) { final int width = (int)(getWidth() * weight + .5f); component.setBounds(getWidth() - width, 0, width, getHeight()); } else { LOG.error("unknown anchor " + anchor); } }
Example 9
Source File: WebToolWindowPanelImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void run() { try { WebToolWindowStripeButtonImpl stripeButton = getButtonById(myId); if (stripeButton == null) { return; } WindowInfo info = stripeButton.getWindowInfo(); ToolWindowAnchor anchor = info.getAnchor(); if (ToolWindowAnchor.TOP == anchor) { myTopStripe.markAsDirtyRecursive(); } else if (ToolWindowAnchor.LEFT == anchor) { myLeftStripe.markAsDirtyRecursive(); } else if (ToolWindowAnchor.BOTTOM == anchor) { myBottomStripe.markAsDirtyRecursive(); } else if (ToolWindowAnchor.RIGHT == anchor) { myRightStripe.markAsDirtyRecursive(); } else { LOGGER.error("unknown anchor: " + anchor); } } finally { finish(); } }
Example 10
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 5 votes |
private void stretch(@Nonnull ToolWindow wnd, int value) { Pair<Resizer, Component> pair = findResizerAndComponent(wnd); if (pair == null) return; boolean vertical = wnd.getAnchor() == ToolWindowAnchor.TOP || wnd.getAnchor() == ToolWindowAnchor.BOTTOM; int actualSize = (vertical ? pair.second.getHeight() : pair.second.getWidth()) + value; boolean first = wnd.getAnchor() == ToolWindowAnchor.LEFT || wnd.getAnchor() == ToolWindowAnchor.TOP; int maxValue = vertical ? myVerticalSplitter.getMaxSize(first) : myHorizontalSplitter.getMaxSize(first); int minValue = vertical ? myVerticalSplitter.getMinSize(first) : myHorizontalSplitter.getMinSize(first); pair.first.setSize(Math.max(minValue, Math.min(maxValue, actualSize))); }
Example 11
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void run() { try { DesktopStripeButton stripeButton = getButtonById(myId); if (stripeButton == null) { return; } WindowInfoImpl info = stripeButton.getWindowInfo(); ToolWindowAnchor anchor = info.getAnchor(); if (ToolWindowAnchor.TOP == anchor) { myTopStripe.revalidate(); } else if (ToolWindowAnchor.LEFT == anchor) { myLeftStripe.revalidate(); } else if (ToolWindowAnchor.BOTTOM == anchor) { myBottomStripe.revalidate(); } else if (ToolWindowAnchor.RIGHT == anchor) { myRightStripe.revalidate(); } else { LOG.error("unknown anchor: " + anchor); } } finally { finish(); } }
Example 12
Source File: DesktopToolWindowHeader.java From consulo with Apache License 2.0 | 5 votes |
private Image getHideIcon(ToolWindow toolWindow) { ToolWindowAnchor anchor = toolWindow.getAnchor(); if (anchor == ToolWindowAnchor.BOTTOM) { return AllIcons.General.HideDownPart; } else if (anchor == ToolWindowAnchor.RIGHT) { return AllIcons.General.HideRightPart; } return AllIcons.General.HideLeftPart; }
Example 13
Source File: Surface.java From consulo with Apache License 2.0 | 4 votes |
public final void paint(final Graphics g) { final Rectangle bounds = getBounds(); if (myAnchor == ToolWindowAnchor.LEFT) { if (myDirection == 1) { g.setClip(null); g.clipRect(myOffset, 0, bounds.width - myOffset, bounds.height); g.drawImage(myBottomImage, 0, 0, null); g.setClip(null); g.clipRect(0, 0, myOffset, bounds.height); g.drawImage(myTopImage, myOffset - bounds.width, 0, null); } else { g.setClip(null); g.clipRect(bounds.width - myOffset, 0, myOffset, bounds.height); g.drawImage(myBottomImage, 0, 0, null); g.setClip(null); g.clipRect(0, 0, bounds.width - myOffset, bounds.height); g.drawImage(myTopImage, -myOffset, 0, null); } myTopImage.flush(); } else if (myAnchor == ToolWindowAnchor.RIGHT) { if (myDirection == 1) { g.setClip(null); g.clipRect(0, 0, bounds.width - myOffset, bounds.height); g.drawImage(myBottomImage, 0, 0, null); g.setClip(null); g.clipRect(bounds.width - myOffset, 0, myOffset, bounds.height); g.drawImage(myTopImage, bounds.width - myOffset, 0, null); } else { g.setClip(null); g.clipRect(0, 0, myOffset, bounds.height); g.drawImage(myBottomImage, 0, 0, null); g.setClip(null); g.clipRect(myOffset, 0, bounds.width - myOffset, bounds.height); g.drawImage(myTopImage, myOffset, 0, null); } } else if (myAnchor == ToolWindowAnchor.TOP) { if (myDirection == 1) { g.setClip(null); g.clipRect(0, myOffset, bounds.width, bounds.height - myOffset); g.drawImage(myBottomImage, 0, 0, null); g.setClip(null); g.clipRect(0, 0, bounds.width, myOffset); g.drawImage(myTopImage, 0, -bounds.height + myOffset, null); } else { g.setClip(null); g.clipRect(0, bounds.height - myOffset, bounds.width, myOffset); g.drawImage(myBottomImage, 0, 0, null); g.setClip(null); g.clipRect(0, 0, bounds.width, bounds.height - myOffset); g.drawImage(myTopImage, 0, -myOffset, null); } } else if (myAnchor == ToolWindowAnchor.BOTTOM) { if (myDirection == 1) { g.setClip(null); g.clipRect(0, 0, bounds.width, bounds.height - myOffset); g.drawImage(myBottomImage, 0, 0, null); g.setClip(null); g.clipRect(0, bounds.height - myOffset, bounds.width, myOffset); g.drawImage(myTopImage, 0, bounds.height - myOffset, null); } else { g.setClip(null); g.clipRect(0, 0, bounds.width, myOffset); g.drawImage(myBottomImage, 0, 0, null); g.setClip(null); g.clipRect(0, myOffset, bounds.width, bounds.height - myOffset); g.drawImage(myTopImage, 0, myOffset, null); } } }
Example 14
Source File: DesktopToolWindowPanelImpl.java From consulo with Apache License 2.0 | 4 votes |
@Nullable private Pair<Resizer, Component> findResizerAndComponent(@Nonnull ToolWindow wnd) { if (!wnd.isVisible()) return null; Resizer resizer = null; Component cmp = null; if (wnd.getType() == ToolWindowType.DOCKED) { cmp = getComponentAt(wnd.getAnchor()); if (cmp != null) { if (wnd.getAnchor().isHorizontal()) { resizer = myVerticalSplitter.getFirstComponent() == cmp ? new Resizer.Splitter.FirstComponent(myVerticalSplitter) : new Resizer.Splitter.LastComponent(myVerticalSplitter); } else { resizer = myHorizontalSplitter.getFirstComponent() == cmp ? new Resizer.Splitter.FirstComponent(myHorizontalSplitter) : new Resizer.Splitter.LastComponent(myHorizontalSplitter); } } } else if (wnd.getType() == ToolWindowType.SLIDING) { cmp = wnd.getComponent(); while (cmp != null) { if (cmp.getParent() == myLayeredPane) break; cmp = cmp.getParent(); } if (cmp != null) { if (wnd.getAnchor() == ToolWindowAnchor.TOP) { resizer = new Resizer.LayeredPane.Top(cmp); } else if (wnd.getAnchor() == ToolWindowAnchor.BOTTOM) { resizer = new Resizer.LayeredPane.Bottom(cmp); } else if (wnd.getAnchor() == ToolWindowAnchor.LEFT) { resizer = new Resizer.LayeredPane.Left(cmp); } else if (wnd.getAnchor() == ToolWindowAnchor.RIGHT) { resizer = new Resizer.LayeredPane.Right(cmp); } } } return resizer != null ? Pair.create(resizer, cmp) : null; }