Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
282,900
int (int value) { value = JBUIScale.scale(value); return switch (UIUtil.getComponentStyle(myScrollBar)) { case LARGE -> (int)(value * 1.15); case SMALL -> (int)(value * 0.857); case MINI -> (int)(value * 0.714); case REGULAR -> value; }; }
scale
282,901
void (JComponent c) { myScrollBar = (JScrollBar)c; ScrollBarPainter.setBackground(c); myScrollBar.setOpaque(false); myScrollBar.setFocusable(false); myScrollBar.addMouseListener(myListener); myScrollBar.addMouseMotionListener(myListener); myScrollBar.getModel().addChangeListener(myListener); myScrollBar.addPropertyChangeListener(myListener); myScrollBar.addFocusListener(myListener); myScrollTimer.setInitialDelay(300); }
installUI
282,902
void (JComponent c) { myAnimationBehavior.onUninstall(); myScrollTimer.stop(); myScrollBar.removeFocusListener(myListener); myScrollBar.removePropertyChangeListener(myListener); myScrollBar.getModel().removeChangeListener(myListener); myScrollBar.removeMouseMotionListener(myListener); myScrollBar.removeMouseListener(myListener); myScrollBar.setForeground(null); myScrollBar.setBackground(null); myScrollBar = null; }
uninstallUI
282,903
Dimension (JComponent c) { int thickness = getThickness(); Alignment alignment = Alignment.get(c); Dimension preferred = new Dimension(thickness, thickness); if (alignment == Alignment.LEFT || alignment == Alignment.RIGHT) { preferred.height += preferred.height; addPreferredHeight(preferred, ComponentUtil.getClientProperty(myScrollBar, LEADING)); addPreferredHeight(preferred, ComponentUtil.getClientProperty(myScrollBar, TRAILING)); } else { preferred.width += preferred.width; addPreferredWidth(preferred, ComponentUtil.getClientProperty(myScrollBar, LEADING)); addPreferredWidth(preferred, ComponentUtil.getClientProperty(myScrollBar, TRAILING)); } return preferred; }
getPreferredSize
282,904
void (Dimension preferred, Component component) { if (component != null) { Dimension size = component.getPreferredSize(); preferred.width += size.width; if (preferred.height < size.height) preferred.height = size.height; } }
addPreferredWidth
282,905
void (Dimension preferred, Component component) { if (component != null) { Dimension size = component.getPreferredSize(); preferred.height += size.height; if (preferred.width < size.width) preferred.width = size.width; } }
addPreferredHeight
282,906
void (Graphics g, JComponent c) { Alignment alignment = Alignment.get(c); if (alignment != null && g instanceof Graphics2D) { Color background = !isOpaque(c) ? null : c.getBackground(); if (background != null) { g.setColor(background); g.fillRect(0, 0, c.getWidth(), c.getHeight()); } Rectangle bounds = new Rectangle(c.getWidth(), c.getHeight()); JBInsets.removeFrom(bounds, c.getInsets()); // process an area before the track Component leading = ComponentUtil.getClientProperty(c, LEADING); if (leading != null) { if (alignment == Alignment.LEFT || alignment == Alignment.RIGHT) { int size = leading.getPreferredSize().height; leading.setBounds(bounds.x, bounds.y, bounds.width, size); bounds.height -= size; bounds.y += size; } else { int size = leading.getPreferredSize().width; leading.setBounds(bounds.x, bounds.y, size, bounds.height); bounds.width -= size; bounds.x += size; } } // process an area after the track Component trailing = ComponentUtil.getClientProperty(c, TRAILING); if (trailing != null) { if (alignment == Alignment.LEFT || alignment == Alignment.RIGHT) { int size = trailing.getPreferredSize().height; bounds.height -= size; trailing.setBounds(bounds.x, bounds.y + bounds.height, bounds.width, size); } else { int size = trailing.getPreferredSize().width; bounds.width -= size; trailing.setBounds(bounds.x + bounds.width, bounds.y, size, bounds.height); } } // do not set track size bigger that expected thickness if (alignment == Alignment.LEFT || alignment == Alignment.RIGHT) { int offset = bounds.width - getThickness(); if (offset > 0) { bounds.width -= offset; if (alignment == Alignment.RIGHT) bounds.x += offset; } } else { int offset = bounds.height - getThickness(); if (offset > 0) { bounds.height -= offset; if (alignment == Alignment.BOTTOM) bounds.y += offset; } } boolean animate = !myTrack.bounds.equals(bounds); // animate thumb on resize if (animate) myTrack.bounds.setBounds(bounds); updateThumbBounds(animate); paintTrack((Graphics2D)g, c); // process additional drawing on the track RegionPainter<Object> track = ComponentUtil.getClientProperty(c, JBScrollBar.TRACK); if (track != null && myTrack.bounds.width > 0 && myTrack.bounds.height > 0) { track.paint((Graphics2D)g, myTrack.bounds.x, myTrack.bounds.y, myTrack.bounds.width, myTrack.bounds.height, null); } // process drawing the thumb if (myThumb.bounds.width > 0 && myThumb.bounds.height > 0) { paintThumb((Graphics2D)g, c); } } }
paint
282,907
void (boolean animate) { int value = 0; int min = myScrollBar.getMinimum(); int max = myScrollBar.getMaximum(); int range = max - min; if (range <= 0) { myThumb.bounds.setBounds(0, 0, 0, 0); } else if (VERTICAL == myScrollBar.getOrientation()) { int extent = myScrollBar.getVisibleAmount(); int height = Math.max(convert(myTrack.bounds.height, extent, range), 2 * getThickness()); if (myTrack.bounds.height <= height) { myThumb.bounds.setBounds(0, 0, 0, 0); } else { value = getValue(); int maxY = myTrack.bounds.y + myTrack.bounds.height - height; int y = (value < max - extent) ? convert(myTrack.bounds.height - height, value - min, range - extent) : maxY; myThumb.bounds.setBounds(myTrack.bounds.x, adjust(y, myTrack.bounds.y, maxY), myTrack.bounds.width, height); animate |= myOldValue != value; // animate thumb on move } } else { int extent = myScrollBar.getVisibleAmount(); int width = Math.max(convert(myTrack.bounds.width, extent, range), 2 * getThickness()); if (myTrack.bounds.width <= width) { myThumb.bounds.setBounds(0, 0, 0, 0); } else { value = getValue(); int maxX = myTrack.bounds.x + myTrack.bounds.width - width; int x = (value < max - extent) ? convert(myTrack.bounds.width - width, value - min, range - extent) : maxX; if (!myScrollBar.getComponentOrientation().isLeftToRight()) x = myTrack.bounds.x - x + maxX; myThumb.bounds.setBounds(adjust(x, myTrack.bounds.x, maxX), myTrack.bounds.y, width, myTrack.bounds.height); animate |= myOldValue != value; // animate thumb on move } } myOldValue = value; if (animate) myAnimationBehavior.onThumbMove(); }
updateThumbBounds
282,908
int () { return isValueCached ? myCachedValue : myScrollBar.getValue(); }
getValue
282,909
int (double newRange, double oldValue, double oldRange) { return (int)(.5 + newRange * oldValue / oldRange); }
convert
282,910
int (int value, int min, int max) { return Math.max(min, Math.min(value, max)); }
adjust
282,911
void (int x, int y) { if (isTrackContains(x, y)) { if (!isOverTrack) myAnimationBehavior.onTrackHover(isOverTrack = true); boolean hover = isThumbContains(x, y); if (isOverThumb != hover) myAnimationBehavior.onThumbHover(isOverThumb = hover); } else { updateMouseExit(); } }
updateMouse
282,912
void () { if (isOverThumb) myAnimationBehavior.onThumbHover(isOverThumb = false); if (isOverTrack) myAnimationBehavior.onTrackHover(isOverTrack = false); }
updateMouseExit
282,913
boolean (MouseEvent event) { if (isTrackClickable()) return false; // redispatch current event to the view Container parent = myScrollBar.getParent(); if (parent instanceof JScrollPane pane) { Component view = pane.getViewport().getView(); if (view != null) { Point point = event.getLocationOnScreen(); SwingUtilities.convertPointFromScreen(point, view); Component target = SwingUtilities.getDeepestComponentAt(view, point.x, point.y); MouseEventAdapter.redispatch(event, target); } } return true; }
redispatchIfTrackNotClickable
282,914
void (MouseEvent e) { if (myScrollBar != null && myScrollBar.isEnabled()) redispatchIfTrackNotClickable(e); }
mouseClicked
282,915
void (MouseEvent event) { if (myScrollBar == null || !myScrollBar.isEnabled()) return; if (redispatchIfTrackNotClickable(event)) return; if (SwingUtilities.isRightMouseButton(event)) return; isValueCached = true; myCachedValue = myScrollBar.getValue(); myScrollBar.setValueIsAdjusting(true); myMouseX = event.getX(); myMouseY = event.getY(); boolean vertical = VERTICAL == myScrollBar.getOrientation(); if (isThumbContains(myMouseX, myMouseY)) { // pressed on the thumb myOffset = vertical ? (myMouseY - myThumb.bounds.y) : (myMouseX - myThumb.bounds.x); isDragging = true; } else if (isTrackContains(myMouseX, myMouseY)) { // pressed on the track if (isAbsolutePositioning(event)) { myOffset = (vertical ? myThumb.bounds.height : myThumb.bounds.width) / 2; isDragging = true; setValueFrom(event); } else { myScrollTimer.stop(); isDragging = false; if (VERTICAL == myScrollBar.getOrientation()) { int y = myThumb.bounds.isEmpty() ? myScrollBar.getHeight() / 2 : myThumb.bounds.y; isReversed = myMouseY < y; } else { int x = myThumb.bounds.isEmpty() ? myScrollBar.getWidth() / 2 : myThumb.bounds.x; isReversed = myMouseX < x; if (!myScrollBar.getComponentOrientation().isLeftToRight()) { isReversed = !isReversed; } } scroll(isReversed); startScrollTimerIfNecessary(); } } }
mousePressed
282,916
void (MouseEvent event) { if (isDragging) updateMouse(event.getX(), event.getY()); if (myScrollBar == null || !myScrollBar.isEnabled()) return; if (redispatchIfTrackNotClickable(event)) return; if (SwingUtilities.isRightMouseButton(event)) return; isDragging = false; myOffset = 0; myScrollTimer.stop(); isValueCached = true; myCachedValue = myScrollBar.getValue(); myScrollBar.setValueIsAdjusting(false); repaint(); }
mouseReleased
282,917
void (MouseEvent event) { if (myScrollBar == null || !myScrollBar.isEnabled()) return; if (myThumb.bounds.isEmpty() || SwingUtilities.isRightMouseButton(event)) return; if (isDragging) { setValueFrom(event); } else { myMouseX = event.getX(); myMouseY = event.getY(); updateMouse(myMouseX, myMouseY); startScrollTimerIfNecessary(); } }
mouseDragged
282,918
void (MouseEvent event) { if (myScrollBar == null || !myScrollBar.isEnabled()) return; if (!isDragging) updateMouse(event.getX(), event.getY()); }
mouseMoved
282,919
void (MouseEvent event) { if (myScrollBar == null || !myScrollBar.isEnabled()) return; if (!isDragging) updateMouseExit(); }
mouseExited
282,920
void (ActionEvent event) { if (myScrollBar == null) { myScrollTimer.stop(); } else { scroll(isReversed); if (!myThumb.bounds.isEmpty()) { if (isReversed ? !isMouseBeforeThumb() : !isMouseAfterThumb()) { myScrollTimer.stop(); } } int value = myScrollBar.getValue(); if (isReversed ? value <= myScrollBar.getMinimum() : value >= myScrollBar.getMaximum() - myScrollBar.getVisibleAmount()) { myScrollTimer.stop(); } } }
actionPerformed
282,921
void (FocusEvent event) { repaint(); }
focusGained
282,922
void (FocusEvent event) { repaint(); }
focusLost
282,923
void (ChangeEvent event) { updateThumbBounds(false); // TODO: update mouse isValueCached = false; repaint(); }
stateChanged
282,924
void (PropertyChangeEvent event) { String name = event.getPropertyName(); if ("model".equals(name)) { BoundedRangeModel oldModel = (BoundedRangeModel)event.getOldValue(); BoundedRangeModel newModel = (BoundedRangeModel)event.getNewValue(); oldModel.removeChangeListener(this); newModel.addChangeListener(this); } if ("model".equals(name) || "orientation".equals(name) || "componentOrientation".equals(name)) { repaint(); } if ("opaque".equals(name) || "visible".equals(name)) { myAnimationBehavior.onReset(); myTrack.bounds.setBounds(0, 0, 0, 0); myThumb.bounds.setBounds(0, 0, 0, 0); } }
propertyChange
282,925
void (MouseEvent event) { int x = event.getX(); int y = event.getY(); int thumbMin, thumbMax, thumbPos; if (VERTICAL == myScrollBar.getOrientation()) { thumbMin = myTrack.bounds.y; thumbMax = myTrack.bounds.y + myTrack.bounds.height - myThumb.bounds.height; thumbPos = MathUtil.clamp(y - myOffset, thumbMin, thumbMax); if (myThumb.bounds.y != thumbPos) { int minY = Math.min(myThumb.bounds.y, thumbPos); int maxY = Math.max(myThumb.bounds.y, thumbPos) + myThumb.bounds.height; myThumb.bounds.y = thumbPos; myAnimationBehavior.onThumbMove(); repaint(myThumb.bounds.x, minY, myThumb.bounds.width, maxY - minY); } } else { thumbMin = myTrack.bounds.x; thumbMax = myTrack.bounds.x + myTrack.bounds.width - myThumb.bounds.width; thumbPos = MathUtil.clamp(x - myOffset, thumbMin, thumbMax); if (myThumb.bounds.x != thumbPos) { int minX = Math.min(myThumb.bounds.x, thumbPos); int maxX = Math.max(myThumb.bounds.x, thumbPos) + myThumb.bounds.width; myThumb.bounds.x = thumbPos; myAnimationBehavior.onThumbMove(); repaint(minX, myThumb.bounds.y, maxX - minX, myThumb.bounds.height); } } int valueMin = myScrollBar.getMinimum(); int valueMax = myScrollBar.getMaximum() - myScrollBar.getVisibleAmount(); // If the thumb has reached the end of the scrollbar, then just set the value to its maximum. // Otherwise compute the value as accurately as possible. boolean isDefaultOrientation = VERTICAL == myScrollBar.getOrientation() || myScrollBar.getComponentOrientation().isLeftToRight(); if (thumbPos == thumbMax) { myScrollBar.setValue(isDefaultOrientation ? valueMax : valueMin); } else { int valueRange = valueMax - valueMin; int thumbRange = thumbMax - thumbMin; int thumbValue = isDefaultOrientation ? thumbPos - thumbMin : thumbMax - thumbPos; isValueCached = true; myCachedValue = valueMin + convert(valueRange, thumbValue, thumbRange); myScrollBar.setValue(myCachedValue); } if (!isDragging) updateMouse(x, y); }
setValueFrom
282,926
void () { if (!myScrollTimer.isRunning()) { if (isReversed ? isMouseBeforeThumb() : isMouseAfterThumb()) { myScrollTimer.start(); } } }
startScrollTimerIfNecessary
282,927
boolean () { return VERTICAL == myScrollBar.getOrientation() ? isMouseOnTop() : myScrollBar.getComponentOrientation().isLeftToRight() ? isMouseOnLeft() : isMouseOnRight(); }
isMouseBeforeThumb
282,928
boolean () { return VERTICAL == myScrollBar.getOrientation() ? isMouseOnBottom() : myScrollBar.getComponentOrientation().isLeftToRight() ? isMouseOnRight() : isMouseOnLeft(); }
isMouseAfterThumb
282,929
boolean () { return myMouseY < myThumb.bounds.y; }
isMouseOnTop
282,930
boolean () { return myMouseX < myThumb.bounds.x; }
isMouseOnLeft
282,931
boolean () { return myMouseX > myThumb.bounds.x + myThumb.bounds.width; }
isMouseOnRight
282,932
boolean () { return myMouseY > myThumb.bounds.y + myThumb.bounds.height; }
isMouseOnBottom
282,933
void (boolean reversed) { int delta = myScrollBar.getBlockIncrement(reversed ? -1 : 1); if (reversed) delta = -delta; int oldValue = myScrollBar.getValue(); int newValue = oldValue + delta; if (delta > 0 && newValue < oldValue) { newValue = myScrollBar.getMaximum(); } else if (delta < 0 && newValue > oldValue) { newValue = myScrollBar.getMinimum(); } if (oldValue != newValue) { myScrollBar.setValue(newValue); } }
scroll
282,934
JBBox () { return new JBBox(BoxLayout.Y_AXIS); }
createVerticalBox
282,935
JBBox () { return new JBBox(BoxLayout.X_AXIS); }
createHorizontalBox
282,936
AccessibleContext () { if (accessibleContext == null) { return new AccessibleJBBox(); } return accessibleContext; }
getAccessibleContext
282,937
AccessibleRole () { return AccessibleRole.PANEL; }
getAccessibleRole
282,938
ScrollBarAnimationBehavior () { return new MacScrollBarAnimationBehavior( new Computable<>() { @Override public JScrollBar compute() { return myScrollBar; } }, myTrack.animator, myThumb.animator); }
createBaseAnimationBehavior
282,939
JScrollBar () { return myScrollBar; }
compute
282,940
void (JComponent c) { super.installUI(c); updateStyle(Style.CURRENT.getValue()); processReferences(this, null, null); AWTEventListener listener = MOVEMENT_LISTENER.getAndSet(null); // add only one movement listener if (listener != null) Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.MOUSE_MOTION_EVENT_MASK); }
installUI
282,941
void (JComponent c) { processReferences(null, this, null); super.uninstallUI(c); }
uninstallUI
282,942
void (AWTEvent event) { if (event != null && MouseEvent.MOUSE_MOVED == event.getID()) { Object source = event.getSource(); if (source instanceof Component) { JScrollPane pane = ComponentUtil.getParentOfType((Class<? extends JScrollPane>)JScrollPane.class, (Component)source); if (pane != null) { pauseThumbAnimation(pane.getHorizontalScrollBar()); pauseThumbAnimation(pane.getVerticalScrollBar()); } } } }
eventDispatched
282,943
void (JScrollBar bar) { Object object = bar == null ? null : bar.getUI(); if (object instanceof MacScrollBarUI ui) { if (0 < ui.myAnimationBehavior.getThumbFrame()) ui.myAnimationBehavior.onThumbMove(); } }
pauseThumbAnimation
282,944
void (MacScrollBarUI toAdd, MacScrollBarUI toRemove, List<? super MacScrollBarUI> list) { synchronized (UI) { Iterator<Reference<MacScrollBarUI>> iterator = UI.iterator(); while (iterator.hasNext()) { Reference<MacScrollBarUI> reference = iterator.next(); MacScrollBarUI ui = reference.get(); if (ui == null || ui == toRemove) { iterator.remove(); } else if (list != null) { list.add(ui); } } if (toAdd != null) { UI.add(new WeakReference<>(toAdd)); } } }
processReferences
282,945
void (Style style) { if (myScrollBar != null) { myScrollBar.setOpaque(style != Style.Overlay); myScrollBar.revalidate(); myScrollBar.repaint(); myAnimationBehavior.onThumbMove(); } }
updateStyle
282,946
ID (String name, Pointer pointer, Callback callback) { ID delegateClass = allocateObjcClassPair(getObjcClass("NSObject"), name); if (!ID.NIL.equals(delegateClass)) { if (!addMethod(delegateClass, pointer, callback, "v@")) { throw new RuntimeException("Cannot add observer method"); } registerObjcClassPair(delegateClass); } return invoke(name, "new"); }
createDelegate
282,947
Behavior () { ID defaults = invoke("NSUserDefaults", "standardUserDefaults"); invoke(defaults, "synchronize"); ID behavior = invoke(defaults, "boolForKey:", nsString("AppleScrollerPagingBehavior")); Behavior value = 1 == behavior.intValue() ? JumpToSpot : NextPage; Logger.getInstance(MacScrollBarUI.class).debug("scroll bar behavior ", value, " from ", behavior); return value; }
produce
282,948
String () { return "scroll bar behavior"; }
toString
282,949
void () { Style oldStyle = getValue(); if (SystemInfoRt.isMac && !Registry.is("ide.mac.disableMacScrollbars", false)) { super.run(); } Style newStyle = getValue(); if (newStyle != oldStyle) { List<MacScrollBarUI> list = new ArrayList<>(); processReferences(null, null, list); for (MacScrollBarUI ui : list) { ui.updateStyle(newStyle); } } }
run
282,950
Style () { ID style = invoke(getObjcClass("NSScroller"), "preferredScrollerStyle"); Style value = 1 == style.intValue() ? Overlay : Legacy; Logger.getInstance(MacScrollBarUI.class).debug("scroll bar style ", value, " from ", style); return value; }
produce
282,951
String () { return "scroll bar style"; }
toString
282,952
void (ID self, Pointer selector, ID event) { Logger.getInstance(MacScrollBarUI.class).debug("update ", this); EdtInvocationManager.invokeLaterIfNeeded(this); }
callback
282,953
void () { myValue = callMac(this); }
run
282,954
void () { }
onLoadingStart
282,955
void () { }
onLoadingFinish
282,956
boolean () { return Registry.is("idea.true.smooth.scrolling.interpolation", false); }
isInterpolationEnabledByRegistry
282,957
void (Font font) { myText.setFont(font); }
setTextFont
282,958
void (@NlsContexts.Label String text) { myText.setText(text); }
setText
282,959
String () { return myText.getText(); }
getText
282,960
void (Icon icon) { myIcon.setIcon(icon); }
setIcon
282,961
Icon () { return myIcon.getIcon(); }
getIcon
282,962
void () { myIcon.setIcon(PlatformIcons.COMBOBOX_ARROW_ICON); }
setRegularIcon
282,963
void () { myIcon.setIcon(AllIcons.General.ArrowDown); }
setSelectionIcon
282,964
void (Color color) { super.setForeground(color); //noinspection ConstantConditions if (myText != null) { // null when called from the constructor of the superclass myText.setForeground(color); } }
setForeground
282,965
void (boolean enabled) { super.setEnabled(enabled); myText.setEnabled(enabled); myIcon.setEnabled(enabled); }
setEnabled
282,966
int () { final int columns = getColumnCount(); return columns == 0 ? 0 : getSize() / columns + 1; }
getRowCount
282,967
int () { return Math.min(myMaxColumns, getSize()); }
getColumnCount
282,968
int (int row, int column) { final int columns = getColumnCount(); return columns == 0 ? -1 : row * columns + column; }
toListIndex
282,969
int (int listIndex) { return listIndex % myMaxColumns; }
getColumn
282,970
int (int listIndex) { return listIndex / myMaxColumns; }
getRow
282,971
JComponent () { return myAnchor; }
getAnchor
282,972
void (@Nullable JComponent anchor) { this.myAnchor = anchor; }
setAnchor
282,973
Dimension () { Dimension size = super.getPreferredSize(); if (myAnchor != null && myAnchor != this) { Dimension anchorSize = myAnchor.getPreferredSize(); size.width = Math.max(size.width, anchorSize.width); size.height = Math.max(size.height, anchorSize.height); } return size; }
getPreferredSize
282,974
Dimension () { Dimension size = super.getMinimumSize(); if (myAnchor != null && myAnchor != this) { Dimension anchorSize = myAnchor.getMinimumSize(); size.width = Math.max(size.width, anchorSize.width); size.height = Math.max(size.height, anchorSize.height); } return size; }
getMinimumSize
282,975
boolean (@NotNull Icon icon) { if (StartupUiUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) { return false; } ButtonUI ui = getUI(); if (ui instanceof BasicRadioButtonUI) { Icon defaultIcon = ((BasicRadioButtonUI) ui).getDefaultIcon(); if (defaultIcon != null) { MergedIcon mergedIcon = new MergedIcon(defaultIcon, 10, icon); setIcon(mergedIcon); return true; } } return false; }
setTextIcon
282,976
void (Component c, Graphics g, int x, int y) { paintIconAlignedCenter(c, g, x, y, myLeftIcon); paintIconAlignedCenter(c, g, x + myLeftIcon.getIconWidth() + myHorizontalStrut, y, myRightIcon); }
paintIcon
282,977
void (Component c, Graphics g, int x, int y, @NotNull Icon icon) { int iconHeight = getIconHeight(); icon.paintIcon(c, g, x, y + (iconHeight - icon.getIconHeight()) / 2); }
paintIconAlignedCenter
282,978
int () { return myLeftIcon.getIconWidth() + myHorizontalStrut + myRightIcon.getIconWidth(); }
getIconWidth
282,979
int () { return Math.max(myLeftIcon.getIconHeight(), myRightIcon.getIconHeight()); }
getIconHeight
282,980
void () { super.removeNotify(); if (!ScreenUtil.isStandardAddRemoveNotify(this)) { return; } if (myBusyIcon != null) { remove(myBusyIcon); myBusyIcon.dispose(); myBusyIcon = null; } }
removeNotify
282,981
void () { super.doLayout(); if (myBusyIcon != null) { myBusyIcon.updateLocation(this); } }
doLayout
282,982
Graphics (Graphics graphics) { return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics)); }
getComponentGraphics
282,983
void (Graphics g) { super.paint(g); if (myBusyIcon != null) { myBusyIcon.updateLocation(this); } }
paint
282,984
void (long tm, int x, int y, int width, int height) { if (width > 0 && height > 0) { ListUI ui = getUI(); // do not paint a line background if the layout orientation is not vertical if (ui instanceof WideSelectionListUI && getLayoutOrientation() == JList.VERTICAL) { x = 0; width = getWidth(); } super.repaint(tm, x, y, width, height); } }
repaint
282,985
void (ListUI ui) { if (ui != null && Registry.is("ide.wide.selection.list.ui", true)) { Class<? extends ListUI> type = ui.getClass(); if (type == BasicListUI.class) { ui = new WideSelectionListUI(); } } super.setUI(ui); }
setUI
282,986
void (boolean paintBusy) { if (myBusy == paintBusy) return; myBusy = paintBusy; updateBusy(); }
setPaintBusy
282,987
void () { if (myBusy) { if (myBusyIcon == null) { myBusyIcon = new AsyncProcessIcon(toString()); myBusyIcon.setOpaque(false); myBusyIcon.setPaintPassiveIcon(false); add(myBusyIcon); } } //noinspection DuplicatedCode if (myBusyIcon != null) { if (myBusy) { myBusyIcon.resume(); } else { myBusyIcon.suspend(); SwingUtilities.invokeLater(() -> { if (myBusyIcon != null) { repaint(); } }); } if (myBusyIcon != null) { myBusyIcon.updateLocation(this); } } }
updateBusy
282,988
void (int index) { if (index != myDropTargetIndex) { myDropTargetIndex = index; repaint(); } }
setDropTargetIndex
282,989
void (@NotNull Function<? super Integer, Integer> offsetFromElementTopForDnD) { this.offsetFromElementTopForDnD = offsetFromElementTopForDnD; }
setOffsetFromElementTopForDnD
282,990
void (Graphics g) { super.paintComponent(g); myEmptyText.paint(this, g); if (myDropTargetIndex < 0) { return; } int dropLineY; Rectangle rc; if (myDropTargetIndex == getModel().getSize()) { rc = getCellBounds(myDropTargetIndex-1, myDropTargetIndex-1); dropLineY = (int)rc.getMaxY()-1; } else { rc = getCellBounds(myDropTargetIndex, myDropTargetIndex); dropLineY = rc.y + offsetFromElementTopForDnD.fun(myDropTargetIndex); } Graphics2D g2d = (Graphics2D) g; g2d.setColor(PlatformColors.BLUE); g2d.setStroke(new BasicStroke(2.0f)); g2d.drawLine(rc.x, dropLineY, rc.x+rc.width, dropLineY); g2d.drawLine(rc.x, dropLineY-2, rc.x, dropLineY+2); g2d.drawLine(rc.x+rc.width, dropLineY-2, rc.x+rc.width, dropLineY+2); }
paintComponent
282,991
Dimension () { Dimension s = getEmptyText().getPreferredSize(); JBInsets.addTo(s, getInsets()); Dimension size = super.getPreferredSize(); return new Dimension(Math.max(s.width, size.width), Math.max(s.height, size.height)); }
getPreferredSize
282,992
Dimension () { return super.getPreferredSize(); }
super_getPreferredSize
282,993
void () { setSelectionBackground(UIUtil.getListSelectionBackground(true)); setSelectionForeground(NamedColorUtil.getListSelectionForeground(true)); installDefaultCopyAction(); myEmptyText = new StatusText(this) { @Override protected boolean isStatusVisible() { return JBList.this.isEmpty(); } }; putClientProperty(UIUtil.NOT_IN_HIERARCHY_COMPONENTS, myEmptyText.getWrappedFragmentsIterable()); myExpandableItemsHandler = createExpandableItemsHandler(); setCellRenderer(new DefaultListCellRenderer()); }
init
282,994
boolean () { return JBList.this.isEmpty(); }
isStatusVisible
282,995
void () { final Action copy = getActionMap().get("copy"); if (copy == null || copy instanceof UIResource) { Action newCopy = new AbstractAction() { @Override public boolean isEnabled() { return getSelectedIndex() != -1; } @Override public void actionPerformed(ActionEvent e) { doCopyToClipboardAction(); } }; getActionMap().put("copy", newCopy); } }
installDefaultCopyAction
282,996
boolean () { return getSelectedIndex() != -1; }
isEnabled
282,997
void (ActionEvent e) { doCopyToClipboardAction(); }
actionPerformed
282,998
void () { ArrayList<String> selected = new ArrayList<>(); for (int index : getSelectedIndices()) { E value = getModel().getElementAt(index); String text = itemToText(index, value); if (text != null) selected.add(text); } if (selected.size() > 0) { String text = StringUtil.join(selected, "\n"); CopyPasteManager.getInstance().setContents(new StringSelection(text)); } }
doCopyToClipboardAction
282,999
boolean () { return getItemsCount() == 0; }
isEmpty