# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /space/work/all/openide # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: text/src/org/openide/text/PrintSettings.java *** /space/work/all/openide/text/src/org/openide/text/PrintSettings.java Base (1.3) --- /space/work/all/openide/text/src/org/openide/text/PrintSettings.java Locally Deleted *************** *** 1,457 **** - /* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - package org.openide.text; - - import org.openide.options.ContextSystemOption; - import org.openide.util.HelpCtx; - import org.openide.util.NbBundle; - - import java.awt.Font; - import java.awt.print.PageFormat; - import java.awt.print.Paper; - import java.awt.print.PrinterJob; - - import java.io.IOException; - import java.io.ObjectInput; - import java.io.ObjectOutput; - - /** Settings for output window. - * - * @author Ales Novak - */ - public final class PrintSettings extends ContextSystemOption { - // final because overrides Externalizable methods - - /** serialVersionUID */ - static final long serialVersionUID = -9102470021814206818L; - - /** Constant for center position of page header. */ - public static final int CENTER = 0x1; - - /** Constant for right position of page header. */ - public static final int RIGHT = 0x2; - - /** Constant for left position of page header. */ - public static final int LEFT = 0x0; - - /** Property name of the wrap property */ - public static final String PROP_PAGE_FORMAT = "pageFormat"; // NOI18N - - /** Property name of the wrap property */ - public static final String PROP_WRAP = "wrap"; // NOI18N - - /** Property name of the header format property */ - public static final String PROP_HEADER_FORMAT = "headerFormat"; // NOI18N - - /** Property name of the footer format property */ - public static final String PROP_FOOTER_FORMAT = "footerFormat"; // NOI18N - - /** Property name of the header font property */ - public static final String PROP_HEADER_FONT = "headerFont"; // NOI18N - - /** Property name of the footer font property */ - public static final String PROP_FOOTER_FONT = "footerFont"; // NOI18N - - /** Property name of the header alignment property */ - public static final String PROP_HEADER_ALIGNMENT = "headerAlignment"; // NOI18N - - /** Property name of the footer alignment property */ - public static final String PROP_FOOTER_ALIGNMENT = "footerAlignment"; // NOI18N - - /** Property name of the line ascent correction property */ - public static final String PROP_LINE_ASCENT_CORRECTION = "lineAscentCorrection"; // NOI18N - private static final String HELP_ID = "editing.printing"; // !!! NOI18N - - /** PageFormat */ - private static PageFormat pageFormat; - - /** Wrap lines? */ - private static boolean wrap = true; - - /** Header format - see MessageFormat */ - private static String headerFormat; - - /** Footer format - see MessageFormat */ - private static String footerFormat; - - /** Header font */ - private static Font headerFont; - - /** Footer font */ - private static Font footerFont; - - /** Header alignment */ - private static int headerAlignment = CENTER; - - /** Footer alignment */ - private static int footerAlignment = CENTER; - - /** Line ascent correction parameter. Ranged from 0 to infinity.*/ - private static float lineAscentCorrection = 1.0f; - - /** Externalizes this SystemOption - * @param obtos - * @exception IOException - */ - public void writeExternal(ObjectOutput obtos) throws IOException { - super.writeExternal(obtos); - obtos.writeBoolean(wrap); - obtos.writeObject(headerFormat); - obtos.writeObject(footerFormat); - obtos.writeObject(headerFont); - obtos.writeObject(footerFont); - obtos.writeInt(headerAlignment); - obtos.writeInt(footerAlignment); - externalizePageFormat(pageFormat, obtos); - } - - /** Deexetrnalizes this SystemOption - * @param obtis - * @exception IOException - * @exception ClassNotFoundException - */ - public void readExternal(ObjectInput obtis) throws IOException, ClassNotFoundException { - super.readExternal(obtis); - wrap = obtis.readBoolean(); - headerFormat = (String) obtis.readObject(); - footerFormat = (String) obtis.readObject(); - headerFont = (Font) obtis.readObject(); - footerFont = (Font) obtis.readObject(); - headerAlignment = obtis.readInt(); - footerAlignment = obtis.readInt(); - pageFormat = internalizePageFormat(obtis); - } - - /** Writes a PageFormat instance into ObjectOutput - * @param pf - * @param obtos - */ - private static void externalizePageFormat(PageFormat pf, ObjectOutput obtos) - throws IOException { - if (pf == null) { - obtos.writeInt(PageFormat.LANDSCAPE ^ PageFormat.REVERSE_LANDSCAPE ^ PageFormat.PORTRAIT); - - return; - } - - obtos.writeInt(pf.getOrientation()); - - Paper paper = pf.getPaper(); - - // paper size - obtos.writeDouble(paper.getWidth()); - obtos.writeDouble(paper.getHeight()); - - // paper imageable area - obtos.writeDouble(paper.getImageableX()); - obtos.writeDouble(paper.getImageableY()); - obtos.writeDouble(paper.getImageableWidth()); - obtos.writeDouble(paper.getImageableHeight()); - } - - /** Reads a PageFormat instance from ObjectInput - * @param obtis - * @return deserialized PageFormat instance - */ - private static PageFormat internalizePageFormat(ObjectInput obtis) - throws IOException, ClassNotFoundException { - PageFormat pf = new PageFormat(); - Paper paper = pf.getPaper(); - int etc = obtis.readInt(); - - if (etc == (PageFormat.LANDSCAPE ^ PageFormat.REVERSE_LANDSCAPE ^ PageFormat.PORTRAIT)) { - return null; - } - - pf.setOrientation(etc); - - // paper size - paper.setSize(obtis.readDouble(), obtis.readDouble()); - - // imageable - paper.setImageableArea(obtis.readDouble(), obtis.readDouble(), obtis.readDouble(), obtis.readDouble()); - pf.setPaper(paper); - - return pf; - } - - public String displayName() { - return NbBundle.getMessage(PrintSettings.class, "CTL_Print_settings"); - } - - public HelpCtx getHelpCtx() { - return new HelpCtx(HELP_ID); - } - - /** @return an instance of PageFormat - * The returned page format is either previously set by - * PageSetupAction or is acquired as a default PageFormat - * from supported PrinterJob - */ - public static PageFormat getPageFormat(PrinterJob pj) { - if (pageFormat == null) { - pageFormat = pj.defaultPage(); - } - - return pageFormat; - } - - /** @deprecated Use {@link #getPageFormat(PrinterJob)} instead. */ - @Deprecated - public PageFormat getPageFormat() { - if (pageFormat == null) { - PrinterJob pj = PrinterJob.getPrinterJob(); - pageFormat = pj.defaultPage(new PageFormat()); - pj.cancel(); - } - - return pageFormat; - } - - /** sets page format */ - public void setPageFormat(PageFormat pf) { - if (pf == null) { - return; - } - - if (pf.equals(pageFormat)) { - return; - } - - PageFormat old = pageFormat; - pageFormat = pf; - firePropertyChange(PROP_PAGE_FORMAT, old, pageFormat); - } - - public boolean getWrap() { - return wrap; - } - - public void setWrap(boolean b) { - if (wrap == b) { - return; - } - - wrap = b; - firePropertyChange(PROP_WRAP, (b ? Boolean.FALSE : Boolean.TRUE), (b ? Boolean.TRUE : Boolean.FALSE)); - } - - public String getHeaderFormat() { - if (headerFormat == null) { - headerFormat = NbBundle.getMessage(PrintSettings.class, "CTL_Header_format"); - } - - return headerFormat; - } - - public void setHeaderFormat(String s) { - if (s == null) { - return; - } - - if (s.equals(headerFormat)) { - return; - } - - String of = headerFormat; - headerFormat = s; - firePropertyChange(PROP_HEADER_FORMAT, of, headerFormat); - } - - public String getFooterFormat() { - if (footerFormat == null) { - footerFormat = NbBundle.getMessage(PrintSettings.class, "CTL_Footer_format"); - } - - return footerFormat; - } - - public void setFooterFormat(String s) { - if (s == null) { - return; - } - - if (s.equals(footerFormat)) { - return; - } - - String of = footerFormat; - footerFormat = s; - firePropertyChange(PROP_FOOTER_FORMAT, of, footerFormat); - } - - public Font getHeaderFont() { - if (headerFont == null) { - headerFont = new Font("Monospaced", java.awt.Font.PLAIN, 6); // NOI18N - } - - return headerFont; - } - - public void setHeaderFont(Font f) { - if (f == null) { - return; - } - - if (f.equals(headerFont)) { - return; - } - - Font old = headerFont; - headerFont = f; - firePropertyChange(PROP_HEADER_FONT, old, headerFont); - } - - public Font getFooterFont() { - if (footerFont == null) { - footerFont = getHeaderFont(); - } - - return footerFont; - } - - public void setFooterFont(Font f) { - if (f == null) { - return; - } - - if (f.equals(footerFont)) { - return; - } - - Font old = headerFont; - footerFont = f; - firePropertyChange(PROP_FOOTER_FONT, old, footerFont); - } - - public int getHeaderAlignment() { - return headerAlignment; - } - - public void setHeaderAlignment(int alignment) { - if (alignment == headerAlignment) { - return; - } - - if ((alignment != LEFT) && (alignment != CENTER) && (alignment != RIGHT)) { - throw new IllegalArgumentException(); - } - - int old = headerAlignment; - headerAlignment = alignment; - firePropertyChange(PROP_HEADER_ALIGNMENT, new Integer(old), new Integer(headerAlignment)); - } - - public int getFooterAlignment() { - return footerAlignment; - } - - public void setFooterAlignment(int alignment) { - if (alignment == footerAlignment) { - return; - } - - if ((alignment != LEFT) && (alignment != CENTER) && (alignment != RIGHT)) { - throw new IllegalArgumentException(); - } - - int old = footerAlignment; - footerAlignment = alignment; - firePropertyChange(PROP_FOOTER_ALIGNMENT, new Integer(old), new Integer(footerAlignment)); - } - - /** Getter for lineAscentCorrection property. */ - public float getLineAscentCorrection() { - return lineAscentCorrection; - } - - /** Setter for lineAscentCorrection property. - * @param correction the correction - * @exception IllegalArgumentException if correction is less than 0. - */ - public void setLineAscentCorrection(float correction) { - if (correction == lineAscentCorrection) { - return; - } else if (correction < 0) { - throw new IllegalArgumentException(); - } - - float old = lineAscentCorrection; - lineAscentCorrection = correction; - firePropertyChange(PROP_LINE_ASCENT_CORRECTION, new Float(old), new Float(lineAscentCorrection)); - } - - /** Property editor for alignment properties */ - public static class AlignmentEditor extends java.beans.PropertyEditorSupport { - private String sCENTER; - private String sRIGHT; - private String sLEFT; - private String[] tags = new String[] { - sLEFT = NbBundle.getMessage(PrintSettings.class, "CTL_LEFT"), - sCENTER = NbBundle.getMessage(PrintSettings.class, "CTL_CENTER"), - sRIGHT = NbBundle.getMessage(PrintSettings.class, "CTL_RIGHT") - }; - - public String[] getTags() { - return tags; - } - - public String getAsText() { - return tags[((Integer) getValue()).intValue()]; - } - - public void setAsText(String s) { - if (s.equals(sLEFT)) { - setValue(new Integer(0)); - } else if (s.equals(sCENTER)) { - setValue(new Integer(1)); - } else { - setValue(new Integer(2)); - } - } - } - - /** Property editor for PageFormat instances */ - public static class PageFormatEditor extends java.beans.PropertyEditorSupport { - /** No text */ - public String getAsText() { - return null; - } - - /* @return true */ - public boolean supportsCustomEditor() { - return true; - } - - /** - * @return null Shows pageDialog, however. - */ - public java.awt.Component getCustomEditor() { - PageFormat pf = (PageFormat) getValue(); - PrinterJob pj = PrinterJob.getPrinterJob(); - PageFormat npf = pj.pageDialog(pf); - - //setValue(npf); - PrintSettings.findObject(PrintSettings.class).setPageFormat((PageFormat) npf.clone()); - pj.cancel(); - - return null; - } - } - } --- 1,0 ---- Index: text/src/org/openide/text/PrintSettingsBeanInfo.java *** /space/work/all/openide/text/src/org/openide/text/PrintSettingsBeanInfo.java Base (1.4) --- /space/work/all/openide/text/src/org/openide/text/PrintSettingsBeanInfo.java Locally Deleted *************** *** 1,86 **** - /* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - package org.openide.text; - - - import java.awt.Image; - import java.beans.*; - import org.openide.util.*; - - - /** BeanInfo for PrintSettings. - * - * @author Ales Novak - */ - public class PrintSettingsBeanInfo extends SimpleBeanInfo { - /** Returns the PrintSettings' icon */ - public Image getIcon(int type) { - return Utilities.loadImage("org/openide/text/printSettings.gif"); // NOI18N - } - - /** Descriptor of valid properties - * @return array of properties - */ - public PropertyDescriptor[] getPropertyDescriptors() { - try { - PropertyDescriptor[] desc = new PropertyDescriptor[] { - new PropertyDescriptor(PrintSettings.PROP_WRAP, PrintSettings.class), // 0 - new PropertyDescriptor(PrintSettings.PROP_HEADER_FORMAT, PrintSettings.class), // 1 - new PropertyDescriptor(PrintSettings.PROP_FOOTER_FORMAT, PrintSettings.class), // 2 - new PropertyDescriptor(PrintSettings.PROP_HEADER_FONT, PrintSettings.class), // 3 - new PropertyDescriptor(PrintSettings.PROP_FOOTER_FONT, PrintSettings.class), // 4 - new PropertyDescriptor(PrintSettings.PROP_HEADER_ALIGNMENT, PrintSettings.class), // 5 - new PropertyDescriptor(PrintSettings.PROP_FOOTER_ALIGNMENT, PrintSettings.class), // 6 - - // new PropertyDescriptor(PrintSettings.PROP_PAGE_FORMAT, PrintSettings.class), // 7 - new PropertyDescriptor(PrintSettings.PROP_LINE_ASCENT_CORRECTION, PrintSettings.class) // 8 - }; - desc[0].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_WRAP")); - desc[0].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_WRAP")); - desc[1].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_HEADER_FORMAT")); - desc[1].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_HEADER_FORMAT")); - desc[2].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_FOOTER_FORMAT")); - desc[2].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_FOOTER_FORMAT")); - desc[3].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_HEADER_FONT")); - desc[3].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_HEADER_FONT")); - desc[4].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_FOOTER_FONT")); - desc[4].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_FOOTER_FONT")); - desc[5].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_HEADER_ALIGNMENT")); - desc[5].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_HEADER_ALIGNMENT")); - desc[5].setPropertyEditorClass(PrintSettings.AlignmentEditor.class); - desc[6].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_FOOTER_ALIGNMENT")); - desc[6].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_FOOTER_ALIGNMENT")); - desc[6].setPropertyEditorClass(PrintSettings.AlignmentEditor.class); - - /* - desc[7].setDisplayName(PrintSettings.getString("PROP_PAGE_FORMAT")); - desc[7].setShortDescription(PrintSettings.getString("HINT_PAGE_FORMAT")); - desc[7].setPropertyEditorClass(PrintSettings.PageFormatEditor.class); - */ - desc[7].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_LINE_ASCENT_CORRECTION")); - desc[7].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_LINE_ASCENT_CORRECTION")); - - return desc; - } catch (IntrospectionException ex) { - Exceptions.printStackTrace(ex); - - return null; - } - } - } --- 1,0 ---- Index: text/module-auto-deps.xml *** /space/work/all/openide/text/module-auto-deps.xml No Base Revision --- /space/work/all/openide/text/module-auto-deps.xml Locally New *************** *** 1,0 **** --- 1,38 ---- + + + + + + + + #88531 Remove SystemOption usage from PrintSettings + + + + + + + + + + + + + Index: text/src/org/openide/text/PrintPreferences.java *** /space/work/all/openide/text/src/org/openide/text/PrintPreferences.java No Base Revision --- /space/work/all/openide/text/src/org/openide/text/PrintPreferences.java Locally New *************** *** 1,0 **** --- 1,291 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + package org.openide.text; + + import org.openide.util.HelpCtx; + import org.openide.util.NbBundle; + import java.awt.Font; + import java.awt.print.PageFormat; + import java.awt.print.Paper; + import java.awt.print.PrinterJob; + import java.util.prefs.Preferences; + import org.openide.nodes.BeanNode; + import org.openide.util.NbPreferences; + + /** + * Allows get, set properties that specify the look of a printed Source Editor page, + * including headers, footers, vertical spacing, and line numbers. + * + * @author Radek Matous + * @since 6.13 + */ + public final class PrintPreferences { + /** Constants for center, right, left position of page header, footer. */ + public static enum Alignment { LEFT, CENTER, RIGHT}; + + private static final PrintPreferences INSTANCE = new PrintPreferences(); + /** Property name of the wrap property */ + private static final String PROP_WRAP = "wrap"; // NOI18N + + /** Property name of the header format property */ + private static final String PROP_HEADER_FORMAT = "headerFormat"; // NOI18N + + /** Property name of the footer format property */ + private static final String PROP_FOOTER_FORMAT = "footerFormat"; // NOI18N + + /** Property name of the header alignment property */ + private static final String PROP_HEADER_ALIGNMENT = "headerAlignment"; // NOI18N + + /** Property name of the footer alignment property */ + private static final String PROP_FOOTER_ALIGNMENT = "footerAlignment"; // NOI18N + + /** Property names of the page format */ + private static final String PROP_PAGE_ORIENTATION = "pageOrientation";// NOI18N + private static final String PROP_PAGE_WIDTH = "pageWidth";// NOI18N + private static final String PROP_PAGE_HEIGHT = "pageHeight";// NOI18N + private static final String PROP_PAGE_IMAGEABLEAREA_Y = "imageableAreaY"; + private static final String PROP_PAGE_IMAGEABLEAREA_X = "imageableAreaX"; + private static final String PROP_PAGE_IMAGEABLEAREA_WIDTH = "imageableAreaWidth"; + private static final String PROP_PAGE_IMAGEABLEAREA_HEIGHT = "imageableAreaHeight"; + + /** Property names of the header font property */ + private static final String PROP_HEADER_FONT_NAME = "headerFontName";//NOI18N + private static final String PROP_HEADER_FONT_STYLE = "headerFontStyle";//NOI18N + private static final String PROP_HEADER_FONT_SIZE = "headerFontSize";//NOI18N + + /** Property names of the footer font property */ + private static final String PROP_FOOTER_FONT_NAME = "footerFontName";//NOI18N + private static final String PROP_FOOTER_FONT_STYLE = "footerFontStyle";//NOI18N + private static final String PROP_FOOTER_FONT_SIZE = "footerFontSize";//NOI18N + + /** Defaults for both heeader font and foote font */ + private static final String DEFAULT_FONT_NAME = "Monospaced";//NOI18N + private static final int DEFAULT_FONT_STYLE = java.awt.Font.PLAIN; + private static final int DEFAULT_FONT_SIZE = 6; + + /** Property name of the line ascent correction property */ + private static final String PROP_LINE_ASCENT_CORRECTION = "lineAscentCorrection"; // NOI18N + + private PrintPreferences() {} + + private static Preferences getPreferences() { + return NbPreferences.forModule(PrintPreferences.class); + } + + /** + * Get an instance of {@link java.awt.print.PageFormat}. + * @param pj {@link java.awt.print.PrinterJob} which is + * associated with the default printer. + * @return an instance of PageFormat that describes the size and + * orientation of a page to be printed. + */ + public static PageFormat getPageFormat(PrinterJob pj) { + PageFormat pageFormat = null; + pageFormat = pj.defaultPage(); + Paper p = pageFormat.getPaper(); + int pageOrientation = getPreferences().getInt(PROP_PAGE_ORIENTATION, pageFormat.getOrientation()); + double paperWidth = getPreferences().getDouble(PROP_PAGE_WIDTH, p.getWidth()); + double paperHeight = getPreferences().getDouble(PROP_PAGE_HEIGHT, p.getHeight()); + + double iaWidth = getPreferences().getDouble(PROP_PAGE_IMAGEABLEAREA_WIDTH, p.getImageableWidth()); + double iaHeight = getPreferences().getDouble(PROP_PAGE_IMAGEABLEAREA_HEIGHT, p.getImageableHeight()); + double iaX = getPreferences().getDouble(PROP_PAGE_IMAGEABLEAREA_X, p.getImageableX()); + double iaY = getPreferences().getDouble(PROP_PAGE_IMAGEABLEAREA_Y, p.getImageableY()); + + pageFormat.setOrientation(pageOrientation); + p.setSize(paperWidth, paperHeight); + p.setImageableArea(iaX, iaY, iaWidth, iaHeight); + pageFormat.setPaper(p); + return pageFormat; + } + + /** + * @param pf PageFormat that describes the size and + * orientation of a page to be printed + */ + public static void setPageFormat(PageFormat pf) { + getPreferences().putInt(PROP_PAGE_ORIENTATION, pf.getOrientation()); + getPreferences().putDouble(PROP_PAGE_WIDTH, pf.getPaper().getWidth()); + getPreferences().putDouble(PROP_PAGE_HEIGHT, pf.getPaper().getHeight()); + + getPreferences().putDouble(PROP_PAGE_IMAGEABLEAREA_WIDTH, pf.getPaper().getImageableWidth()); + getPreferences().putDouble(PROP_PAGE_IMAGEABLEAREA_HEIGHT, pf.getPaper().getImageableHeight()); + getPreferences().putDouble(PROP_PAGE_IMAGEABLEAREA_X, pf.getPaper().getImageableX()); + getPreferences().putDouble(PROP_PAGE_IMAGEABLEAREA_Y, pf.getPaper().getImageableY()); + } + + /** + * Wrap lines. + * @return true if lines that are too long for the page size will be wrapped + * to the following line. If false is returned, then long lines will be truncated. + */ + public static boolean getWrap() { + return getPreferences().getBoolean(PROP_WRAP, true); + } + + /** + * @param wrap + * See {@link #getWrap} + */ + public static void setWrap(boolean wrap) { + if (getWrap() == wrap) return; + getPreferences().putBoolean(PROP_WRAP, wrap); + } + + /** + * See {@link #setHeaderFormat} + * @return the text for the page header + */ + public static String getHeaderFormat() { + return getPreferences().get(PROP_HEADER_FORMAT, + NbBundle.getMessage(PrintPreferences.class, "CTL_Header_format")); + } + + /** + * Set the text for the page header. + * The following special characters can be used: + * + * @param s the text for the page header + */ + public static void setHeaderFormat(String s) { + if (getHeaderFormat().equals(s)) return; + getPreferences().put(PROP_HEADER_FORMAT, s); + } + + /** + * See {@link #setFooterFormat} + * @return the text for the page footer + */ + public static String getFooterFormat() { + return getPreferences().get(PROP_FOOTER_FORMAT, + NbBundle.getMessage(PrintPreferences.class, "CTL_Footer_format")); + } + + /** + * Set the text for the page footer. + * The following special characters can be used: + * + * @param s the text for the page footer + */ + public static void setFooterFormat(String s) { + if (getFooterFormat().equals(s)) return; + getPreferences().put(PROP_FOOTER_FORMAT, s); + + } + + /** + * @return the font for the header + */ + public static Font getHeaderFont() { + String name = getPreferences().get(PROP_HEADER_FONT_NAME,DEFAULT_FONT_NAME); + int style = getPreferences().getInt(PROP_HEADER_FONT_STYLE,DEFAULT_FONT_STYLE); + int size = getPreferences().getInt(PROP_HEADER_FONT_SIZE,DEFAULT_FONT_SIZE); + + return new Font(name, style, size); + } + + /** + * @param f the font for the header + */ + public static void setHeaderFont(Font f) { + if (getHeaderFont().equals(f)) return; + getPreferences().put(PROP_HEADER_FONT_NAME,f.getName()); + getPreferences().putInt(PROP_HEADER_FONT_STYLE,f.getStyle()); + getPreferences().putInt(PROP_HEADER_FONT_SIZE,f.getSize()); + + } + + /** + * @return the font for the footer + */ + public static Font getFooterFont() { + String name = getPreferences().get(PROP_FOOTER_FONT_NAME,DEFAULT_FONT_NAME); + int style = getPreferences().getInt(PROP_FOOTER_FONT_STYLE,DEFAULT_FONT_STYLE); + int size = getPreferences().getInt(PROP_FOOTER_FONT_SIZE,DEFAULT_FONT_SIZE); + + return new Font(name, style, size); + } + + /** + * @param f the font for the footer + */ + public static void setFooterFont(Font f) { + if (getFooterFont().equals(f)) return; + getPreferences().put(PROP_FOOTER_FONT_NAME,f.getName()); + getPreferences().putInt(PROP_FOOTER_FONT_STYLE,f.getStyle()); + getPreferences().putInt(PROP_FOOTER_FONT_SIZE,f.getSize()); + } + + /** + * @return information whether the header is centered, left aligned, or right aligned. + */ + public static PrintPreferences.Alignment getHeaderAlignment() { + return Alignment.valueOf(getPreferences().get(PROP_HEADER_ALIGNMENT, Alignment.CENTER.name())); + } + + /** + * @param alignment whether the header should be centered, left aligned, or right aligned. + */ + public static void setHeaderAlignment(PrintPreferences.Alignment alignment) { + if (getHeaderAlignment().equals(alignment)) return; + getPreferences().put(PROP_HEADER_ALIGNMENT, alignment.name()); + } + + /** + * @return whether the footer is centered, left aligned, or right aligned. + */ + public static PrintPreferences.Alignment getFooterAlignment() { + return Alignment.valueOf(getPreferences().get(PROP_FOOTER_ALIGNMENT, Alignment.CENTER.name())); + } + + /** + * @param alignment whether the footer should be centered, left aligned, or right aligned. + */ + public static void setFooterAlignment(PrintPreferences.Alignment alignment) { + if (getFooterAlignment().equals(alignment)) return; + getPreferences().put(PROP_FOOTER_ALIGNMENT, alignment.name()); + } + + /** + * @return the amount of vertical space to print between lines. + */ + public static float getLineAscentCorrection() { + return getPreferences().getFloat(PROP_LINE_ASCENT_CORRECTION, 1.0f); + } + + /** + * @param correction the amount of vertical space to print between lines. + * @exception IllegalArgumentException if correction is less than 0. + */ + public static void setLineAscentCorrection(float correction) { + if (getLineAscentCorrection() == correction) return; + if (correction < 0) { + throw new IllegalArgumentException(); + } + getPreferences().putFloat(PROP_LINE_ASCENT_CORRECTION, correction); + } + } Index: text/test/unit/src/org/openide/text/PrintPreferencesTest.java *** /space/work/all/openide/text/test/unit/src/org/openide/text/PrintPreferencesTest.java No Base Revision --- /space/work/all/openide/text/test/unit/src/org/openide/text/PrintPreferencesTest.java Locally New *************** *** 1,0 **** --- 1,168 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.openide.text; + + import java.awt.Font; + import java.awt.font.TextAttribute; + import java.util.Iterator; + import java.util.Map; + import org.netbeans.junit.NbTestCase; + import junit.framework.*; + import org.openide.util.HelpCtx; + import org.openide.util.NbBundle; + import java.awt.print.PageFormat; + import java.awt.print.Paper; + import java.awt.print.PrinterJob; + import java.util.prefs.Preferences; + import org.openide.nodes.BeanNode; + import org.openide.util.NbPreferences; + + /** + * @author Radek Matous + */ + public class PrintPreferencesTest extends NbTestCase { + public PrintPreferencesTest(String testName) { + super(testName); + } + + public void testGetHeaderFont() { + Font expResult = PrintPreferences.getHeaderFont(); + PrintPreferences.setHeaderFont(expResult); + Font result = PrintPreferences.getHeaderFont(); + assertEquals(expResult, result); + Font derived = result.deriveFont(java.awt.Font.BOLD,8); + PrintPreferences.setHeaderFont(derived); + assertEquals(derived, PrintPreferences.getHeaderFont()); + } + + public void testGetFooterFont() { + Font expResult = PrintPreferences.getFooterFont(); + PrintPreferences.setFooterFont(expResult); + Font result = PrintPreferences.getFooterFont(); + assertEquals(expResult, result); + Font derived = result.deriveFont(java.awt.Font.BOLD,8); + PrintPreferences.setFooterFont(derived); + assertEquals(derived, PrintPreferences.getFooterFont()); + } + + public void testGetPageFormat() { + PrinterJob pj = PrinterJob.getPrinterJob(); + PageFormat expResult = PrintPreferences.getPageFormat(pj); + PrintPreferences.setPageFormat(expResult); + PageFormat result = PrintPreferences.getPageFormat(pj); + assertEquals(expResult.getHeight(), result.getHeight()); + assertEquals(expResult.getWidth(), result.getWidth()); + assertEquals(expResult.getOrientation(), result.getOrientation()); + assertEquals(expResult.getPaper().getHeight(), result.getPaper().getHeight()); + assertEquals(expResult.getPaper().getWidth(), result.getPaper().getWidth()); + assertEquals(expResult.getPaper().getImageableHeight(), result.getPaper().getImageableHeight()); + assertEquals(expResult.getPaper().getImageableWidth(), result.getPaper().getImageableWidth()); + assertEquals(expResult.getPaper().getImageableX(), result.getPaper().getImageableX()); + assertEquals(expResult.getPaper().getImageableY(), result.getPaper().getImageableY()); + + double w = expResult.getPaper().getWidth() + 10; + double h = expResult.getPaper().getHeight() + 10; + Paper p = expResult.getPaper(); + double ix = p.getImageableX() + 10; + double iy = p.getImageableY() + 10; + double iw = p.getImageableWidth() + 10; + double ih = p.getImageableHeight() + 10; + p.setImageableArea(ix, iy, iw, ih); + p.setSize(w, h); + expResult.setPaper(p); + PrintPreferences.setPageFormat(expResult); + assertEquals(h, PrintPreferences.getPageFormat(pj).getHeight()); + assertEquals(w, PrintPreferences.getPageFormat(pj).getWidth()); + assertEquals(ix, PrintPreferences.getPageFormat(pj).getPaper().getImageableX()); + assertEquals(iy, PrintPreferences.getPageFormat(pj).getPaper().getImageableY()); + assertEquals(iw, PrintPreferences.getPageFormat(pj).getPaper().getImageableWidth()); + assertEquals(ih, PrintPreferences.getPageFormat(pj).getPaper().getImageableHeight()); + + expResult.setOrientation(PageFormat.REVERSE_LANDSCAPE); + PrintPreferences.setPageFormat(expResult); + assertEquals(PageFormat.REVERSE_LANDSCAPE, PrintPreferences.getPageFormat(pj).getOrientation()); + } + + public void testGetWrap() { + PrintPreferences.setWrap(true); + assertEquals(true, PrintPreferences.getWrap()); + PrintPreferences.setWrap(false); + assertEquals(false, PrintPreferences.getWrap()); + } + + public void testGetHeaderFormat() { + String expResult = "my header format"; + PrintPreferences.setHeaderFormat(expResult); + String result = PrintPreferences.getHeaderFormat(); + assertEquals(expResult, result); + } + + public void testGetFooterFormat() { + String expResult = "my footer format"; + PrintPreferences.setFooterFormat(expResult); + String result = PrintPreferences.getFooterFormat(); + assertEquals(expResult, result); + } + + public void testGetHeaderAlignment() { + PrintPreferences.Alignment expResult = PrintPreferences.Alignment.LEFT; + PrintPreferences.setHeaderAlignment(expResult); + PrintPreferences.Alignment result = PrintPreferences.getHeaderAlignment(); + assertEquals(expResult, result); + + expResult = PrintPreferences.Alignment.RIGHT; + PrintPreferences.setHeaderAlignment(expResult); + result = PrintPreferences.getHeaderAlignment(); + assertEquals(expResult, result); + + expResult = PrintPreferences.Alignment.CENTER; + PrintPreferences.setHeaderAlignment(expResult); + result = PrintPreferences.getHeaderAlignment(); + assertEquals(expResult, result); + } + + public void testGetFooterAlignment() { + PrintPreferences.Alignment expResult = PrintPreferences.Alignment.LEFT; + PrintPreferences.setFooterAlignment(expResult); + PrintPreferences.Alignment result = PrintPreferences.getFooterAlignment(); + assertEquals(expResult, result); + + expResult = PrintPreferences.Alignment.RIGHT; + PrintPreferences.setFooterAlignment(expResult); + result = PrintPreferences.getFooterAlignment(); + assertEquals(expResult, result); + + expResult = PrintPreferences.Alignment.CENTER; + PrintPreferences.setFooterAlignment(expResult); + result = PrintPreferences.getFooterAlignment(); + assertEquals(expResult, result); + + } + + public void testGetLineAscentCorrection() { + float expResult = 0.0F; + for (int i = 0; i < 10; i++) { + expResult += 1; + PrintPreferences.setLineAscentCorrection(expResult); + float result = PrintPreferences.getLineAscentCorrection(); + assertEquals(expResult, result); + } + } + } Index: options/src/org/openide/text/PrintSettings.java *** /space/work/all/openide/options/src/org/openide/text/PrintSettings.java No Base Revision --- /space/work/all/openide/options/src/org/openide/text/PrintSettings.java Locally New *************** *** 1,0 **** --- 1,267 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + package org.openide.text; + + import org.openide.options.ContextSystemOption; + import org.openide.util.HelpCtx; + import org.openide.util.NbBundle; + import java.awt.Font; + import java.awt.print.PageFormat; + import java.awt.print.PrinterJob; + + /** Settings for output window. + * + * @author Ales Novak + */ + public final class PrintSettings extends ContextSystemOption { + // final because overrides Externalizable methods + + /** serialVersionUID */ + static final long serialVersionUID = -9102470021814206818L; + + /** Constant for center position of page header. */ + public static final int CENTER = 0x1; + + /** Constant for right position of page header. */ + public static final int RIGHT = 0x2; + + /** Constant for left position of page header. */ + public static final int LEFT = 0x0; + + /** Property name of the wrap property */ + public static final String PROP_PAGE_FORMAT = "pageFormat"; // NOI18N + + /** Property name of the wrap property */ + public static final String PROP_WRAP = "wrap"; // NOI18N + + /** Property name of the header format property */ + public static final String PROP_HEADER_FORMAT = "headerFormat"; // NOI18N + + /** Property name of the footer format property */ + public static final String PROP_FOOTER_FORMAT = "footerFormat"; // NOI18N + + /** Property name of the header font property */ + public static final String PROP_HEADER_FONT = "headerFont"; // NOI18N + + /** Property name of the footer font property */ + public static final String PROP_FOOTER_FONT = "footerFont"; // NOI18N + + /** Property name of the header alignment property */ + public static final String PROP_HEADER_ALIGNMENT = "headerAlignment"; // NOI18N + + /** Property name of the footer alignment property */ + public static final String PROP_FOOTER_ALIGNMENT = "footerAlignment"; // NOI18N + + /** Property name of the line ascent correction property */ + public static final String PROP_LINE_ASCENT_CORRECTION = "lineAscentCorrection"; // NOI18N + private static final String HELP_ID = "editing.printing"; // !!! NOI18N + + + public String displayName() { + return NbBundle.getMessage(PrintSettings.class, "CTL_Print_settings"); + } + + public HelpCtx getHelpCtx() { + return new HelpCtx(HELP_ID); + } + + /** @return an instance of PageFormat + * The returned page format is either previously set by + * PageSetupAction or is acquired as a default PageFormat + * from supported PrinterJob + */ + public static PageFormat getPageFormat(PrinterJob pj) { + return PrintPreferences.getPageFormat(pj); + } + + /** @deprecated Use {@link #getPageFormat(PrinterJob)} instead. */ + public PageFormat getPageFormat() { + return getPageFormat(PrinterJob.getPrinterJob()); + } + + /** sets page format */ + public void setPageFormat(PageFormat pf) { + PrintPreferences.setPageFormat(pf); + firePropertyChange(PROP_PAGE_FORMAT, null, pf); + } + + public boolean getWrap() { + return PrintPreferences.getWrap(); + } + + public void setWrap(boolean b) { + PrintPreferences.setWrap(b); + firePropertyChange(PROP_WRAP, (b ? Boolean.FALSE : Boolean.TRUE), (b ? Boolean.TRUE : Boolean.FALSE)); + } + + public String getHeaderFormat() { + return PrintPreferences.getHeaderFormat(); + } + + public void setHeaderFormat(String s) { + PrintPreferences.setHeaderFormat(s); + firePropertyChange(PROP_HEADER_FORMAT, null, s); + } + + public String getFooterFormat() { + return PrintPreferences.getFooterFormat(); + } + + public void setFooterFormat(String s) { + PrintPreferences.setFooterFormat(s); + firePropertyChange(PROP_FOOTER_FORMAT, null, s); + } + + public Font getHeaderFont() { + return PrintPreferences.getHeaderFont(); + } + + public void setHeaderFont(Font f) { + PrintPreferences.setHeaderFont(f); + firePropertyChange(PROP_HEADER_FONT, null, f); + } + + public Font getFooterFont() { + return PrintPreferences.getFooterFont(); + } + + public void setFooterFont(Font f) { + PrintPreferences.setFooterFont(f); + firePropertyChange(PROP_FOOTER_FONT, null, f); + } + + public int getHeaderAlignment() { + return fromAlignment(PrintPreferences.getHeaderAlignment()); + } + + public void setHeaderAlignment(int alignment) { + PrintPreferences.setHeaderAlignment(toAlignment(alignment)); + firePropertyChange(PROP_HEADER_ALIGNMENT, null, new Integer(alignment)); + } + + private PrintPreferences.Alignment toAlignment(int alignment) { + PrintPreferences.Alignment retval = PrintPreferences.Alignment.CENTER; + switch(alignment) { + case CENTER: + retval = PrintPreferences.Alignment.CENTER; + break; + case LEFT: + retval = PrintPreferences.Alignment.LEFT; + break; + case RIGHT: + retval = PrintPreferences.Alignment.RIGHT; + break; + } + return retval; + } + + private int fromAlignment(PrintPreferences.Alignment alignment) { + int retval = CENTER; + if (PrintPreferences.Alignment.CENTER.equals(alignment)) { + retval = CENTER; + } else if (PrintPreferences.Alignment.LEFT.equals(alignment)) { + retval = LEFT; + } else if (PrintPreferences.Alignment.RIGHT.equals(alignment)) { + retval = RIGHT; + } + return retval; + } + + + public int getFooterAlignment() { + return fromAlignment(PrintPreferences.getFooterAlignment()); + } + + public void setFooterAlignment(int alignment) { + PrintPreferences.setFooterAlignment(toAlignment(alignment)); + firePropertyChange(PROP_FOOTER_ALIGNMENT, null, new Integer(alignment)); + } + + /** Getter for lineAscentCorrection property. */ + public float getLineAscentCorrection() { + return PrintPreferences.getLineAscentCorrection(); + } + + /** Setter for lineAscentCorrection property. + * @param correction the correction + * @exception IllegalArgumentException if correction is less than 0. + */ + public void setLineAscentCorrection(float correction) { + PrintPreferences.setLineAscentCorrection(correction); + firePropertyChange(PROP_LINE_ASCENT_CORRECTION, null, new Float(correction)); + } + + /** Property editor for alignment properties */ + public static class AlignmentEditor extends java.beans.PropertyEditorSupport { + private String sCENTER; + private String sRIGHT; + private String sLEFT; + private String[] tags = new String[] { + sLEFT = NbBundle.getMessage(PrintSettings.class, "CTL_LEFT"), + sCENTER = NbBundle.getMessage(PrintSettings.class, "CTL_CENTER"), + sRIGHT = NbBundle.getMessage(PrintSettings.class, "CTL_RIGHT") + }; + + public String[] getTags() { + return tags; + } + + public String getAsText() { + return tags[((Integer) getValue()).intValue()]; + } + + public void setAsText(String s) { + if (s.equals(sLEFT)) { + setValue(new Integer(0)); + } else if (s.equals(sCENTER)) { + setValue(new Integer(1)); + } else { + setValue(new Integer(2)); + } + } + } + + /** Property editor for PageFormat instances */ + public static class PageFormatEditor extends java.beans.PropertyEditorSupport { + /** No text */ + public String getAsText() { + return null; + } + + /* @return true */ + public boolean supportsCustomEditor() { + return true; + } + + /** + * @return null Shows pageDialog, however. + */ + public java.awt.Component getCustomEditor() { + PageFormat pf = (PageFormat) getValue(); + PrinterJob pj = PrinterJob.getPrinterJob(); + PageFormat npf = pj.pageDialog(pf); + + //setValue(npf); + ((PrintSettings)PrintSettings.findObject(PrintSettings.class)).setPageFormat((PageFormat) npf.clone()); + pj.cancel(); + + return null; + } + } + } Index: options/src/org/openide/text/PrintSettingsBeanInfo.java *** /space/work/all/openide/options/src/org/openide/text/PrintSettingsBeanInfo.java No Base Revision --- /space/work/all/openide/options/src/org/openide/text/PrintSettingsBeanInfo.java Locally New *************** *** 1,0 **** --- 1,86 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + package org.openide.text; + + + import java.awt.Image; + import java.beans.*; + import org.openide.util.*; + + + /** BeanInfo for PrintSettings. + * + * @author Ales Novak + */ + public class PrintSettingsBeanInfo extends SimpleBeanInfo { + /** Returns the PrintSettings' icon */ + public Image getIcon(int type) { + return Utilities.loadImage("org/openide/text/printSettings.gif"); // NOI18N + } + + /** Descriptor of valid properties + * @return array of properties + */ + public PropertyDescriptor[] getPropertyDescriptors() { + try { + PropertyDescriptor[] desc = new PropertyDescriptor[] { + new PropertyDescriptor(PrintSettings.PROP_WRAP, PrintSettings.class), // 0 + new PropertyDescriptor(PrintSettings.PROP_HEADER_FORMAT, PrintSettings.class), // 1 + new PropertyDescriptor(PrintSettings.PROP_FOOTER_FORMAT, PrintSettings.class), // 2 + new PropertyDescriptor(PrintSettings.PROP_HEADER_FONT, PrintSettings.class), // 3 + new PropertyDescriptor(PrintSettings.PROP_FOOTER_FONT, PrintSettings.class), // 4 + new PropertyDescriptor(PrintSettings.PROP_HEADER_ALIGNMENT, PrintSettings.class), // 5 + new PropertyDescriptor(PrintSettings.PROP_FOOTER_ALIGNMENT, PrintSettings.class), // 6 + + // new PropertyDescriptor(PrintSettings.PROP_PAGE_FORMAT, PrintSettings.class), // 7 + new PropertyDescriptor(PrintSettings.PROP_LINE_ASCENT_CORRECTION, PrintSettings.class) // 8 + }; + desc[0].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_WRAP")); + desc[0].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_WRAP")); + desc[1].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_HEADER_FORMAT")); + desc[1].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_HEADER_FORMAT")); + desc[2].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_FOOTER_FORMAT")); + desc[2].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_FOOTER_FORMAT")); + desc[3].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_HEADER_FONT")); + desc[3].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_HEADER_FONT")); + desc[4].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_FOOTER_FONT")); + desc[4].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_FOOTER_FONT")); + desc[5].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_HEADER_ALIGNMENT")); + desc[5].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_HEADER_ALIGNMENT")); + desc[5].setPropertyEditorClass(PrintSettings.AlignmentEditor.class); + desc[6].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_FOOTER_ALIGNMENT")); + desc[6].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_FOOTER_ALIGNMENT")); + desc[6].setPropertyEditorClass(PrintSettings.AlignmentEditor.class); + + /* + desc[7].setDisplayName(PrintSettings.getString("PROP_PAGE_FORMAT")); + desc[7].setShortDescription(PrintSettings.getString("HINT_PAGE_FORMAT")); + desc[7].setPropertyEditorClass(PrintSettings.PageFormatEditor.class); + */ + desc[7].setDisplayName(NbBundle.getMessage(PrintSettings.class, "PROP_LINE_ASCENT_CORRECTION")); + desc[7].setShortDescription(NbBundle.getMessage(PrintSettings.class, "HINT_LINE_ASCENT_CORRECTION")); + + return desc; + } catch (IntrospectionException ex) { + Exceptions.printStackTrace(ex); + + return null; + } + } + } Index: text/apichanges.xml *** /space/work/all/openide/text/apichanges.xml Base (1.16) --- /space/work/all/openide/text/apichanges.xml Locally Modified (Based On 1.16) *************** *** 23,29 **** --- 23,63 ---- Text API + + + Adding PrintPreferences + + + + + +

+ Class PrintPreferences was added as replacement for original + class PrintSettings. +

+
+ + +
+ + + Removing PrintSettings + + + + + +

+ Classes PrintSettings and PrintSettingsBeanInfo + were removed. Runtime backward compatibility was ensured + by moving both into org.openide.options module which is already deprecated. +

+
+ + +
+ Adding CloneableEditorSupport.getEditorKit method Index: text/manifest.mf *** /space/work/all/openide/text/manifest.mf Base (1.14) --- /space/work/all/openide/text/manifest.mf Locally Modified (Based On 1.14) *************** *** 1,5 **** Manifest-Version: 1.0 OpenIDE-Module: org.openide.text ! OpenIDE-Module-Specification-Version: 6.12 OpenIDE-Module-Localizing-Bundle: org/openide/text/Bundle.properties --- 1,5 ---- Manifest-Version: 1.0 OpenIDE-Module: org.openide.text ! OpenIDE-Module-Specification-Version: 6.13 OpenIDE-Module-Localizing-Bundle: org/openide/text/Bundle.properties Index: options/manifest.mf *** /space/work/all/openide/options/manifest.mf Base (1.8) --- /space/work/all/openide/options/manifest.mf Locally Modified (Based On 1.8) *************** *** 1,6 **** Manifest-Version: 1.0 OpenIDE-Module: org.openide.options ! OpenIDE-Module-Specification-Version: 6.6 OpenIDE-Module-Localizing-Bundle: org/openide/options/Bundle.properties OpenIDE-Module-Deprecated: true --- 1,6 ---- Manifest-Version: 1.0 OpenIDE-Module: org.openide.options ! OpenIDE-Module-Specification-Version: 6.7 OpenIDE-Module-Localizing-Bundle: org/openide/options/Bundle.properties OpenIDE-Module-Deprecated: true Index: text/nbproject/project.xml *** /space/work/all/openide/text/nbproject/project.xml Base (1.13) --- /space/work/all/openide/text/nbproject/project.xml Locally Modified (Based On 1.13) *************** *** 57,70 **** - org.openide.options - - - - 6.2 - - - org.openide.util --- 57,62 ---- Index: options/nbproject/project.xml *** /space/work/all/openide/options/nbproject/project.xml Base (1.8) --- /space/work/all/openide/options/nbproject/project.xml Locally Modified (Based On 1.8) *************** *** 24,29 **** --- 24,37 ---- org.openide.options + org.openide.text + + + + 6.13 + + + org.openide.util *************** *** 48,53 **** --- 56,62 ---- org.openide.explorer.propertysheet org.openide.options + org.openide.text