public GridBagLayoutModel(GridBagLayoutModel layoutModel) { this.title = layoutModel.title; this.id = layoutModel.id; this.icon = layoutModel.icon; this.constraints = new LinkedHashMap<>(layoutModel.constraints.size()); Iterator<LayoutConstraints> enumVal = layoutModel.constraints.keySet().iterator(); while (enumVal.hasNext()) { this.constraints.put(enumVal.next().copy(), null); } }
public DragLayoutElement(LayoutConstraints constraints, Component component) { if (constraints == null || component == null) { throw new IllegalArgumentException("Arguments cannot be null"); //$NON-NLS-1$ } this.constraints = constraints; this.originalConstraints = constraints.copy(); this.component = component; this.originalBound = component.getBounds(); }
private void adaptLayoutModel(GridBagLayoutModel layoutModel) { final Map<LayoutConstraints, Component> oldMap = layoutModel.getConstraints(); final Map<LayoutConstraints, Component> map = new LinkedHashMap<>(oldMap.size()); this.layoutModel = new GridBagLayoutModel(map, "exp_tmp", ""); //$NON-NLS-1$ //$NON-NLS-2$ Iterator<LayoutConstraints> enumVal = oldMap.keySet().iterator(); while (enumVal.hasNext()) { LayoutConstraints e = enumVal.next(); Component v = oldMap.get(e); LayoutConstraints constraint = e.copy(); if (v instanceof ViewCanvas) { ExportImage<?> export = new ExportImage<>((ViewCanvas) v); export.getInfoLayer().setBorder(3); map.put(constraint, export); v = export; } else { // Non printable component. Create a new empty panel to not steel the component from the original UI v = new JPanel(); map.put(constraint, v); } grid.add(v, e); } grid.revalidate(); }
Entry<LayoutConstraints, Component> entry = enumVal.next(); if (entry.getValue().equals(defaultView2d.getJComponent())) { GridBagConstraints c = entry.getKey().copy(); c.weightx = 1.0; c.weighty = 1.0;