@Override @UiThread public void actionPerformed(ActionEvent e) { LinkHandler.getValue("", "", 1); //simulated read to enforce cleanup } }).start();
private void clearGroupLinkBounds() { if (linkTargetIDs == null) return; for (Map.Entry<String, Boolean> o : linkTargetIDs.entrySet()) { if (o.getValue() == Boolean.TRUE) LinkHandler.clearBounds(container.getLayout(), o.getKey()); } }
/** Sets a key that can be linked to from any component. * @param layout The MigLayout instance * @param key The key to link to. This is the same as the ID in a component constraint. * @param x x * @param y y * @param width Width * @param height Height * @return If the value was changed */ public synchronized static boolean setBounds(Object layout, String key, int x, int y, int width, int height) { return setBounds(layout, key, x, y, width, height, false, false); }
private void resetLinkValues(boolean parentSize, boolean compLinks) { Object lay = container.getLayout(); if (compLinks) LinkHandler.clearTemporaryBounds(lay); boolean defIns = !hasDocks(); int parW = parentSize ? lc.getWidth().constrain(container.getWidth(), getParentSize(container, true), container) : 0; int parH = parentSize ? lc.getHeight().constrain(container.getHeight(), getParentSize(container, false), container) : 0; int insX = LayoutUtil.getInsets(lc, 0, defIns).getPixels(0, container, null); int insY = LayoutUtil.getInsets(lc, 1, defIns).getPixels(0, container, null); int visW = parW - insX - LayoutUtil.getInsets(lc, 2, defIns).getPixels(0, container, null); int visH = parH - insY - LayoutUtil.getInsets(lc, 3, defIns).getPixels(0, container, null); LinkHandler.setBounds(lay, "visual", insX, insY, visW, visH, true, false); LinkHandler.setBounds(lay, "container", 0, 0, parW, parH, true, false); }
int[] dockInsets = null; // top, left, bottom, right insets for docks. LinkHandler.clearTemporaryBounds(container.getLayout());
Integer st = LinkHandler.getValue(parent.getLayout(), "visual", isHor ? LinkHandler.X : LinkHandler.Y); Integer sz = LinkHandler.getValue(parent.getLayout(), "visual", isHor ? LinkHandler.WIDTH : LinkHandler.HEIGHT); if (st == null || sz == null) return 0; case LINK_XPOS: case LINK_YPOS: Integer v = LinkHandler.getValue(parent.getLayout(), getLinkTargetId(), unit - (unit >= LINK_XPOS ? LINK_XPOS : LINK_X)); if (v == null) return 0;
/** * @param cw Never <code>null</code>. * @param cc Never <code>null</code>. * @param external The bounds should be stored even if they are not in {@link #linkTargetIDs}. * @return If a change has been made. */ private boolean setLinkedBounds(ComponentWrapper cw, CC cc, int x, int y, int w, int h, boolean external) { String id = cc.getId() != null ? cc.getId() : cw.getLinkId(); if (id == null) return false; String gid = null; int grIx = id.indexOf('.'); if (grIx != -1 ) { gid = id.substring(0, grIx); id = id.substring(grIx + 1); } Object lay = container.getLayout(); boolean changed = false; if (external || (linkTargetIDs != null && linkTargetIDs.containsKey(id))) changed = LinkHandler.setBounds(lay, id, x, y, w, h, !external, false); if (gid != null && (external || (linkTargetIDs != null && linkTargetIDs.containsKey(gid)))) { if (linkTargetIDs == null) linkTargetIDs = new HashMap<String, Boolean>(4); linkTargetIDs.put(gid, Boolean.TRUE); changed |= LinkHandler.setBounds(lay, gid, x, y, w, h, !external, true); } return changed; }