protected void applyComponentStyle(JComponent comp) { Font font = getFont(); if (font != null) { comp.setFont(font); } CalculatedStyle style = getStyle(); FSColor foreground = style.getColor(); if (foreground != null) { comp.setForeground(toColor(foreground)); } FSColor background = style.getBackgroundColor(); if (background != null) { comp.setBackground(toColor(background)); } }
public void drawTextDecoration( RenderingContext c, InlineLayoutBox iB, TextDecoration decoration) { setColor(iB.getStyle().getColor()); Rectangle edge = iB.getContentAreaEdge(iB.getAbsX(), iB.getAbsY(), c); fillRect(edge.x, iB.getAbsY() + decoration.getOffset(), edge.width, decoration.getThickness()); }
public void drawTextDecoration( RenderingContext c, InlineLayoutBox iB, TextDecoration decoration) { setColor(iB.getStyle().getColor()); Rectangle edge = iB.getContentAreaEdge(iB.getAbsX(), iB.getAbsY(), c); fillRect(edge.x, iB.getAbsY() + decoration.getOffset(), edge.width, decoration.getThickness()); }
public void drawTextDecoration(RenderingContext c, LineBox lineBox) { setColor(lineBox.getStyle().getColor()); Box parent = lineBox.getParent(); List decorations = lineBox.getTextDecorations(); for (Iterator i = decorations.iterator(); i.hasNext(); ) { TextDecoration textDecoration = (TextDecoration)i.next(); if (parent.getStyle().isIdent( CSSName.FS_TEXT_DECORATION_EXTENT, IdentValue.BLOCK)) { fillRect( lineBox.getAbsX(), lineBox.getAbsY() + textDecoration.getOffset(), parent.getAbsX() + parent.getTx() + parent.getContentWidth() - lineBox.getAbsX(), textDecoration.getThickness()); } else { fillRect( lineBox.getAbsX(), lineBox.getAbsY() + textDecoration.getOffset(), lineBox.getContentWidth(), textDecoration.getThickness()); } } }
public void drawTextDecoration(RenderingContext c, LineBox lineBox) { setColor(lineBox.getStyle().getColor()); Box parent = lineBox.getParent(); List decorations = lineBox.getTextDecorations(); for (Iterator i = decorations.iterator(); i.hasNext(); ) { TextDecoration textDecoration = (TextDecoration)i.next(); if (parent.getStyle().isIdent( CSSName.FS_TEXT_DECORATION_EXTENT, IdentValue.BLOCK)) { fillRect( lineBox.getAbsX(), lineBox.getAbsY() + textDecoration.getOffset(), parent.getAbsX() + parent.getTx() + parent.getContentWidth() - lineBox.getAbsX(), textDecoration.getThickness()); } else { fillRect( lineBox.getAbsX(), lineBox.getAbsY() + textDecoration.getOffset(), lineBox.getContentWidth(), textDecoration.getThickness()); } } }
public static void paint(RenderingContext c, BlockBox box) { if (box.getMarkerData() == null) { return; } MarkerData markerData = box.getMarkerData(); if (markerData.getImageMarker() != null) { drawImage(c, box, markerData); } else { CalculatedStyle style = box.getStyle(); IdentValue listStyle = style.getIdent(CSSName.LIST_STYLE_TYPE); c.getOutputDevice().setColor(style.getColor()); if (markerData.getGlyphMarker() != null) { drawGlyph(c, box, style, listStyle); } else if (markerData.getTextMarker() != null){ drawText(c, box, listStyle); } } }
public static void paint(RenderingContext c, BlockBox box) { if (box.getMarkerData() == null) { return; } MarkerData markerData = box.getMarkerData(); if (markerData.getImageMarker() != null) { drawImage(c, box, markerData); } else { CalculatedStyle style = box.getStyle(); IdentValue listStyle = style.getIdent(CSSName.LIST_STYLE_TYPE); c.getOutputDevice().setColor(style.getColor()); if (markerData.getGlyphMarker() != null) { drawGlyph(c, box, style, listStyle); } else if (markerData.getTextMarker() != null){ drawText(c, box, listStyle); } } }
private static void drawText(RenderingContext c, BlockBox box, IdentValue listStyle) { MarkerData.TextMarker text = box.getMarkerData().getTextMarker(); int x = getReferenceX(c, box); x += -text.getLayoutWidth(); int y = getReferenceBaseline(c, box); c.getOutputDevice().setColor(box.getStyle().getColor()); c.getOutputDevice().setFont(box.getStyle().getFSFont(c)); c.getTextRenderer().drawString( c.getOutputDevice(), text.getText(), x, y); } }
private static void drawText(RenderingContext c, BlockBox box, IdentValue listStyle) { MarkerData.TextMarker text = box.getMarkerData().getTextMarker(); int x = getReferenceX(c, box); x += -text.getLayoutWidth(); int y = getReferenceBaseline(c, box); c.getOutputDevice().setColor(box.getStyle().getColor()); c.getOutputDevice().setFont(box.getStyle().getFSFont(c)); c.getTextRenderer().drawString( c.getOutputDevice(), text.getText(), x, y); } }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { PdfContentByte cb = outputDevice.getCurrentPage(); PdfWriter writer = outputDevice.getWriter(); PdfFormField field = PdfFormField.createCheckBox(writer); Element e = box.getElement(); String onValue = getValue(e); boolean checked = isChecked(e); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); FSColor color = box.getStyle().getColor(); FSColor darker = box.getEffBackgroundColor(c).darkenColor(); createAppearances(cb, field, onValue, width, height, true, color, darker); createAppearances(cb, field, onValue, width, height, false, color, darker); field.setWidget(outputDevice.createLocalTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT); field.setFieldName(getFieldName(outputDevice, e)); field.setBorderStyle(new PdfBorderDictionary(0.0f, 0)); field.setValueAsName(checked ? onValue : OFF_STATE); field.setAppearanceState(checked ? onValue : OFF_STATE); if (isReadOnly(e)) { field.setFieldFlags(PdfFormField.FF_READ_ONLY); } writer.addAnnotation(field); }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { PdfContentByte cb = outputDevice.getCurrentPage(); PdfWriter writer = outputDevice.getWriter(); PdfFormField field = PdfFormField.createCheckBox(writer); Element e = box.getElement(); String onValue = getValue(e); boolean checked = isChecked(e); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); FSColor color = box.getStyle().getColor(); FSColor darker = box.getEffBackgroundColor(c).darkenColor(); createAppearances(cb, field, onValue, width, height, true, color, darker); createAppearances(cb, field, onValue, width, height, false, color, darker); field.setWidget(outputDevice.createLocalTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT); field.setFieldName(getFieldName(outputDevice, e)); field.setBorderStyle(new PdfBorderDictionary(0.0f, 0)); field.setValueAsName(checked ? onValue : OFF_STATE); field.setAppearanceState(checked ? onValue : OFF_STATE); if (isReadOnly(e)) { field.setFieldFlags(PdfFormField.FF_READ_ONLY); } writer.addAnnotation(field); }
FSColor color = box.getStyle().getColor(); FSColor darker = box.getEffBackgroundColor(c).darkenColor(); createAppearances(cb, field, onValue, width, height, true, color, darker);
FSColor color = box.getStyle().getColor(); FSColor darker = box.getEffBackgroundColor(c).darkenColor(); createAppearances(cb, field, onValue, width, height, true, color, darker);
private void createAppearance(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field, String value) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont) box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); PdfAppearance tp2 = (PdfAppearance) tp.getDuplicate(); tp2.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp2, color); field.setDefaultAppearanceString(tp2); tp.beginVariableText(); tp.saveState(); tp.beginText(); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); setFillColor(tp, color); tp.setTextMatrix(0, height / 2 - (fontSize * 0.3f)); tp.showText(value); tp.endText(); tp.restoreState(); tp.endVariableText(); field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp); }
private void createAppearance(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field, String value) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont) box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); PdfAppearance tp2 = (PdfAppearance) tp.getDuplicate(); tp2.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp2, color); field.setDefaultAppearanceString(tp2); tp.beginVariableText(); tp.saveState(); tp.beginText(); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); setFillColor(tp, color); tp.setTextMatrix(0, height / 2 - (fontSize * 0.3f)); tp.showText(value); tp.endText(); tp.restoreState(); tp.endVariableText(); field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp); }