View Javadoc

1   // Copyright 2003-2007, FreeHEP.
2   package org.freehep.graphicsio.exportchooser;
3   
4   import java.awt.Component;
5   import java.util.Properties;
6   
7   import org.freehep.graphicsio.FontConstants;
8   import org.freehep.swing.layout.TableLayout;
9   
10  /**
11   * 
12   * @author Mark Donszelmann
13   * @version $Id: FontPanel.java 10516 2007-02-06 21:11:19Z duns $
14   */
15  public class FontPanel extends OptionPanel {
16  
17      /**
18       * defines the optionpanel for font embedding and text as shapes.
19       *
20       * @param options
21       * @param embeddingRootKey rootkey for {@link String abstractRootKey = AbstractVectorGraphicsIO.class.getName();#EMBED_FONTS} and {@link FontConstants#EMBED_FONTS_AS}
22       * @param shapeRootKey rootkey for {@link FontConstants#TEXT_AS_SHAPES}
23       */
24      public FontPanel(Properties options, String embeddingRootKey, String shapeRootKey) {
25          super("Fonts");
26  
27          // to disable / enable for TEXT_AS_SHAPES
28          Component enable = null;
29  
30          // font embedding
31          if (embeddingRootKey != null) {
32              final OptionCheckBox checkBox = new OptionCheckBox(
33                  options,
34                  embeddingRootKey + "." + FontConstants.EMBED_FONTS,
35                  "Embed Fonts as");
36              add(TableLayout.LEFT, checkBox);
37  
38              final OptionComboBox comboBox = new OptionComboBox(
39                  options,
40                  embeddingRootKey + "." + FontConstants.EMBED_FONTS_AS,
41                  FontConstants .getEmbedFontsAsList());
42              add(TableLayout.RIGHT, comboBox);
43              checkBox.enables(comboBox);
44  
45              enable = checkBox;
46          }
47  
48          // text es shape
49          if (shapeRootKey != null) {
50              final OptionCheckBox shapeCheckBox = new OptionCheckBox(
51                  options,
52                  shapeRootKey + "." + FontConstants.TEXT_AS_SHAPES,
53                  "Draw text as shapes");
54              add(TableLayout.FULL, shapeCheckBox);
55              
56              if (enable != null) {
57                  shapeCheckBox.disables(enable);
58              }
59          }
60      }
61  }