< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java

Print this page

        

*** 48,59 **** * You need to either provide a configuration file, by way of the * {@link #load} method, or provide your own {@link SynthStyleFactory} * to {@link #setStyleFactory}. Refer to the * <a href="package-summary.html">package summary</a> for an example of * loading a file, and {@link javax.swing.plaf.synth.SynthStyleFactory} for ! * an example of providing your own <code>SynthStyleFactory</code> to ! * <code>setStyleFactory</code>. * <p> * <strong>Warning:</strong> * This class implements {@link Serializable} as a side effect of it * extending {@link BasicLookAndFeel}. It is not intended to be serialized. * An attempt to serialize it will --- 48,59 ---- * You need to either provide a configuration file, by way of the * {@link #load} method, or provide your own {@link SynthStyleFactory} * to {@link #setStyleFactory}. Refer to the * <a href="package-summary.html">package summary</a> for an example of * loading a file, and {@link javax.swing.plaf.synth.SynthStyleFactory} for ! * an example of providing your own {@code SynthStyleFactory} to ! * {@code setStyleFactory}. * <p> * <strong>Warning:</strong> * This class implements {@link Serializable} as a side effect of it * extending {@link BasicLookAndFeel}. It is not intended to be serialized. * An attempt to serialize it will
*** 87,97 **** */ private static final Object SELECTED_UI_STATE_KEY = new StringBuilder("selectedUIState"); /** * The last SynthStyleFactory that was asked for from AppContext ! * <code>lastContext</code>. */ private static SynthStyleFactory lastFactory; /** * AppContext lastLAF came from. */ --- 87,97 ---- */ private static final Object SELECTED_UI_STATE_KEY = new StringBuilder("selectedUIState"); /** * The last SynthStyleFactory that was asked for from AppContext ! * {@code lastContext}. */ private static SynthStyleFactory lastFactory; /** * AppContext lastLAF came from. */
*** 116,126 **** /** * Used by the renderers. For the most part the renderers are implemented * as Labels, which is problematic in so far as they are never selected. * To accommodate this SynthLabelUI checks if the current ! * UI matches that of <code>selectedUI</code> (which this methods sets), if * it does, then a state as set by this method is returned. This provides * a way for labels to have a state other than selected. */ static void setSelectedUI(ComponentUI uix, boolean selected, boolean focused, boolean enabled, --- 116,126 ---- /** * Used by the renderers. For the most part the renderers are implemented * as Labels, which is problematic in so far as they are never selected. * To accommodate this SynthLabelUI checks if the current ! * UI matches that of {@code selectedUI} (which this methods sets), if * it does, then a state as set by this method is returned. This provides * a way for labels to have a state other than selected. */ static void setSelectedUI(ComponentUI uix, boolean selected, boolean focused, boolean enabled,
*** 237,247 **** } /** * Returns true if the Style should be updated in response to the * specified PropertyChangeEvent. This forwards to ! * <code>shouldUpdateStyleOnAncestorChanged</code> as necessary. */ static boolean shouldUpdateStyle(PropertyChangeEvent event) { LookAndFeel laf = UIManager.getLookAndFeel(); return (laf instanceof SynthLookAndFeel && ((SynthLookAndFeel) laf).shouldUpdateStyleOnEvent(event)); --- 237,247 ---- } /** * Returns true if the Style should be updated in response to the * specified PropertyChangeEvent. This forwards to ! * {@code shouldUpdateStyleOnAncestorChanged} as necessary. */ static boolean shouldUpdateStyle(PropertyChangeEvent event) { LookAndFeel laf = UIManager.getLookAndFeel(); return (laf instanceof SynthLookAndFeel && ((SynthLookAndFeel) laf).shouldUpdateStyleOnEvent(event));
*** 267,279 **** } return newStyle; } /** ! * Updates the style associated with <code>c</code>, and all its children. * This is a lighter version of ! * <code>SwingUtilities.updateComponentTreeUI</code>. * * @param c Component to update style for. */ public static void updateStyles(Component c) { if (c instanceof JComponent) { --- 267,279 ---- } return newStyle; } /** ! * Updates the style associated with {@code c}, and all its children. * This is a lighter version of ! * {@code SwingUtilities.updateComponentTreeUI}. * * @param c Component to update style for. */ public static void updateStyles(Component c) { if (c instanceof JComponent) {
*** 301,314 **** } c.repaint(); } /** ! * Returns the Region for the JComponent <code>c</code>. * * @param c JComponent to fetch the Region for ! * @return Region corresponding to <code>c</code> */ public static Region getRegion(JComponent c) { return Region.getRegion(c); } --- 301,314 ---- } c.repaint(); } /** ! * Returns the Region for the JComponent {@code c}. * * @param c JComponent to fetch the Region for ! * @return Region corresponding to {@code c} */ public static Region getRegion(JComponent c) { return Region.getRegion(c); }
*** 377,402 **** static boolean isLeftToRight(Component c) { return c.getComponentOrientation().isLeftToRight(); } /** ! * Returns the ui that is of type <code>klass</code>, or null if * one can not be found. */ static Object getUIOfType(ComponentUI ui, Class<?> klass) { if (klass.isInstance(ui)) { return ui; } return null; } /** ! * Creates the Synth look and feel <code>ComponentUI</code> for ! * the passed in <code>JComponent</code>. * ! * @param c JComponent to create the <code>ComponentUI</code> for ! * @return ComponentUI to use for <code>c</code> */ public static ComponentUI createUI(JComponent c) { String key = c.getUIClassID().intern(); if (key == "ButtonUI") { --- 377,402 ---- static boolean isLeftToRight(Component c) { return c.getComponentOrientation().isLeftToRight(); } /** ! * Returns the ui that is of type {@code klass}, or null if * one can not be found. */ static Object getUIOfType(ComponentUI ui, Class<?> klass) { if (klass.isInstance(ui)) { return ui; } return null; } /** ! * Creates the Synth look and feel {@code ComponentUI} for ! * the passed in {@code JComponent}. * ! * @param c JComponent to create the {@code ComponentUI} for ! * @return ComponentUI to use for {@code c} */ public static ComponentUI createUI(JComponent c) { String key = c.getUIClassID().intern(); if (key == "ButtonUI") {
*** 533,567 **** /** * Creates a SynthLookAndFeel. * <p> ! * For the returned <code>SynthLookAndFeel</code> to be useful you need to ! * invoke <code>load</code> to specify the set of ! * <code>SynthStyle</code>s, or invoke <code>setStyleFactory</code>. * * @see #load * @see #setStyleFactory */ public SynthLookAndFeel() { factory = new DefaultSynthStyleFactory(); _handler = new Handler(); } /** ! * Loads the set of <code>SynthStyle</code>s that will be used by ! * this <code>SynthLookAndFeel</code>. <code>resourceBase</code> is * used to resolve any path based resources, for example an ! * <code>Image</code> would be resolved by ! * <code>resourceBase.getResource(path)</code>. Refer to * <a href="doc-files/synthFileFormat.html">Synth File Format</a> * for more information. * * @param input InputStream to load from * @param resourceBase used to resolve any images or other resources * @throws ParseException if there is an error in parsing ! * @throws IllegalArgumentException if input or resourceBase is <code>null</code> */ public void load(InputStream input, Class<?> resourceBase) throws ParseException { if (resourceBase == null) { throw new IllegalArgumentException( --- 533,567 ---- /** * Creates a SynthLookAndFeel. * <p> ! * For the returned {@code SynthLookAndFeel} to be useful you need to ! * invoke {@code load} to specify the set of ! * {@code SynthStyle}s, or invoke {@code setStyleFactory}. * * @see #load * @see #setStyleFactory */ public SynthLookAndFeel() { factory = new DefaultSynthStyleFactory(); _handler = new Handler(); } /** ! * Loads the set of {@code SynthStyle}s that will be used by ! * this {@code SynthLookAndFeel}. {@code resourceBase} is * used to resolve any path based resources, for example an ! * {@code Image} would be resolved by ! * {@code resourceBase.getResource(path)}. Refer to * <a href="doc-files/synthFileFormat.html">Synth File Format</a> * for more information. * * @param input InputStream to load from * @param resourceBase used to resolve any images or other resources * @throws ParseException if there is an error in parsing ! * @throws IllegalArgumentException if input or resourceBase is {@code null} */ public void load(InputStream input, Class<?> resourceBase) throws ParseException { if (resourceBase == null) { throw new IllegalArgumentException(
*** 575,597 **** new SynthParser().parse(input, (DefaultSynthStyleFactory) factory, null, resourceBase, defaultsMap); } /** ! * Loads the set of <code>SynthStyle</code>s that will be used by ! * this <code>SynthLookAndFeel</code>. Path based resources are resolved ! * relatively to the specified <code>URL</code> of the style. For example ! * an <code>Image</code> would be resolved by ! * <code>new URL(synthFile, path)</code>. Refer to * <a href="doc-files/synthFileFormat.html">Synth File Format</a> for more * information. * ! * @param url the <code>URL</code> to load the set of ! * <code>SynthStyle</code> from * @throws ParseException if there is an error in parsing ! * @throws IllegalArgumentException if synthSet is <code>null</code> ! * @throws IOException if synthSet cannot be opened as an <code>InputStream</code> * @since 1.6 */ public void load(URL url) throws ParseException, IOException { if (url == null) { throw new IllegalArgumentException( --- 575,597 ---- new SynthParser().parse(input, (DefaultSynthStyleFactory) factory, null, resourceBase, defaultsMap); } /** ! * Loads the set of {@code SynthStyle}s that will be used by ! * this {@code SynthLookAndFeel}. Path based resources are resolved ! * relatively to the specified {@code URL} of the style. For example ! * an {@code Image} would be resolved by ! * {@code new URL(synthFile, path)}. Refer to * <a href="doc-files/synthFileFormat.html">Synth File Format</a> for more * information. * ! * @param url the {@code URL} to load the set of ! * {@code SynthStyle} from * @throws ParseException if there is an error in parsing ! * @throws IllegalArgumentException if synthSet is {@code null} ! * @throws IOException if synthSet cannot be opened as an {@code InputStream} * @since 1.6 */ public void load(URL url) throws ParseException, IOException { if (url == null) { throw new IllegalArgumentException(
*** 747,764 **** return "Synth"; } /** * Returns whether or not the UIs should update their ! * <code>SynthStyles</code> from the <code>SynthStyleFactory</code> ! * when the ancestor of the <code>JComponent</code> changes. A subclass ! * that provided a <code>SynthStyleFactory</code> that based the ! * return value from <code>getStyle</code> off the containment hierarchy * would override this method to return true. * * @return whether or not the UIs should update their ! * <code>SynthStyles</code> from the <code>SynthStyleFactory</code> * when the ancestor changed. */ public boolean shouldUpdateStyleOnAncestorChanged() { return false; } --- 747,764 ---- return "Synth"; } /** * Returns whether or not the UIs should update their ! * {@code SynthStyles} from the {@code SynthStyleFactory} ! * when the ancestor of the {@code JComponent} changes. A subclass ! * that provided a {@code SynthStyleFactory} that based the ! * return value from {@code getStyle} off the containment hierarchy * would override this method to return true. * * @return whether or not the UIs should update their ! * {@code SynthStyles} from the {@code SynthStyleFactory} * when the ancestor changed. */ public boolean shouldUpdateStyleOnAncestorChanged() { return false; }
< prev index next >