private Object readResolve() throws ObjectStreamException { return LayoutUtil.getSerializedObject(this); }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(in)); }
@Override public void writeExternal(ObjectOutput out) throws IOException { if (getClass() == MigLayout.class) LayoutUtil.writeAsXML(out, this); }
private Dimension getSizeImpl(Container parent, int sizeType) { checkCache(parent); Insets i = parent.getInsets(); int w = LayoutUtil.getSizeSafe(grid != null ? grid.getWidth() : null, sizeType) + i.left + i.right; int h = LayoutUtil.getSizeSafe(grid != null ? grid.getHeight() : null, sizeType) + i.top + i.bottom; return new Dimension(w, h); }
private void layoutInOneDim(int refSize, UnitValue align, boolean isRows, Float[] defaultPushWeights) boolean fromEnd = !(isRows ? lc.isTopToBottom() : LayoutUtil.isLeftToRight(lc, container)); DimConstraint[] primDCs = (isRows ? rowConstr : colConstr).getConstaints(); FlowSizeSpec fss = isRows ? rowFlowSpecs : colFlowSpecs; ArrayList<LinkedDimGroup>[] rowCols = isRows ? rowGroupLists : colGroupLists; int[] rowColSizes = LayoutUtil.calculateSerial(fss.sizes, fss.resConstsInclGaps, defaultPushWeights, LayoutUtil.PREF, refSize); if (LayoutUtil.isDesignTime(container)) { TreeSet<Integer> indexes = isRows ? rowIndexes : colIndexes; int[] ixArr = new int[indexes.size()]; int curPos = align != null ? align.getPixels(refSize - LayoutUtil.sum(rowColSizes), container, null) : 0; int groupSize = rowSize; if (group.span > 1) groupSize = LayoutUtil.sum(rowColSizes, bIx2, Math.min((group.span << 1) - 1, rowColSizes.length - bIx2 - 1));
/** Returns the creation string for this object. Note that {@link LayoutUtil#setDesignTime(ContainerWrapper, boolean)} must be * set to <code>true</code> for the creation strings to be stored. * @return The constraint string or <code>null</code> if none is registered. */ public final String getConstraintString() { return LayoutUtil.getCCString(this); }
/** Returns the debug millis. Combines the value from {@link net.miginfocom.layout.LC#getDebugMillis()} and {@link net.miginfocom.layout.LayoutUtil#getGlobalDebugMillis()} * @return The combined value. */ private int getDebugMillis() { int globalDebugMillis = LayoutUtil.getGlobalDebugMillis(); return globalDebugMillis > 0 ? globalDebugMillis : lc.getDebugMillis(); }
private static void layoutParallel(ContainerWrapper parent, ArrayList<CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, boolean fromEnd) { int[][] sizes = new int[compWraps.size()][]; // [compIx][gapBef,compSize,gapAft] for (int i = 0; i < sizes.length; i++) { CompWrap cw = compWraps.get(i); DimConstraint cDc = cw.cc.getDimConstraint(isHor); ResizeConstraint[] resConstr = new ResizeConstraint[] { cw.isPushGap(isHor, true) ? GAP_RC_CONST_PUSH : GAP_RC_CONST, cDc.resize, cw.isPushGap(isHor, false) ? GAP_RC_CONST_PUSH : GAP_RC_CONST, }; int[][] sz = new int[][] { cw.getGaps(isHor, true), cw.getSizes(isHor), cw.getGaps(isHor, false) }; Float[] pushW = dc.isFill() ? GROW_100 : null; sizes[i] = LayoutUtil.calculateSerial(sz, resConstr, pushW, LayoutUtil.PREF, size); } UnitValue rowAlign = dc.getAlignOrDefault(isHor); setCompWrapBounds(parent, sizes, compWraps, rowAlign, start, size, isHor, fromEnd); }
/** * @param prio The animation priority. When added with the general animation priority of the layout the animation will * be done if the resulting value is > 0. * @param durMillis Duration in milliseconds. <=0 means default value should be used and > 0 is the number of millis * @param easeIn 0 is linear (no ease). 1 is max ease. Always clamped between these values. * @param easeOut 0 is linear (no ease). 1 is max ease. Always clamped between these values. */ public AnimSpec(int prio, int durMillis, float easeIn, float easeOut) { this.prio = prio; this.durMillis = durMillis; this.easeIn = LayoutUtil.clamp(easeIn, 0, 1); this.easeOut = LayoutUtil.clamp(easeOut, 0, 1); }
@Override protected Point computeSize(Composite parent, int wHint, int hHint, boolean flushCache) { checkCache(parent); int w = LayoutUtil.getSizeSafe(grid != null ? grid.getWidth() : null, LayoutUtil.PREF); int h = LayoutUtil.getSizeSafe(grid != null ? grid.getHeight() : null, LayoutUtil.PREF); return new Point(w, h); }
/** Returns the a constraint string that can be re-parsed to be the exact same UnitValue. * @return A String. Never <code>null</code>. */ String getConstraintString() { String cs = LayoutUtil.getCCString(this); if (cs != null) return cs; if (min == pref && pref == max) return min != null ? (min.getConstraintString() + "!") : "null"; StringBuilder sb = new StringBuilder(16); if (min != null) sb.append(min.getConstraintString()).append(':'); if (pref != null) { if (min == null && max != null) sb.append(":"); sb.append(pref.getConstraintString()); } else if (min != null) { sb.append('n'); } if (max != null) sb.append(sb.length() == 0 ? "::" : ":").append(max.getConstraintString()); if (gapPush) { if (sb.length() > 0) sb.append(':'); sb.append("push"); } return sb.toString(); }
/** Returns the debug millis. Combines the value from {@link net.miginfocom.layout.LC#getDebugMillis()} and {@link net.miginfocom.layout.LayoutUtil#getGlobalDebugMillis()} * @return The combined value. */ private int getDebugMillis() { int globalDebugMillis = LayoutUtil.getGlobalDebugMillis(); return globalDebugMillis > 0 ? globalDebugMillis : lc.getDebugMillis(); }
private static void layoutSerial(ContainerWrapper parent, ArrayList<CompWrap> compWraps, DimConstraint dc, int start, int size, boolean isHor, int spanCount, boolean fromEnd) { FlowSizeSpec fss = mergeSizesGapsAndResConstrs( getComponentResizeConstraints(compWraps, isHor), getComponentGapPush(compWraps, isHor), getComponentSizes(compWraps, isHor), getGaps(compWraps, isHor)); Float[] pushW = dc.isFill() ? GROW_100 : null; int[] sizes = LayoutUtil.calculateSerial(fss.sizes, fss.resConstsInclGaps, pushW, LayoutUtil.PREF, size); setCompWrapBounds(parent, sizes, compWraps, dc.getAlignOrDefault(isHor), start, size, isHor, fromEnd); }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(in)); }
@Override public void writeExternal(ObjectOutput out) throws IOException { if (getClass() == AC.class) LayoutUtil.writeAsXML(out, this); } }
private Object readResolve() throws ObjectStreamException { return LayoutUtil.getSerializedObject(this); }
protected double computeHeight(double refWidth, int type) { int ins = getVerIns(); int refSize = (int) Math.ceil(refWidth != -1 ? refWidth : getWidth()) - ins; return ins + LayoutUtil.getSizeSafe(getGrid().getHeight(refSize), type); }
String cs = LayoutUtil.getCCString(insets); if (cs != null) { if (asAPI) {
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(in)); }
private void writeObject(ObjectOutputStream out) throws IOException { if (getClass() == UnitValue.class) LayoutUtil.writeAsXML(out, this); }