@Override public LayoutConstraints copy() { return new LayoutConstraints(this); }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if ("element".equals(qName)) { //$NON-NLS-1$ increment++; LayoutConstraints c = new LayoutConstraints(type, increment, x, y, width, height, weightx, weighty, position, expand); c.setColor(color); constraints.put(c, null); name.setLength(0); tag = -1; } }
public GridBagLayoutModel(String id, String title, int rows, int cols, String defaultClass) { this.title = title; this.id = id; this.constraints = new LinkedHashMap<>(cols * rows); double weightx = 1.0 / cols; double weighty = 1.0 / rows; for (int y = 0; y < rows; y++) { for (int x = 0; x < cols; x++) { constraints.put(new LayoutConstraints(defaultClass, y * cols + cols, x, y, 1, 1, weightx, weighty, GridBagConstraints.CENTER, GridBagConstraints.BOTH), null); } } this.icon = buildIcon(); }
private void adaptLayoutModel(ViewCanvas<E> viewCanvas) { final Map<LayoutConstraints, Component> map = new LinkedHashMap<>(1); this.layoutModel = new GridBagLayoutModel(map, "exp_tmp", ""); //$NON-NLS-1$ //$NON-NLS-2$ ExportImage<E> export = new ExportImage<>(viewCanvas); export.getInfoLayer().setBorder(3); LayoutConstraints e = new LayoutConstraints(viewCanvas.getClass().getName(), 0, 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH); map.put(e, export); grid.add(export, e); grid.revalidate(); }