@Override public void writeComponent(Device d, SComponent c, SComponent p) throws IOException { if (c != null && p instanceof STable) { STable renderedTable = (STable) p; if (renderedTable.isEditing() && renderedTable.getEditorComponent() == c) { addComponent(c); c.write(d); } else { super.writeComponent(d, c, p); } } else { super.writeComponent(d, c, p); } } };
/** * Write a cell renderer component c to device d. Before the component * is drawn it's reparented to this (if that's neccessary). * The Component p is the component we're actually drawing on. */ public void writeComponent(Device d, SComponent c, SComponent p) throws IOException { if (getParent() == null) log.warn("SCellRendererPane: parent == null!"); if (getParentFrame() == null) log.warn("SCellRendererPane: parentFrame == null!"); if (c == null || !c.isVisible()) { return; } addComponent(c); c.write(d); remove(c); } }
/** * Construct a CellRendererPane object. */ public SCellRendererPane() { super(); setLayout(null); setVisible(false); }
public void removeCellRendererPane() { cellRendererPane.setParent(null); cellRendererPane = null; }
/** * Sets the frame in which this component resides. * * @param f the frame in which this component resides. */ @Override protected void setParentFrame(SFrame f) { super.setParentFrame(f); if (cellRendererPane != null) { cellRendererPane.setParentFrame(f); } }
@Override public void setParent(SContainer p) { super.setParent(p); if (cellRendererPane != null) { cellRendererPane.setParent(p); } }
@Override protected void setParentFrame(SFrame f) { super.setParentFrame(f); if (cellRendererPane != null) { cellRendererPane.setParentFrame(f); } }
private String writeSelectionBodies(List<Integer> indices, List<String> bodies) { try { final StringBuilderDevice htmlDevice = new StringBuilderDevice(512); final SCellRendererPane rendererPane = component.getCellRendererPane(); Rectangle currentViewport = component.getViewportSize(); int viewportOffset = 0; if (currentViewport != null) { viewportOffset += currentViewport.y; } for (Integer index : indices) { SComponent rowSelectionRenderer = getRowSelectionRenderer(component, index + viewportOffset); rendererPane.writeComponent(htmlDevice, rowSelectionRenderer, component); bodies.add(htmlDevice.toString()); htmlDevice.reset(); } } catch (Throwable t) { return t.getClass().getName(); } return null; } }
@Override public void setParent(SContainer p) { super.setParent(p); if (cellRendererPane != null) { cellRendererPane.setParent(p); } }
@Override protected void setParentFrame(SFrame f) { super.setParentFrame(f); if (cellRendererPane != null) { cellRendererPane.setParentFrame(f); } }
@MacroTag public static void cell(MacroContext context, int row, int col) throws IOException { Device device = context.getDevice(); SComponent component = context.getComponent(); // RenderHelper.getInstance(component).forbidCaching(); STable table = (STable) component; STableCellRenderer renderer = table.getCellRenderer(row, col); if (renderer != null) { SComponent cellComponent = table.prepareRenderer(renderer, row, col); SCellRendererPane rendererPane = table.getCellRendererPane(); rendererPane.writeComponent(device, cellComponent, table); } else { device.print(table.getValueAt(row, col)); } // RenderHelper.getInstance(component).allowCaching(); }
/** * Sets the container, this component resides in. * * @param p the container, this component resides in. */ @Override public void setParent(SContainer p) { super.setParent(p); if (cellRendererPane != null) { cellRendererPane.setParent(p); } if (editorComp != null) { editorComp.setParent(p); } }
@Override protected void setParentFrame(SFrame f) { super.setParentFrame(f); if (getCellRendererPane() != null) getCellRendererPane().setParentFrame(f); }
protected static void writeHeaderCell(final Device device, final STable table, final SCellRendererPane rendererPane, final int col) throws IOException { final SComponent comp = table.prepareHeaderRenderer(table.getHeaderRenderer(col), col); device.print("<th col=\""); device.print(col); device.print("\" class=\"head\""); Utils.printTableCellAlignment(device, comp, SConstants.CENTER, SConstants.CENTER); device.print(">"); rendererPane.writeComponent(device, comp, table); device.print("</th>"); Utils.printNewline(device, comp); }
@Override public void setParent(SContainer p) { super.setParent(p); if (getCellRendererPane() != null) getCellRendererPane().setParent(p); }
table.getCellRendererPane().writeComponent(device, component, table); htmlCode = device.toString(); } catch (Throwable t) {
table.getCellRendererPane().writeComponent(device, component, table); htmlCode = device.toString(); } catch (Throwable t) {
table.getCellRendererPane().writeComponent(device, component, table); htmlCode = device.toString();
table.getCellRendererPane().writeComponent(device, component, table); htmlCode = device.toString();
rendererPane.writeComponent(device, comp, table);