Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
286,800
void (final int fill) { if ( fill != FILL_NONE && fill != FILL_HORIZONTAL && fill != FILL_VERTICAL && fill != FILL_BOTH ){ throw new IllegalArgumentException("invalid fill: " + fill); } myFill = fill; }
setFill
286,801
int () { return myIndent; }
getIndent
286,802
void (final int indent) { myIndent = indent; }
setIndent
286,803
boolean () { return myUseParentLayout; }
isUseParentLayout
286,804
void (final boolean useParentLayout) { myUseParentLayout = useParentLayout; }
setUseParentLayout
286,805
GridConstraints () { final GridConstraints copy = new GridConstraints(); copy.setRow(myRow); copy.setColumn(myColumn); copy.setColSpan(myColSpan); copy.setRowSpan(myRowSpan); copy.setVSizePolicy(myVSizePolicy); copy.setHSizePolicy(myHSizePolicy); copy.setFill(myFill); copy.setAnchor(myAnchor); copy.setIndent(myIndent); copy.setUseParentLayout(myUseParentLayout); copy.myMinimumSize.setSize(myMinimumSize); copy.myPreferredSize.setSize(myPreferredSize); copy.myMaximumSize.setSize(myMaximumSize); return copy; }
store
286,806
void (final GridConstraints constraints) { myRow = constraints.myRow; myColumn = constraints.myColumn; myRowSpan = constraints.myRowSpan; myColSpan = constraints.myColSpan; myHSizePolicy = constraints.myHSizePolicy; myVSizePolicy = constraints.myVSizePolicy; myFill = constraints.myFill; myAnchor = constraints.myAnchor; myIndent = constraints.myIndent; myUseParentLayout = constraints.myUseParentLayout; // Restore sizes myMinimumSize.setSize(constraints.myMinimumSize); myPreferredSize.setSize(constraints.myPreferredSize); myMaximumSize.setSize(constraints.myMaximumSize); }
restore
286,807
boolean (Object o) { if (this == o) return true; if (!(o instanceof GridConstraints)) return false; final GridConstraints gridConstraints = (GridConstraints)o; if (myAnchor != gridConstraints.myAnchor) return false; if (myColSpan != gridConstraints.myColSpan) return false; if (myColumn != gridConstraints.myColumn) return false; if (myFill != gridConstraints.myFill) return false; if (myHSizePolicy != gridConstraints.myHSizePolicy) return false; if (myRow != gridConstraints.myRow) return false; if (myRowSpan != gridConstraints.myRowSpan) return false; if (myVSizePolicy != gridConstraints.myVSizePolicy) return false; if (!Objects.equals(myMaximumSize, gridConstraints.myMaximumSize)) return false; if (!Objects.equals(myMinimumSize, gridConstraints.myMinimumSize)) return false; if (!Objects.equals(myPreferredSize, gridConstraints.myPreferredSize)) return false; if (myIndent != gridConstraints.myIndent) return false; if (myUseParentLayout != gridConstraints.myUseParentLayout) return false; return true; }
equals
286,808
int () { int result; result = myRow; result = 29 * result + myColumn; result = 29 * result + myRowSpan; result = 29 * result + myColSpan; result = 29 * result + myVSizePolicy; result = 29 * result + myHSizePolicy; result = 29 * result + myFill; result = 29 * result + myAnchor; result = 29 * result + (myMinimumSize != null ? myMinimumSize.hashCode() : 0); result = 29 * result + (myPreferredSize != null ? myPreferredSize.hashCode() : 0); result = 29 * result + (myMaximumSize != null ? myMaximumSize.hashCode() : 0); result = 29 * result + myIndent; result = 29 * result + (myUseParentLayout ? 1 : 0); return result; }
hashCode
286,809
int (final boolean isRow) { return isRow ? getRow() : getColumn(); }
getCell
286,810
void (final boolean isRow, final int value) { if (isRow) { setRow(value); } else { setColumn(value); } }
setCell
286,811
int (final boolean isRow) { return isRow ? getRowSpan() : getColSpan(); }
getSpan
286,812
void (final boolean isRow, final int value) { if (isRow) { setRowSpan(value); } else { setColSpan(value); } }
setSpan
286,813
boolean (final boolean isRow, final int cell) { if (isRow) { return cell >= myRow && cell < myRow + myRowSpan; } return cell >= myColumn && cell < myColumn + myColSpan; }
contains
286,814
String () { //noinspection HardCodedStringLiteral return "GridConstraints (row=" + myRow + ", col=" + myColumn + ", rowspan=" + myRowSpan + ", colspan=" + myColSpan + ")"; }
toString
286,815
void (final Component comp, final Object constraints) { final GridConstraints c = (GridConstraints)constraints; final int row = c.getRow(); final int rowSpan = c.getRowSpan(); final int rowCount = getRowCount(); if (row < 0 || row >= rowCount) { throw new IllegalArgumentException("wrong row: " + row); } if (row + rowSpan - 1 >= rowCount) { throw new IllegalArgumentException("wrong row span: " + rowSpan + "; row=" + row + " rowCount=" + rowCount); } final int column = c.getColumn(); final int colSpan = c.getColSpan(); final int columnCount = getColumnCount(); if (column < 0 || column >= columnCount) { throw new IllegalArgumentException("wrong column: " + column); } if (column + colSpan - 1 >= columnCount) { throw new IllegalArgumentException( "wrong col span: " + colSpan + "; column=" + column + " columnCount=" + columnCount); } super.addLayoutComponent(comp, constraints); }
addLayoutComponent
286,816
int () { return myRowStretches.length; }
getRowCount
286,817
int () { return myColumnStretches.length; }
getColumnCount
286,818
int (final int rowIndex) { return myRowStretches[rowIndex]; }
getRowStretch
286,819
void (final int rowIndex, final int stretch) { if (stretch < 1) { throw new IllegalArgumentException("wrong stretch: " + stretch); } myRowStretches[rowIndex] = stretch; }
setRowStretch
286,820
int (final int columnIndex) { return myColumnStretches[columnIndex]; }
getColumnStretch
286,821
void (final int columnIndex, final int stretch) { if (stretch < 1) { throw new IllegalArgumentException("wrong stretch: " + stretch); } myColumnStretches[columnIndex] = stretch; }
setColumnStretch
286,822
Dimension (final Container target) { return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); }
maximumLayoutSize
286,823
Dimension (final Container container) { validateInfos(container); // IMPORTANT!!! DO NOT INLINE!!! final DimensionInfo horizontalInfo = myHorizontalInfo; final DimensionInfo verticalInfo = myVerticalInfo; final Dimension result = getTotalGap(container, horizontalInfo, verticalInfo); final int[] widths = getMinSizes(horizontalInfo); if (mySameSizeHorizontally) { makeSameSizes(widths); } result.width += sum(widths); final int[] heights = getMinSizes(verticalInfo); if (mySameSizeVertically) { makeSameSizes(heights); } result.height += sum(heights); return result; }
minimumLayoutSize
286,824
void (int[] widths) { int max = widths[0]; for (int width : widths) { max = Math.max(width, max); } Arrays.fill(widths, max); }
makeSameSizes
286,825
int[] (DimensionInfo info, int totalWidth) { int[] widths = new int[info.getCellCount()]; int average = totalWidth / widths.length; int rest = totalWidth % widths.length; for (int i = 0; i < widths.length; i++) { widths[i] = average; if (rest > 0) { widths[i]++; rest--; } } return widths; }
getSameSizes
286,826
Dimension (final Container container) { validateInfos(container); // IMPORTANT!!! DO NOT INLINE!!! final DimensionInfo horizontalInfo = myHorizontalInfo; final DimensionInfo verticalInfo = myVerticalInfo; final Dimension result = getTotalGap(container, horizontalInfo, verticalInfo); final int[] widths = getPrefSizes(horizontalInfo); if (mySameSizeHorizontally) { makeSameSizes(widths); } result.width += sum(widths); final int[] heights = getPrefSizes(verticalInfo); if (mySameSizeVertically) { makeSameSizes(heights); } result.height += sum(heights); return result; }
preferredLayoutSize
286,827
int (final int[] ints) { int result = 0; for (int i = ints.length - 1; i >= 0; i--) { result += ints[i]; } return result; }
sum
286,828
Dimension (final Container container, final DimensionInfo hInfo, final DimensionInfo vInfo) { final Insets insets = getInsets(container); return new Dimension( insets.left + insets.right + countGap(hInfo, 0, hInfo.getCellCount()) + myMargin.left + myMargin.right, insets.top + insets.bottom + countGap(vInfo, 0, vInfo.getCellCount()) + myMargin.top + myMargin.bottom); }
getTotalGap
286,829
int (Container container) { while(container != null) { if (container instanceof JComponent) { Integer designTimeInsets = (Integer)((JComponent) container).getClientProperty(DESIGN_TIME_INSETS); if (designTimeInsets != null) { return designTimeInsets.intValue(); } } container = container.getParent(); } return 0; }
getDesignTimeInsets
286,830
Insets (Container container) { final Insets insets = container.getInsets(); int insetsValue = getDesignTimeInsets(container); if (insetsValue != 0) { return new Insets(insets.top+insetsValue, insets.left+insetsValue, insets.bottom+insetsValue, insets.right+insetsValue); } return insets; }
getInsets
286,831
int (final DimensionInfo info, final int startCell, final int cellCount) { int counter = 0; for (int cellIndex = startCell + cellCount - 2 /*gap after last cell should not be counted*/; cellIndex >= startCell; cellIndex--) { if (shouldAddGapAfterCell(info, cellIndex)) { counter++; } } return counter * info.getGap(); }
countGap
286,832
boolean (final DimensionInfo info, final int cellIndex) { if (cellIndex < 0 || cellIndex >= info.getCellCount()) { throw new IllegalArgumentException("wrong cellIndex: " + cellIndex + "; cellCount=" + info.getCellCount()); } boolean endsInThis = false; boolean startsInNext = false; int indexOfNextNotEmpty = -1; for (int i = cellIndex + 1; i < info.getCellCount(); i++) { if (!isCellEmpty(info, i)) { indexOfNextNotEmpty = i; break; } } for (int i = 0; i < info.getComponentCount(); i++) { final Component component = info.getComponent(i); if (component instanceof Spacer) { continue; } if (info.componentBelongsCell(i, cellIndex) && DimensionInfo.findAlignedChild(component, info.getConstraints(i)) != null) { return true; } if (info.getCell(i) == indexOfNextNotEmpty) { startsInNext = true; } if (info.getCell(i) + info.getSpan(i) - 1 == cellIndex) { endsInThis = true; } } return startsInNext && endsInThis; }
shouldAddGapAfterCell
286,833
boolean (final DimensionInfo info, final int cellIndex) { if (cellIndex < 0 || cellIndex >= info.getCellCount()) { throw new IllegalArgumentException("wrong cellIndex: " + cellIndex + "; cellCount=" + info.getCellCount()); } for (int i = 0; i < info.getComponentCount(); i++) { final Component component = info.getComponent(i); if (info.getCell(i) == cellIndex && !(component instanceof Spacer)) { return false; } } return true; }
isCellEmpty
286,834
void (final Container container) { validateInfos(container); // IMPORTANT!!! DO NOT INLINE!!! final LayoutState layoutState = myLayoutState; final DimensionInfo horizontalInfo = myHorizontalInfo; final DimensionInfo verticalInfo = myVerticalInfo; Insets insets = getInsets(container); int skipLayout = checkSetSizesFromParent(container, insets); final Dimension gap = getTotalGap(container, horizontalInfo, verticalInfo); final Dimension size = container.getSize(); size.width -= gap.width; size.height -= gap.height; final Dimension prefSize = preferredLayoutSize(container); prefSize.width -= gap.width; prefSize.height -= gap.height; final Dimension minSize = minimumLayoutSize(container); minSize.width -= gap.width; minSize.height -= gap.height; // Calculate rows' heights if ((skipLayout & SKIP_ROW) == 0) { final int[] heights; if (mySameSizeVertically) { heights = getSameSizes(verticalInfo, Math.max(size.height, minSize.height)); } else { if (size.height < prefSize.height) { heights = getMinSizes(verticalInfo); new_doIt(heights, 0, verticalInfo.getCellCount(), size.height, verticalInfo, true); } else { heights = getPrefSizes(verticalInfo); new_doIt(heights, 0, verticalInfo.getCellCount(), size.height, verticalInfo, false); } } // Calculate rows' bounds int y = insets.top + myMargin.top; for (int i = 0; i < heights.length; i++) { myYs[i] = y; myHeights[i] = heights[i]; y += heights[i]; if (shouldAddGapAfterCell(verticalInfo, i)) { y += verticalInfo.getGap(); } } } if ((skipLayout & SKIP_COL) == 0) { // Calculate columns' widths final int[] widths; if (mySameSizeHorizontally) { widths = getSameSizes(horizontalInfo, Math.max(size.width, minSize.width)); } else { if (size.width < prefSize.width) { widths = getMinSizes(horizontalInfo); new_doIt(widths, 0, horizontalInfo.getCellCount(), size.width, horizontalInfo, true); } else { widths = getPrefSizes(horizontalInfo); new_doIt(widths, 0, horizontalInfo.getCellCount(), size.width, horizontalInfo, false); } } // Calculate columns' bounds int x = insets.left + myMargin.left; for (int i = 0; i < widths.length; i++) { myXs[i] = x; myWidths[i] = widths[i]; x += widths[i]; if (shouldAddGapAfterCell(horizontalInfo, i)) { x += horizontalInfo.getGap(); } } } // Set bounds of components for (int i = 0; i < layoutState.getComponentCount(); i++) { final GridConstraints c = layoutState.getConstraints(i); final Component component = layoutState.getComponent(i); final int column = horizontalInfo.getCell(i); final int colSpan = horizontalInfo.getSpan(i); final int row = verticalInfo.getCell(i); final int rowSpan = verticalInfo.getSpan(i); final int cellWidth = myXs[column + colSpan - 1] + myWidths[column + colSpan - 1] - myXs[column]; final int cellHeight = myYs[row + rowSpan - 1] + myHeights[row + rowSpan - 1] - myYs[row]; final Dimension componentSize = new Dimension(cellWidth, cellHeight); if ((c.getFill() & GridConstraints.FILL_HORIZONTAL) == 0) { componentSize.width = Math.min(componentSize.width, horizontalInfo.getPreferredWidth(i)); } if ((c.getFill() & GridConstraints.FILL_VERTICAL) == 0) { componentSize.height = Math.min(componentSize.height, verticalInfo.getPreferredWidth(i)); } Util.adjustSize(component, c, componentSize); int dx = 0; int dy = 0; if ((c.getAnchor() & GridConstraints.ANCHOR_EAST) != 0) { dx = cellWidth - componentSize.width; } else if ((c.getAnchor() & GridConstraints.ANCHOR_WEST) == 0) { dx = (cellWidth - componentSize.width) / 2; } if ((c.getAnchor() & GridConstraints.ANCHOR_SOUTH) != 0) { dy = cellHeight - componentSize.height; } else if ((c.getAnchor() & GridConstraints.ANCHOR_NORTH) == 0) { dy = (cellHeight - componentSize.height) / 2; } int indent = Util.DEFAULT_INDENT * c.getIndent(); componentSize.width -= indent; dx += indent; component.setBounds(myXs[column] + dx, myYs[row] + dy, componentSize.width, componentSize.height); } }
layoutContainer
286,835
int (final Container container, final Insets insets) { int skipLayout = 0; GridLayoutManager parentGridLayout = null; GridConstraints parentGridConstraints = null; // "use parent layout" also needs to work in cases where a grid is the only control in a non-grid panel // which is contained in a grid Container parent = container.getParent(); if (parent != null) { if (parent.getLayout() instanceof GridLayoutManager) { parentGridLayout = (GridLayoutManager) parent.getLayout(); parentGridConstraints = parentGridLayout.getConstraintsForComponent(container); } else { Container parent2 = parent.getParent(); if (parent2 != null && parent2.getLayout() instanceof GridLayoutManager) { parentGridLayout = (GridLayoutManager) parent2.getLayout(); parentGridConstraints = parentGridLayout.getConstraintsForComponent(parent); } } } if (parentGridLayout != null && parentGridConstraints.isUseParentLayout()) { if (myRowStretches.length == parentGridConstraints.getRowSpan()) { int row = parentGridConstraints.getRow(); myYs[0] = insets.top + myMargin.top; myHeights[0] = parentGridLayout.myHeights[row] - myYs[0]; for (int i = 1; i < myRowStretches.length; i++) { myYs[i] = parentGridLayout.myYs[i + row] - parentGridLayout.myYs[row]; myHeights[i] = parentGridLayout.myHeights[i + row]; } myHeights[myRowStretches.length - 1] -= insets.bottom + myMargin.bottom; skipLayout |= SKIP_ROW; } if (myColumnStretches.length == parentGridConstraints.getColSpan()) { int col = parentGridConstraints.getColumn(); myXs[0] = insets.left + myMargin.left; myWidths[0] = parentGridLayout.myWidths[col] - myXs[0]; for (int i = 1; i < myColumnStretches.length; i++) { myXs[i] = parentGridLayout.myXs[i + col] - parentGridLayout.myXs[col]; myWidths[i] = parentGridLayout.myWidths[i + col]; } myWidths[myColumnStretches.length - 1] -= insets.right + myMargin.right; skipLayout |= SKIP_COL; } } return skipLayout; }
checkSetSizesFromParent
286,836
void (final Container container) { myLayoutState = null; myHorizontalInfo = null; myVerticalInfo = null; }
invalidateLayout
286,837
int[] () { return myXs; }
getXs
286,838
int[] () { return myWidths; }
getWidths
286,839
int[] () { return myYs; }
getYs
286,840
int[] () { return myHeights; }
getHeights
286,841
int[] (boolean isRow) { return isRow ? myYs : myXs; }
getCoords
286,842
int[] (boolean isRow) { return isRow ? myHeights : myWidths; }
getSizes
286,843
int[] (final DimensionInfo info) { return getMinOrPrefSizes(info, true); }
getMinSizes
286,844
int[] (final DimensionInfo info) { return getMinOrPrefSizes(info, false); }
getPrefSizes
286,845
int[] (final DimensionInfo info, final boolean min) { final int[] widths = new int[info.getCellCount()]; Arrays.fill(widths, myMinCellSize); // single spaned components for (int i = info.getComponentCount() - 1; i >= 0; i--) { if (info.getSpan(i) != 1) { continue; } int size = min ? getMin2(info, i) : Math.max(info.getMinimumWidth(i), info.getPreferredWidth(i)); int cell = info.getCell(i); final int gap = countGap(info, cell, info.getSpan(i)); size = Math.max(size - gap, 0); widths[cell] = Math.max(widths[cell], size); } // components inheriting layout from us updateSizesFromChildren(info, min, widths); // multispanned components final boolean[] toProcess = new boolean[info.getCellCount()]; for (int i = info.getComponentCount() - 1; i >= 0; i--) { int size = min ? getMin2(info, i) : Math.max(info.getMinimumWidth(i), info.getPreferredWidth(i)); final int span = info.getSpan(i); final int cell = info.getCell(i); final int gap = countGap(info, cell, span); size = Math.max(size - gap, 0); Arrays.fill(toProcess, false); int curSize = 0; for (int j=0; j < span; j++){ curSize += widths[j + cell]; toProcess[j + cell] = true; } if (curSize >= size) { continue; } final boolean[] higherPriorityCells = new boolean[toProcess.length]; getCellsWithHigherPriorities(info, toProcess, higherPriorityCells, false, widths); distribute(higherPriorityCells, info, size - curSize, widths); } return widths; }
getMinOrPrefSizes
286,846
void (final DimensionInfo info, final boolean min, final int[] widths) { for(int i=info.getComponentCount() - 1; i >= 0; i--) { Component child = info.getComponent(i); GridConstraints c = info.getConstraints(i); if (c.isUseParentLayout() && child instanceof Container) { Container container = (Container) child; if (container.getLayout() instanceof GridLayoutManager) { updateSizesFromChild(info, min, widths, container, i); } else if (container.getComponentCount() == 1 && container.getComponent(0) instanceof Container) { // "use parent layout" also needs to work in cases where a grid is the only control in a non-grid panel // which is contained in a grid Container childContainer = (Container) container.getComponent(0); if (childContainer.getLayout() instanceof GridLayoutManager) { updateSizesFromChild(info, min, widths, childContainer, i); } } } } }
updateSizesFromChildren
286,847
void (final DimensionInfo info, final boolean min, final int[] widths, final Container container, final int childIndex) { GridLayoutManager childLayout = (GridLayoutManager) container.getLayout(); if (info.getSpan(childIndex) == info.getChildLayoutCellCount(childLayout)) { childLayout.validateInfos(container); DimensionInfo childInfo = (info instanceof HorizontalInfo) ? childLayout.myHorizontalInfo : childLayout.myVerticalInfo; int[] sizes = childLayout.getMinOrPrefSizes(childInfo, min); int cell = info.getCell(childIndex); for(int j=0; j<sizes.length; j++) { widths [cell+j] = Math.max(widths [cell+j], sizes [j]); } } }
updateSizesFromChild
286,848
int (final DimensionInfo info, final int componentIndex) { final int s; if ((info.getSizePolicy(componentIndex) & GridConstraints.SIZEPOLICY_CAN_SHRINK) != 0) { s = info.getMinimumWidth(componentIndex); } else { // it might be possible that minSize > prefSize (for example, only min is set in constraints to 100 and // JComponent's preferred size returned is 20) s = Math.max(info.getMinimumWidth(componentIndex), info.getPreferredWidth(componentIndex)); } return s; }
getMin2
286,849
void (final int[] widths, final int cell, final int span, final int minWidth, final DimensionInfo info, final boolean checkPrefs) { int toDistribute = minWidth; for (int i = cell; i < cell + span; i++) { toDistribute -= widths[i]; } if (toDistribute <= 0) { return; } final boolean[] allowedCells = new boolean[info.getCellCount()]; for (int i = cell; i < cell + span; i++) { allowedCells[i] = true; } final boolean[] higherPriorityCells = new boolean[info.getCellCount()]; getCellsWithHigherPriorities(info, allowedCells, higherPriorityCells, checkPrefs, widths); distribute(higherPriorityCells, info, toDistribute, widths); }
new_doIt
286,850
void (final boolean[] higherPriorityCells, final DimensionInfo info, int toDistribute, final int[] widths) { int stretches = 0; for (int i = 0; i < info.getCellCount(); i++) { if (higherPriorityCells[i]) { stretches += info.getStretch(i); } } { final int toDistributeFrozen = toDistribute; for (int i = 0; i < info.getCellCount(); i++) { if (!higherPriorityCells[i]) { continue; } final int addon = toDistributeFrozen * info.getStretch(i) / stretches; widths[i] += addon; toDistribute -= addon; } } if (toDistribute != 0) { for (int i = 0; i < info.getCellCount(); i++) { if (!higherPriorityCells[i]) { continue; } widths[i]++; toDistribute--; if (toDistribute == 0) { break; } } } if (toDistribute != 0) { throw new IllegalStateException("toDistribute = " + toDistribute); } }
distribute
286,851
void ( final DimensionInfo info, final boolean[] allowedCells, final boolean[] higherPriorityCells, final boolean checkPrefs, final int[] widths ) { Arrays.fill(higherPriorityCells, false); int foundCells = 0; if (checkPrefs) { // less that preferred size final int[] prefs = getMinOrPrefSizes(info, false); for (int cell = 0; cell < allowedCells.length; cell++) { if (!allowedCells[cell]) { continue; } if (!isCellEmpty(info, cell) && prefs[cell] > widths[cell]) { higherPriorityCells[cell] = true; foundCells++; } } if (foundCells > 0) { return; } } // want grow for (int cell = 0; cell < allowedCells.length; cell++) { if (!allowedCells[cell]) { continue; } if ((info.getCellSizePolicy(cell) & GridConstraints.SIZEPOLICY_WANT_GROW) != 0) { higherPriorityCells[cell] = true; foundCells++; } } if (foundCells > 0) { return; } // can grow for (int cell = 0; cell < allowedCells.length; cell++) { if (!allowedCells[cell]) { continue; } if ((info.getCellSizePolicy(cell) & GridConstraints.SIZEPOLICY_CAN_GROW) != 0) { higherPriorityCells[cell] = true; foundCells++; } } if (foundCells > 0) { return; } // non empty for (int cell = 0; cell < allowedCells.length; cell++) { if (!allowedCells[cell]) { continue; } if (!isCellEmpty(info, cell)) { higherPriorityCells[cell] = true; foundCells++; } } if (foundCells > 0) { return; } // any for (int cell = 0; cell < allowedCells.length; cell++) { if (!allowedCells[cell]) { continue; } higherPriorityCells[cell] = true; } }
getCellsWithHigherPriorities
286,852
boolean () { return mySameSizeHorizontally; }
isSameSizeHorizontally
286,853
boolean () { return mySameSizeVertically; }
isSameSizeVertically
286,854
void (boolean sameSizeHorizontally) { mySameSizeHorizontally = sameSizeHorizontally; }
setSameSizeHorizontally
286,855
void (boolean sameSizeVertically) { mySameSizeVertically = sameSizeVertically; }
setSameSizeVertically
286,856
int[] () { return getGridLines(myYs, myHeights); }
getHorizontalGridLines
286,857
int[] () { return getGridLines(myXs, myWidths); }
getVerticalGridLines
286,858
int[] (int[] pos, int[] heights) { int[] result = new int [pos.length + 1]; result [0] = pos[0]; for(int i = 0; i < pos.length - 1; i++) { result [i+1] = (pos[i] + heights[i] + pos[i + 1]) / 2; } result [pos.length] = pos[pos.length - 1] + heights[pos.length - 1]; return result; }
getGridLines
286,859
int (final boolean isRow) { return isRow ? getRowCount() : getColumnCount(); }
getCellCount
286,860
int (final boolean isRow, final int cellIndex) { DimensionInfo info = isRow ? myVerticalInfo : myHorizontalInfo; if (info == null) { // not laid out yet return 0; } return info.getCellSizePolicy(cellIndex); }
getCellSizePolicy
286,861
TextWithMnemonic (String textWithMnemonic) { if (textWithMnemonic == null) { throw new IllegalArgumentException("textWithMnemonic cannot be null"); } // Parsing is copied from Presentation.setText(String, boolean) int index = -1; final StringBuilder plainText = new StringBuilder(); for (int i = 0; i < textWithMnemonic.length(); i++) { char ch = textWithMnemonic.charAt(i); if (ch == '&') { i++; if (i >= textWithMnemonic.length()) { break; } ch = textWithMnemonic.charAt(i); if (ch != '&') { index = plainText.length(); } } plainText.append(ch); } return new TextWithMnemonic(plainText.toString(), index); }
parseText
286,862
char () { if (myMnemonicIndex == -1) { throw new IllegalStateException("text doesn't contain mnemonic"); } return Character.toUpperCase(myText.charAt(myMnemonicIndex)); }
getMnemonicChar
286,863
void (JComponent component, int index) { try { Method method = component.getClass().getMethod("setDisplayedMnemonicIndex", int.class); method.setAccessible(true); method.invoke(component, Integer.valueOf(index)); } catch (Exception e) { // JDK earlier than 1.4 - do nothing } }
setDisplayedMnemonicIndex
286,864
Dimension (final Component component, final GridConstraints constraints, final boolean addIndent) { try { final Dimension size = getSize(constraints.myMinimumSize, component.getMinimumSize()); if (addIndent) { size.width += DEFAULT_INDENT * constraints.getIndent(); } return size; } catch (NullPointerException npe) { //IDEA-80722 return new Dimension(0, 0); } }
getMinimumSize
286,865
Dimension (final GridConstraints constraints, final boolean addIndent) { try { //[anton] we use only our property for maximum size. // JButton reports that its max size = pref size, so it is impossible to make a column of same sized buttons. // Probably there are other bad cases... final Dimension size = getSize(constraints.myMaximumSize, MAX_SIZE); if (addIndent && size.width < MAX_SIZE.width) { size.width += DEFAULT_INDENT * constraints.getIndent(); } return size; } catch (NullPointerException e) {//IDEA-80722 return new Dimension(0, 0); } }
getMaximumSize
286,866
Dimension (final Component component, final GridConstraints constraints, final boolean addIndent) { try { final Dimension size = getSize(constraints.myPreferredSize, component.getPreferredSize()); if (addIndent) { size.width += DEFAULT_INDENT * constraints.getIndent(); } return size; } catch (NullPointerException e) {//IDEA-80722 return new Dimension(0, 0); } }
getPreferredSize
286,867
Dimension (final Dimension overridenSize, final Dimension ownSize) { final int overridenWidth = overridenSize.width >= 0 ? overridenSize.width : ownSize.width; final int overridenHeight = overridenSize.height >= 0 ? overridenSize.height : ownSize.height; return new Dimension(overridenWidth, overridenHeight); }
getSize
286,868
void (final Component component, final GridConstraints constraints, final Dimension size) { final Dimension minimumSize = getMinimumSize(component, constraints, false); final Dimension maximumSize = getMaximumSize(constraints, false); size.width = Math.max(size.width, minimumSize.width); size.height = Math.max(size.height, minimumSize.height); size.width = Math.min(size.width, maximumSize.width); size.height = Math.min(size.height, maximumSize.height); }
adjustSize
286,869
int (final int[] cellIndices, final int[] spans, final ArrayList eliminated) { final int size = cellIndices.length; if (size != spans.length) { throw new IllegalArgumentException("size mismatch: " + size + ", " + spans.length); } if (eliminated != null && eliminated.size() != 0) { throw new IllegalArgumentException("eliminated must be empty"); } int cellCount = 0; for (int i = 0; i < size; i++) { cellCount = Math.max(cellCount, cellIndices[i] + spans[i]); } for (int cell = cellCount - 1; cell >= 0; cell--) { // check if we should eliminate cell boolean starts = false; boolean ends = false; for (int i = 0; i < size; i++) { if (cellIndices[i] == cell) { starts = true; } if (cellIndices[i] + spans[i] - 1 == cell) { ends = true; } } if (starts && ends) { continue; } if (eliminated != null) { eliminated.add(Integer.valueOf(cell)); } // eliminate cell for (int i = 0; i < size; i++) { final boolean decreaseSpan = cellIndices[i] <= cell && cell < cellIndices[i] + spans[i]; final boolean decreaseIndex = cellIndices[i] > cell; if (decreaseSpan) { spans[i]--; } if (decreaseIndex) { cellIndices[i]--; } } cellCount--; } return cellCount; }
eliminate
286,870
Insets () { return (Insets)myMargin.clone(); }
getMargin
286,871
int () { return myHGap; }
getHGap
286,872
int (Container container) { if(container==null){ throw new IllegalArgumentException("container cannot be null"); } while(container!=null){ if(container.getLayout() instanceof AbstractLayout){ final AbstractLayout layout=(AbstractLayout)container.getLayout(); if(layout.getHGap()!=-1){ return layout.getHGap(); } } container = container.getParent(); } return DEFAULT_HGAP; }
getHGapImpl
286,873
void (final int hGap) { if(hGap<-1){ throw new IllegalArgumentException("wrong hGap: "+hGap); } myHGap=hGap; }
setHGap
286,874
int () { return myVGap; }
getVGap
286,875
int (Container container) { if(container==null){ throw new IllegalArgumentException("container cannot be null"); } while(container!=null){ if(container.getLayout() instanceof AbstractLayout){ final AbstractLayout layout=(AbstractLayout)container.getLayout(); if(layout.getVGap() !=-1){ return layout.getVGap(); } } container = container.getParent(); } return DEFAULT_VGAP; }
getVGapImpl
286,876
void (final int vGap) { if(vGap<-1){ throw new IllegalArgumentException("wrong vGap: "+vGap); } myVGap=vGap; }
setVGap
286,877
void (final Insets margin) { if (margin == null) { throw new IllegalArgumentException("margin cannot be null"); } myMargin = (Insets)margin.clone(); }
setMargin
286,878
int () { return myComponents.length; }
getComponentCount
286,879
Component (final int index) { return myComponents[index]; }
getComponent
286,880
GridConstraints (final int index) { return myConstraints[index]; }
getConstraints
286,881
void (final Component comp, final Object constraints) { if (!(constraints instanceof GridConstraints)) { throw new IllegalArgumentException("constraints: " + constraints); } final Component[] newComponents = new Component[myComponents.length + 1]; System.arraycopy(myComponents, 0, newComponents, 0, myComponents.length); newComponents[myComponents.length] = comp; myComponents = newComponents; final GridConstraints[] newConstraints = new GridConstraints[myConstraints.length + 1]; System.arraycopy(myConstraints, 0, newConstraints, 0, myConstraints.length); newConstraints[myConstraints.length] = (GridConstraints)((GridConstraints)constraints).clone(); myConstraints = newConstraints; }
addLayoutComponent
286,882
void (final String name, final Component comp) { throw new UnsupportedOperationException(); }
addLayoutComponent
286,883
void (final Component comp) { final int i = getComponentIndex(comp); if (i == -1) { throw new IllegalArgumentException("component was not added: " + comp); } if (myComponents.length == 1) { myComponents = COMPONENT_EMPTY_ARRAY; } else { final Component[] newComponents = new Component[myComponents.length - 1]; System.arraycopy(myComponents, 0, newComponents, 0, i); System.arraycopy(myComponents, i + 1, newComponents, i, myComponents.length - i - 1); myComponents = newComponents; } if (myConstraints.length == 1) { myConstraints = GridConstraints.EMPTY_ARRAY; } else { final GridConstraints[] newConstraints = new GridConstraints[myConstraints.length - 1]; System.arraycopy(myConstraints, 0, newConstraints, 0, i); System.arraycopy(myConstraints, i + 1, newConstraints, i, myConstraints.length - i - 1); myConstraints = newConstraints; } }
removeLayoutComponent
286,884
GridConstraints (Component comp) { final int i = getComponentIndex(comp); if (i == -1) { throw new IllegalArgumentException("component was not added: " + comp); } return myConstraints[i]; }
getConstraintsForComponent
286,885
int (final Component comp) { for (int i = 0; i < myComponents.length; i++) { final Component component = myComponents[i]; if (component == comp) { return i; } } return -1; }
getComponentIndex
286,886
float (final Container container) { return 0.5f; }
getLayoutAlignmentX
286,887
float (final Container container) { return 0.5f; }
getLayoutAlignmentY
286,888
int () { return myComponents.length; }
getComponentCount
286,889
Component (final int index) { return myComponents[index]; }
getComponent
286,890
GridConstraints (final int index) { return myConstraints[index]; }
getConstraints
286,891
int () { return myColumnCount; }
getColumnCount
286,892
int () { return myRowCount; }
getRowCount
286,893
void (@NlsContexts.TabTitle String tabText) { myTabText = tabText; }
setTabText
286,894
String () { return myScopeText; }
getScopeText
286,895
void (@NotNull @NlsSafe String scopeText) { myScopeText = scopeText; }
setScopeText
286,896
boolean () { return myShowReadOnlyStatusAsRed; }
isShowReadOnlyStatusAsRed
286,897
void (boolean showReadOnlyStatusAsRed) { myShowReadOnlyStatusAsRed = showReadOnlyStatusAsRed; }
setShowReadOnlyStatusAsRed
286,898
void (@Nls String usagesString) { myUsagesString = usagesString; }
setUsagesString
286,899
String () { return myTargetsNodeText; }
getTargetsNodeText