Index: src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties =================================================================== --- src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties (revision 521317) +++ src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties (working copy) @@ -194,6 +194,7 @@ swing.B1=TextUI needs JTextComponent swing.B2='{0}' must be one of: '{1}' swing.B3=condition must be one of '{0}' or '{1}' +swing.B4=Synth Look and Feel swing.err.01=Illegal request swing.err.02=BoxLayout should be used for one container only @@ -221,3 +222,4 @@ swing.err.19=Can't create value holder for {0} of type {1} swing.err.1A=Lexical error at line {0}, column {1}. Encountered: swing.err.1B=after : \ +swing.err.1C=Cannot calculate ColorType. Key is: \ No newline at end of file Index: src/main/java/common/javax/swing/plaf/synth/ColorType.java =================================================================== --- src/main/java/common/javax/swing/plaf/synth/ColorType.java (revision 0) +++ src/main/java/common/javax/swing/plaf/synth/ColorType.java (revision 0) @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.swing.plaf.synth; + +import org.apache.harmony.x.swing.internal.nls.Messages; + +/** + * The class used to mark the states in coloring JComponents + */ +public class ColorType { + + public static final ColorType FOCUS = new ColorType("focus"); //$NON-NLS-1$ + + public static final ColorType BACKGROUND = new ColorType("background"); //$NON-NLS-1$ + + public static final ColorType FOREGROUND = new ColorType("foreground"); //$NON-NLS-1$ + + public static final ColorType TEXT_BACKGROUND = new ColorType( + "text_background"); //$NON-NLS-1$ + + public static final ColorType TEXT_FOREGROUND = new ColorType( + "text_foreground"); //$NON-NLS-1$ + + /** The number of created color types */ + public static int MAX_COUNT; + + private String description; + + private int id; + + protected ColorType(String description) { + this.description = description; + this.id = MAX_COUNT; + MAX_COUNT++; + } + + /** @return The unique number id of the current ColorType */ + public int getID() { + return id; + } + + /** @return String describes ColorType */ + @Override + public String toString() { + return this.description; + } + + static ColorType calculateColorType(String key) { + + key.intern(); + + if (key == "BACKGROUND") { //$NON-NLS-1$ + return BACKGROUND; + } else if (key == "FOREGROUND") { //$NON-NLS-1$ + return FOREGROUND; + } else if (key == "TEXT_BACKGROUND") { //$NON-NLS-1$ + return TEXT_BACKGROUND; + } else if (key == "TEXT_FOREGROUND") { //$NON-NLS-1$ + return TEXT_FOREGROUND; + } else if (key == "FOCUS") { //$NON-NLS-1$ + return FOCUS; + } + + throw new IllegalStateException(Messages.getString("swing.err.09") //$NON-NLS-1$ + + key); + } + +} Index: src/main/java/common/javax/swing/plaf/synth/SynthConstants.java =================================================================== --- src/main/java/common/javax/swing/plaf/synth/SynthConstants.java (revision 0) +++ src/main/java/common/javax/swing/plaf/synth/SynthConstants.java (revision 0) @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.swing.plaf.synth; + +/** + * The SynthConstants contains possible states for the Component. The states + * divided into 2 groups: primary (at least one of the states should be present) + * and additional (component state may also contain this states) + */ +public interface SynthConstants { + + /** The component (usual a button) is marked as default (additional) */ + static int DEFAULT = 1024; + + /** The component is disabled (primary) */ + static int DISABLED = 8; + + /** The component is enabled (primary) */ + static int ENABLED = 1; + + /** The component is focused (additional) */ + static int FOCUSED = 256; + + /** The mouse arrow is over the component (primary) */ + static int MOUSE_OVER = 2; + + /** The component is in pressed state (primary) */ + static int PRESSED = 4; + + /** The component is selected (additional) */ + static int SELECTED = 512; + +} Index: src/main/java/common/javax/swing/plaf/synth/Region.java =================================================================== --- src/main/java/common/javax/swing/plaf/synth/Region.java (revision 0) +++ src/main/java/common/javax/swing/plaf/synth/Region.java (revision 0) @@ -0,0 +1,239 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.swing.plaf.synth; + +import java.util.HashMap; + +/** + * Region used to markup the type of JComponent to be painted + */ +@SuppressWarnings("nls") +public class Region { + + /** + * All regions depository + */ + public static final HashMap regionsMap = new HashMap(); + + public static final Region ARROW_BUTTON = new Region("ArrowButton", + "ArrowButtonUI", true); + + public static final Region BUTTON = new Region("Button", "ButtonUI", false); + + public static final Region CHECK_BOX = new Region("CheckBox", "CheckBoxUI", + false); + + public static final Region CHECK_BOX_MENU_ITEM = new Region( + "CheckBoxMenuItem", "CheckBoxMenuItemUI", false); + + public static final Region COLOR_CHOOSER = new Region("ColorChooser", + "ColorChooserUI", false); + + public static final Region COMBO_BOX = new Region("ComboBox", "ComboBoxUI", + false); + + public static final Region DESKTOP_ICON = new Region("DesktopIcon", + "DesktopIconUI", false); + + public static final Region DESKTOP_PANE = new Region("DesktopPane", + "DesktopPaneUI", false); + + public static final Region EDITOR_PANE = new Region("EditorPane", + "EditorPaneUI", false); + + public static final Region FILE_CHOOSER = new Region("FileChooser", + "FileChooserUI", false); + + public static final Region FORMATTED_TEXT_FIELD = new Region( + "FormattedTextField", "FormattedTextFieldUI", false); + + public static final Region INTERNAL_FRAME = new Region("InternalFrame", + null, false); + + public static final Region INTERNAL_FRAME_TITLE_PANE = new Region( + "InternalFrameTitlePane", "InternalFrameUI", false); + + public static final Region LABEL = new Region("Label", "LabelUI", false); + + public static final Region LIST = new Region("List", "ListUI", false); + + public static final Region MENU = new Region("Menu", "MenuUI", false); + + public static final Region MENU_BAR = new Region("MenuBar", "MenuBarUI", + false); + + public static final Region MENU_ITEM = new Region("MenuItem", "MenuItemUI", + false); + + public static final Region MENU_ITEM_ACCELERATOR = new Region( + "MenuItemAccelerator", "MenuItemAcceleratorUI", false); + + public static final Region OPTION_PANE = new Region("OptionPane", + "OptionPaneUI", false); + + public static final Region PANEL = new Region("Panel", "PanelUI", false); + + public static final Region PASSWORD_FIELD = new Region("PasswordField", + "PasswordFieldUI", false); + + public static final Region POPUP_MENU = new Region("PopupMenu", + "PopupMenuUI", false); + + public static final Region POPUP_MENU_SEPARATOR = new Region( + "PopupMenuSeparator", "PopupMenuSeparatorUI", false); + + public static final Region PROGRESS_BAR = new Region("ProgressBar", + "ProgressBarUI", false); + + public static final Region RADIO_BUTTON = new Region("RadioButton", + "RadioButtonUI", false); + + public static final Region RADIO_BUTTON_MENU_ITEM = new Region( + "RadioButtonMenuItem", "RadioButtonMenuItemUI", false); + + public static final Region ROOT_PANE = new Region("RootPane", "RootPaneUI", + false); + + public static final Region SCROLL_BAR = new Region("ScrollBar", + "ScrollBarUI", false); + + public static final Region SCROLL_BAR_THUMB = new Region("ScrollBarThumb", + null, true); + + public static final Region SCROLL_BAR_TRACK = new Region("ScrollBarTrack", + null, true); + + public static final Region SCROLL_PANE = new Region("ScrollPane", + "ScrollPaneUI", false); + + public static final Region SEPARATOR = new Region("Separator", + "SeparatorUI", false); + + public static final Region SLIDER = new Region("Slider", "SliderUI", false); + + public static final Region SLIDER_THUMB = new Region("SliderThumb", null, + true); + + public static final Region SLIDER_TRACK = new Region("SliderTrack", null, + true); + + public static final Region SPINNER = new Region("Spinner", "SpinnerUI", + false); + + public static final Region SPLIT_PANE = new Region("SplitPane", + "SplitPaneUI", false); + + public static final Region SPLIT_PANE_DIVIDER = new Region( + "SplitPaneDivider", null, true); + + public static final Region TABBED_PANE = new Region("TabbedPane", + "TabbedPaneUI", false); + + public static final Region TABBED_PANE_CONTENT = new Region( + "TabbedPaneContent", null, true); + + public static final Region TABBED_PANE_TAB = new Region("TabbedPaneTab", + null, true); + + public static final Region TABBED_PANE_TAB_AREA = new Region( + "TabbedPaneTabArea", null, true); + + public static final Region TABLE = new Region("Table", "TableUI", false); + + public static final Region TABLE_HEADER = new Region("TableHeader", + "TableHeaderUI", false); + + public static final Region TEXT_AREA = new Region("TextArea", "TextAreaUI", + false); + + public static final Region TEXT_FIELD = new Region("TextField", + "TextFieldUI", false); + + public static final Region TEXT_PANE = new Region("TextPane", "TextPaneUI", + false); + + public static final Region TOGGLE_BUTTON = new Region("ToggleButton", + "ToggleButtonUI", false); + + public static final Region TOOL_BAR = new Region("ToolBar", "ToolBarUI", + false); + + public static final Region TOOL_BAR_CONTENT = new Region("ToolBarContent", + null, true); + + public static final Region TOOL_BAR_DRAG_WINDOW = new Region( + "ToolBarDragWindow", "ToolBarDragWindowUI", false); + + public static final Region TOOL_BAR_SEPARATOR = new Region( + "ToolBarSeparator", "ToolBarSeparatorUI", false); + + public static final Region TOOL_TIP = new Region("ToolTip", "ToolTipUI", + false); + + public static final Region TREE = new Region("Tree", "TreeUI", false); + + public static final Region TREE_CELL = new Region("TreeCell", null, true); + + public static final Region VIEWPORT = new Region("Viewport", "ViewportUI", + false); + + private String name; + + private String uiName; + + private boolean isSub; + + protected Region(String name, String ui, boolean subregion) { + this.name = name; + this.isSub = subregion; + this.uiName = ui; + regionsMap.put(name, this); + } + + /** + * @return the region corresponds given UI String + */ + static Region getRegionFromUIID(String ui) { + + return regionsMap.get(ui.substring(0, (ui.length() - 2))); + } + + public String getName() { + + return this.name; + } + + public boolean isSubregion() { + + return this.isSub; + } + + @Override + public String toString() { + + return this.uiName; + } + + /** + * @return the region corresponds given name String + */ + public static Region getRegionFromName(String reference) { + + return regionsMap.get(reference); + } +} Index: src/main/java/common/javax/swing/plaf/synth/SynthStyle.java =================================================================== --- src/main/java/common/javax/swing/plaf/synth/SynthStyle.java (revision 0) +++ src/main/java/common/javax/swing/plaf/synth/SynthStyle.java (revision 0) @@ -0,0 +1,165 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.swing.plaf.synth; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Insets; +import java.util.HashMap; + +import javax.swing.Icon; +import javax.swing.JComponent; + +/** + * SynthStyle contains all the information about component drawing + */ +public abstract class SynthStyle { + + protected boolean isOpaque = true; + + protected SynthGraphicsUtils gUtils = new SynthGraphicsUtils(); + + protected HashMap propertiesMap = new HashMap(); + + protected Insets insets = new Insets(0, 0, 0, 0); + + static int getCommonComponentState(JComponent c) { + int result = c.isEnabled() ? SynthConstants.ENABLED + : SynthConstants.DISABLED; + if (c.isFocusOwner()) { + result |= SynthConstants.FOCUSED; + } + return result; + } + + public Object get(@SuppressWarnings("unused") + SynthContext context, Object key) { + return propertiesMap.get(key); + } + + public boolean getBoolean(SynthContext context, Object key, + boolean defaultValue) { + Boolean result = (Boolean) get(context, key); + return (result == null) ? defaultValue : result.booleanValue(); + } + + /** + * Verifies the colors defined in component than calls getColorForState + */ + public Color getColor(SynthContext context, ColorType type) { + JComponent c = context.getComponent(); + if (c.isEnabled()) { + + if (type == ColorType.BACKGROUND) { + + if (c.getBackground() != null) { + return c.getBackground(); + } + + } else if (type == ColorType.FOREGROUND) { + + if (c.getForeground() != null) { + return c.getForeground(); + } + } + } + + return getColorForState(context, type); + } + + public Font getFont(SynthContext context) { + Font result = context.getComponent().getFont(); + if (result == null) { + return getFontForState(context); + } + return result; + } + + protected abstract Font getFontForState(SynthContext context); + + /** + * The default implementation just casts Object returned by get(Object, key + * method) + */ + public Icon getIcon(SynthContext context, Object key) { + return (Icon) get(context, key); + } + + @SuppressWarnings("unused") + public Insets getInsets(SynthContext context, Insets modified) { + + if (modified == null) { + return (Insets) insets.clone(); + } + + modified.set(insets.top, insets.left, insets.bottom, insets.right); + + return modified; + } + + public int getInt(SynthContext context, Object key, int defaultValue) { + try { + return Integer.parseInt((String) get(context, key)); + } catch (NumberFormatException e) { + return defaultValue; + } + } + + /** + * @return The default implementation returns null + */ + public SynthPainter getPainter(@SuppressWarnings("unused") + SynthContext context) { + return null; + } + + public String getString(SynthContext context, Object key, + String defaultValue) { + String result = (String) get(context, key); + return (result == null) ? defaultValue : result; + } + + /** The default implementation is empty */ + @SuppressWarnings("unused") + public void installDefaults(SynthContext context) { + // Empty + } + + @SuppressWarnings("unused") + public boolean isOpaque(SynthContext context) { + return isOpaque; + } + + /** The default implementation is empty */ + @SuppressWarnings("unused") + public void uninstallDefaults(SynthContext context) { + // Empty + } + + protected abstract Color getColorForState(SynthContext context, + ColorType type); + + /** + * @return GraphicsUtils used for specified context. The default + * implementation returns default GraphicsUtils for any context. + */ + public SynthGraphicsUtils getGraphicsUtils(@SuppressWarnings("unused") + SynthContext context) { + return gUtils; + } +} Index: src/main/java/common/javax/swing/plaf/synth/SynthGraphicsUtils.java =================================================================== --- src/main/java/common/javax/swing/plaf/synth/SynthGraphicsUtils.java (revision 0) +++ src/main/java/common/javax/swing/plaf/synth/SynthGraphicsUtils.java (revision 0) @@ -0,0 +1,261 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.swing.plaf.synth; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.font.FontRenderContext; +import java.awt.geom.Rectangle2D; + +import javax.swing.Icon; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; + +import org.apache.harmony.x.swing.ButtonCommons; +import org.apache.harmony.x.swing.Utilities; + +public class SynthGraphicsUtils { + + /** + * Calculate string width with given parameters + * + * @param context + * SynthContext to specify component + * @param font + * Font used to draw the string (if null font calculates from the + * SynthContext) + * @param metrics + * FontMetrics used to draw the string (if null metrics + * calculates from the SynthContext) + * @param text + * String to draw + */ + public int computeStringWidth(SynthContext context, Font font, + FontMetrics metrics, String text) { + computeFontMetrics(context, font, metrics); + + return metrics.stringWidth(text); + } + + /** + * Calculate string height from Context + * + * @param context + * SynthContext to specify component + */ + public int getMaximumCharHeight(SynthContext context) { + Rectangle2D maxBounds = getFont(context).getMaxCharBounds( + new FontRenderContext(null, true, true)); + + return (int) Math.ceil(maxBounds.getHeight()); + } + + /** + * Draws a line + */ + @SuppressWarnings("unused") + public void drawLine(SynthContext context, Object paintKey, Graphics g, + int x1, int y1, int x2, int y2) { + context.getStyle().getColor(context, ColorType.FOREGROUND); + g.drawLine(x1, y1, x2, y2); + } + + /** + * Calculates the maximum size for the component with given parameters + */ + @SuppressWarnings("unused") + public Dimension getMaximumSize(SynthContext ss, Font font, String text, + Icon icon, int hAlign, int vAlign, int hTextPosition, + int vTextPosition, int iconTextGap, int mnemonicIndex) { + + final FontMetrics fm = computeFontMetrics(ss, font, null); + + Dimension size = getCompoundLabelSize(fm, text, icon, vTextPosition, + hTextPosition, iconTextGap); + + return Utilities.addInsets(size, ss.getStyle().getInsets(ss, + new Insets(0, 0, 0, 0))); + } + + /** + * Calculates the minimum size for the component with given parameters + */ + public Dimension getMinimumSize(SynthContext ss, Font font, String text, + Icon icon, int hAlign, int vAlign, int hTextPosition, + int vTextPosition, int iconTextGap, int mnemonicIndex) { + + return getMaximumSize(ss, font, text, icon, hAlign, vAlign, + hTextPosition, vTextPosition, iconTextGap, mnemonicIndex); + } + + /** + * Calculates the preferred size for the component with given parameters + */ + public Dimension getPreferredSize(SynthContext ss, Font font, String text, + Icon icon, int hAlign, int vAlign, int hTextPosition, + int vTextPosition, int iconTextGap, int mnemonicIndex) { + + return getMaximumSize(ss, font, text, icon, hAlign, vAlign, + hTextPosition, vTextPosition, iconTextGap, mnemonicIndex); + } + + /** + * Layouts text and Icon in the complex JComponent + */ + public String layoutText(SynthContext ss, FontMetrics fm, String text, + Icon icon, int hAlign, int vAlign, int hTextPosition, + int vTextPosition, Rectangle viewR, Rectangle iconR, + final Rectangle textR, int iconTextGap) { + + fm = computeFontMetrics(ss, getFont(ss), fm); + + SwingUtilities.layoutCompoundLabel(fm, text, icon, vAlign, hAlign, + vTextPosition, hTextPosition, viewR, iconR, textR, iconTextGap); + + return text; + } + + public void paintText(SynthContext ss, Graphics g, String text, Icon icon, + int hAlign, int vAlign, int hTextPosition, int vTextPosition, + int iconTextGap, int mnemonicIndex, int textOffset) { + + FontMetrics metrics = computeFontMetrics(ss, getFont(ss), null); + + Color color = ss.getStyle().getColor(ss, ColorType.TEXT_FOREGROUND); + + Rectangle textR = getTextRect(text, metrics); + Rectangle iconR = getIconRect(icon); + + Insets insets = ss.getStyle().getInsets(ss, new Insets(0, 0, 0, 0)); + Rectangle viewR = Utilities.subtractInsets(g.getClipBounds(), insets); + + layoutText(ss, metrics, text, icon, hAlign, vAlign, hTextPosition, + vTextPosition, viewR, iconR, textR, iconTextGap); + + textR.x += textOffset; + textR.y += textOffset; + + ButtonCommons.paintText(g, metrics, text, mnemonicIndex, textR, text, + color); + } + + public void paintText(SynthContext ss, Graphics g, String text, int x, + int y, int mnemonicIndex) { + + Color color = ss.getStyle().getColor(ss, ColorType.TEXT_FOREGROUND); + FontMetrics metrics = computeFontMetrics(ss, getFont(ss), null); + Rectangle textR = getTextRect(text, metrics); + textR.x = x; + textR.y = y; + ButtonCommons.paintText(g, metrics, text, mnemonicIndex, textR, text, + color); + } + + public void paintText(SynthContext ss, Graphics g, String text, + Rectangle bounds, int mnemonicIndex) { + + Color color = ss.getStyle().getColor(ss, ColorType.TEXT_FOREGROUND); + FontMetrics metrics = computeFontMetrics(ss, getFont(ss), null); + ButtonCommons.paintText(g, metrics, text, mnemonicIndex, bounds, text, + color); + } + + /** + * This method calculates Font metrics from context + */ + protected FontMetrics computeFontMetrics(SynthContext context, Font font, + FontMetrics metrics) { + + if (font == null) { + font = context.getStyle().getFont(context); + } + + if (metrics == null) { + metrics = context.getComponent().getFontMetrics(font); + } + + return metrics; + } + + /** + * This method calculates Font from context + */ + protected Font getFont(SynthContext context) { + + return context.getStyle().getFont(context); + } + + /** + * @param text + * text to be outlined + * @param fm + * the FontMetrics of the text + * @return outline Rectangle + */ + private static Rectangle getTextRect(String text, FontMetrics fm) { + + if (!Utilities.isEmptyString(text)) { + Dimension stringDim = Utilities.getStringSize(text, fm); + Dimension size = new Dimension(stringDim.width, Utilities.getTextY( + fm, new Rectangle(stringDim))); + + return new Rectangle(size); + } + + return new Rectangle(); + } + + private static Dimension getCompoundLabelSize(FontMetrics fm, + final String text, final Icon icon, final int verticalTextPosition, + final int horizontalTextPosition, final int iconTextGap) { + + final Dimension result = new Dimension(); + Rectangle viewR = new Rectangle(Short.MAX_VALUE, Short.MAX_VALUE); + Rectangle iconR = new Rectangle(); + Rectangle textR = new Rectangle(); + + SwingUtilities.layoutCompoundLabel(fm, text, icon, SwingConstants.TOP, + SwingConstants.LEFT, verticalTextPosition, + horizontalTextPosition, viewR, iconR, textR, iconTextGap); + result.width = Math.max(iconR.x + iconR.width, textR.x + textR.width); + result.height = Math + .max(iconR.y + iconR.height, textR.y + textR.height); + + return result; + } + + /** + * @param icon + * Icon to be outlined + * @return outline Rectangle + */ + private static Rectangle getIconRect(Icon icon) { + + if (icon != null) { + return new Rectangle(icon.getIconWidth(), icon.getIconHeight()); + } + + return new Rectangle(); + } + +} Index: src/main/java/common/javax/swing/plaf/synth/SynthPainter.java =================================================================== --- src/main/java/common/javax/swing/plaf/synth/SynthPainter.java (revision 0) +++ src/main/java/common/javax/swing/plaf/synth/SynthPainter.java (revision 0) @@ -0,0 +1,593 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.swing.plaf.synth; + +import java.awt.Graphics; + +/** + * SynthPainter class provides the methods for painting all the JComponents. All + * the paint methods are internally blank. + */ +@SuppressWarnings("unused") +public abstract class SynthPainter { + + public void paintArrowButtonBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintArrowButtonBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintArrowButtonForeground(SynthContext context, Graphics g, + int x, int y, int w, int h, int direction) { + // Blank + } + + public void paintButtonBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintButtonBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintCheckBoxBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintCheckBoxBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintCheckBoxMenuItemBackground(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintCheckBoxMenuItemBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintColorChooserBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintColorChooserBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintComboBoxBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintComboBoxBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintDesktopIconBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintDesktopIconBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintDesktopPaneBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintDesktopPaneBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintEditorPaneBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintEditorPaneBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintFileChooserBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintFileChooserBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintFormattedTextFieldBackground(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintFormattedTextFieldBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintInternalFrameBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintInternalFrameBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintInternalFrameTitlePaneBackground(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintInternalFrameTitlePaneBorder(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintLabelBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintLabelBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintListBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintListBorder(SynthContext context, Graphics g, int x, int y, + int w, int h) { + // Blank + } + + public void paintMenuBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintMenuBarBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintMenuBarBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintMenuBorder(SynthContext context, Graphics g, int x, int y, + int w, int h) { + // Blank + } + + public void paintMenuItemBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintMenuItemBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintOptionPaneBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintOptionPaneBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintPanelBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintPanelBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintPasswordFieldBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintPasswordFieldBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintPopupMenuBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintPopupMenuBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintProgressBarBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintProgressBarBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintProgressBarForeground(SynthContext context, Graphics g, + int x, int y, int w, int h, int orientation) { + // Blank + } + + public void paintRadioButtonBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintRadioButtonBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintRadioButtonMenuItemBackground(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintRadioButtonMenuItemBorder(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintRootPaneBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintRootPaneBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintScrollBarBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintScrollBarBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintScrollBarThumbBackground(SynthContext context, Graphics g, + int x, int y, int w, int h, int orientation) { + // Blank + } + + public void paintScrollBarThumbBorder(SynthContext context, Graphics g, + int x, int y, int w, int h, int orientation) { + // Blank + } + + public void paintScrollBarTrackBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintScrollBarTrackBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintScrollPaneBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintScrollPaneBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintSeparatorBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintSeparatorBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintSeparatorForeground(SynthContext context, Graphics g, + int x, int y, int w, int h, int orientation) { + // Blank + } + + public void paintSliderBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintSliderBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintSliderThumbBackground(SynthContext context, Graphics g, + int x, int y, int w, int h, int orientation) { + // Blank + } + + public void paintSliderThumbBorder(SynthContext context, Graphics g, int x, + int y, int w, int h, int orientation) { + // Blank + } + + public void paintSliderTrackBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintSliderTrackBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintSpinnerBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintSpinnerBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintSplitPaneBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintSplitPaneBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintSplitPaneDividerBackground(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintSplitPaneDividerForeground(SynthContext context, + Graphics g, int x, int y, int w, int h, int orientation) { + // Blank + } + + public void paintSplitPaneDragDivider(SynthContext context, Graphics g, + int x, int y, int w, int h, int orientation) { + // Blank + } + + public void paintTabbedPaneBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintTabbedPaneBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintTabbedPaneContentBackground(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintTabbedPaneContentBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintTabbedPaneTabAreaBackground(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintTabbedPaneTabAreaBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, + int x, int y, int w, int h, int tabIndex) { + // Blank + } + + public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, + int x, int y, int w, int h, int tabIndex) { + // Blank + } + + public void paintTableBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintTableBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintTableHeaderBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintTableHeaderBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintTextAreaBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintTextAreaBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintTextFieldBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintTextFieldBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintTextPaneBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintTextPaneBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintToggleButtonBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintToggleButtonBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintToolBarBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintToolBarBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintToolBarContentBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintToolBarContentBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintToolBarDragWindowBackground(SynthContext context, + Graphics g, int x, int y, int w, int h) { + // Blank + } + + public void paintToolBarDragWindowBorder(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintToolTipBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintToolTipBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintTreeBackground(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintTreeBorder(SynthContext context, Graphics g, int x, int y, + int w, int h) { + // Blank + } + + public void paintTreeCellBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintTreeCellBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintTreeCellFocus(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } + + public void paintViewportBackground(SynthContext context, Graphics g, + int x, int y, int w, int h) { + // Blank + } + + public void paintViewportBorder(SynthContext context, Graphics g, int x, + int y, int w, int h) { + // Blank + } +} Index: src/main/java/common/javax/swing/plaf/synth/SynthLookAndFeel.java =================================================================== --- src/main/java/common/javax/swing/plaf/synth/SynthLookAndFeel.java (revision 0) +++ src/main/java/common/javax/swing/plaf/synth/SynthLookAndFeel.java (revision 0) @@ -0,0 +1,205 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.swing.plaf.synth; + +import java.awt.Component; +import java.io.InputStream; +import java.io.Serializable; +import java.text.ParseException; + +import javax.swing.JComponent; +import javax.swing.UIDefaults; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicLookAndFeel; + +import org.apache.harmony.x.swing.internal.nls.Messages; + +public class SynthLookAndFeel extends BasicLookAndFeel implements Serializable { + + private final static String packageName = new SynthLookAndFeel().getClass() + .getPackage().getName(); + + private static SynthStyleFactory currentFactory; + + private UIDefaults uiDefaults; + + public static SynthStyle getStyle(JComponent c, Region r) { + + return currentFactory.getStyle(c, r); + } + + public static SynthStyleFactory getStyleFactory() { + + return currentFactory; + } + + public static void setStyleFactory(SynthStyleFactory proposed) { + currentFactory = proposed; + } + + /** + * Creates the Synth UI object corresponds JComponent given + */ + public static ComponentUI createUI(JComponent c) { + + try { + + return (ComponentUI) Class.forName(packageName + c.getUIClassID()) + .getMethod("createUI", JComponent.class).invoke(null, c); //$NON-NLS-1$ + + } catch (Exception e) { + + return null; + } + } + + /** + * Renew the synth styles for the JComponent. This method isn't fully + * correct, but does what needs + */ + public static void updateStyles(Component c) { + + if (c instanceof JComponent) { + ((JComponent) c).revalidate(); + } + } + + /** + * Calculates the region corresponds JComponent given + */ + public static Region getRegion(JComponent c) { + + return Region.getRegionFromUIID(c.getUIClassID()); + } + + @Override + public String getName() { + + return "Synth Look and Feel"; //$NON-NLS-1$ + } + + @Override + public String getID() { + + return "Synth"; //$NON-NLS-1$ + } + + @Override + public String getDescription() { + + return Messages.getString("swing.B4"); //$NON-NLS-1$ + } + + @Override + public boolean isNativeLookAndFeel() { + + return false; + } + + @Override + public boolean isSupportedLookAndFeel() { + + return true; + } + + @Override + public UIDefaults getDefaults() { + + if (uiDefaults == null) { + uiDefaults = new UIDefaults(); + initClassDefaults(uiDefaults); + initComponentDefaults(uiDefaults); + } + + return uiDefaults; + } + + @Override + public void initialize() { + // Do nothing + } + + @Override + public void uninitialize() { + // Do nothing + } + + @SuppressWarnings("unused") + public void load(InputStream input, Class resourceBase) + throws ParseException, IllegalArgumentException { + /* + * This class will be implemented with XMLSynthParser + */ + } + + /** The default implementation returns false */ + public boolean shouldUpdateStyleOnAncestorChanged() { + + return false; + } + + @SuppressWarnings("nls") + @Override + protected void initClassDefaults(UIDefaults defaults) { + Object[] initDefaults = { "InternalFrameUI", + packageName + "SynthInternalFrameUI", "ViewportUI", + packageName + "SynthViewportUI", "ScrollBarUI", + packageName + "SynthScrollBarUI", "ToolTipUI", + packageName + "SynthToolTipUI", "MenuItemUI", + packageName + "SynthMenuItemUI", "MenuUI", + packageName + "SynthMenuUI", "TextAreaUI", + packageName + "SynthTextAreaUI", "PopupMenuUI", + packageName + "SynthPopupMenuUI", "ScrollPaneUI", + packageName + "SynthScrollPaneUI", "SliderUI", + packageName + "SynthSliderUI", "ComboBoxUI", + packageName + "SynthComboBoxUI", "RadioButtonUI", + packageName + "SynthRadioButtonUI", "FormattedTextFieldUI", + packageName + "SynthFormattedTextFieldUI", "TreeUI", + packageName + "SynthTreeUI", "MenuBarUI", + packageName + "SynthMenuBarUI", "RadioButtonMenuItemUI", + packageName + "SynthRadioButtonMenuItemUI", "ProgressBarUI", + packageName + "SynthProgressBarUI", "ToolBarUI", + packageName + "SynthToolBarUI", "ColorChooserUI", + packageName + "SynthColorChooserUI", "ToolBarSeparatorUI", + packageName + "SynthToolBarSeparatorUI", "TabbedPaneUI", + packageName + "SynthTabbedPaneUI", "DesktopPaneUI", + packageName + "SynthDesktopPaneUI", "TableUI", + packageName + "SynthTableUI", "PanelUI", + packageName + "SynthPanelUI", "CheckBoxMenuItemUI", + packageName + "SynthCheckBoxMenuItemUI", "PasswordFieldUI", + packageName + "SynthPasswordFieldUI", "CheckBoxUI", + packageName + "SynthCheckBoxUI", "TableHeaderUI", + packageName + "SynthTableHeaderUI", "SplitPaneUI", + packageName + "SynthSplitPaneUI", "EditorPaneUI", + packageName + "SynthEditorPaneUI", "ListUI", + packageName + "SynthListUI", "SpinnerUI", + packageName + "SynthSpinnerUI", "DesktopIconUI", + packageName + "SynthDesktopIconUI", "TextFieldUI", + packageName + "SynthTextFieldUI", "TextPaneUI", + packageName + "SynthTextPaneUI", "LabelUI", + packageName + "SynthLabelUI", "ButtonUI", + packageName + "SynthButtonUI", "ToggleButtonUI", + packageName + "SynthToggleButtonUI", "OptionPaneUI", + packageName + "SynthOptionPaneUI", "PopupMenuSeparatorUI", + packageName + "SynthPopupMenuSeparatorUI", "RootPaneUI", + packageName + "SynthRootPaneUI", "SeparatorUI", + packageName + "SynthSeparatorUI" }; + defaults.putDefaults(initDefaults); + } + +} Index: src/main/java/common/javax/swing/plaf/synth/SynthContext.java =================================================================== --- src/main/java/common/javax/swing/plaf/synth/SynthContext.java (revision 0) +++ src/main/java/common/javax/swing/plaf/synth/SynthContext.java (revision 0) @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.swing.plaf.synth; + +import javax.swing.JComponent; + +public class SynthContext { + + private JComponent component; + + private SynthStyle style; + + private int state; + + private Region region; + + /** + * Constructs SynthContext with given parameters + */ + public SynthContext(JComponent component, Region region, SynthStyle style, + int state) { + this.component = component; + this.style = style; + this.state = state; + this.region = region; + } + + /** + * For the most of UIs context needed to represent style and state + */ + SynthContext(SynthStyle style, int state) { + this.style = style; + this.state = state; + } + + /** + * Sometimes context just represents currentState + */ + SynthContext(int state) { + this.state = state; + } + + /** + * @return The component uses this context + */ + public JComponent getComponent() { + return component; + } + + /** + * @return The state for the component uses this context + */ + public int getComponentState() { + return state; + } + + /** @return parent style */ + public SynthStyle getStyle() { + return style; + } + + /** @return the region of the context */ + public Region getRegion() { + return region; + } + + protected void setState(int state) { + this.state = state; + } + + /** + * Removes proposed state from current if it exists + */ + protected void lossState(int proposed) { + + if ((state & proposed) != 0) { + this.state -= proposed; + } + } + + /** + * Adds additional state to current if it doesn't exist + */ + protected void gainState(int proposed) { + this.state |= proposed; + } +} Index: src/main/java/common/javax/swing/plaf/synth/SynthStyleFactory.java =================================================================== --- src/main/java/common/javax/swing/plaf/synth/SynthStyleFactory.java (revision 0) +++ src/main/java/common/javax/swing/plaf/synth/SynthStyleFactory.java (revision 0) @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package javax.swing.plaf.synth; + +import javax.swing.JComponent; + +public abstract class SynthStyleFactory { + + public abstract SynthStyle getStyle(JComponent c, Region id); + +}