This is an automated email from the ASF dual-hosted git repository. matthiasblaesing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new 83a929c Larger icon sizes missing in platform branding UI #3544 new 76be2da Merge pull request #3551 from aldobrucale/branding-larger-icons 83a929c is described below commit 83a929c1310440c38846d421acefd8b17d37ddcb Author: Aldo Brucale <aldo.bruc...@imavis.com> AuthorDate: Mon Jan 31 20:33:15 2022 +0100 Larger icon sizes missing in platform branding UI #3544 --- .../apisupport/project/spi/BrandingModel.java | 44 ++- .../project/ui/branding/BasicBrandingPanel.form | 250 +++++-------- .../project/ui/branding/BasicBrandingPanel.java | 390 +++++++++------------ .../project/ui/branding/Bundle.properties | 3 - 4 files changed, 300 insertions(+), 387 deletions(-) diff --git a/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/spi/BrandingModel.java b/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/spi/BrandingModel.java index 936225f..7f438dc 100644 --- a/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/spi/BrandingModel.java +++ b/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/spi/BrandingModel.java @@ -68,6 +68,9 @@ public abstract class BrandingModel { private @NullAllowed BrandingSupport.BrandedFile icon48 = null; private BrandingSupport.BrandedFile icon16 = null; private BrandingSupport.BrandedFile icon32 = null; + private BrandingSupport.BrandedFile icon256 = null; + private BrandingSupport.BrandedFile icon512 = null; + private BrandingSupport.BrandedFile icon1024 = null; /** representation of bundle keys depending on app.title */ private BrandingSupport.BundleKey productInformation = null; @@ -195,6 +198,12 @@ public abstract class BrandingModel { return icon32 != null ? icon32.getBrandingSource() : null; case 48: return icon48 != null ? icon48.getBrandingSource() : null; + case 256: + return icon256 != null ? icon256.getBrandingSource() : null; + case 512: + return icon512 != null ? icon512.getBrandingSource() : null; + case 1024: + return icon1024 != null ? icon1024.getBrandingSource() : null; } throw new IllegalArgumentException("Invalid icon size: " + size); } @@ -212,6 +221,15 @@ public abstract class BrandingModel { case 48: icon = icon48; break; + case 256: + icon = icon256; + break; + case 512: + icon = icon512; + break; + case 1024: + icon = icon1024; + break; default: throw new IllegalArgumentException("Invalid icon size: " + size); } @@ -258,6 +276,18 @@ public abstract class BrandingModel { if (icon32 != null) { getBranding().brandFile(icon32, getScaleAndStoreIconTask(icon32, 32, 32)); } + + if (icon256 != null) { + getBranding().brandFile(icon256, getScaleAndStoreIconTask(icon256, 256, 256)); + } + + if (icon512 != null) { + getBranding().brandFile(icon512, getScaleAndStoreIconTask(icon512, 512, 512)); + } + + if (icon1024 != null) { + getBranding().brandFile(icon1024, getScaleAndStoreIconTask(icon1024, 1024, 1024)); + } getBranding().brandBundleKeys(splashKeys); if (splash != null) { @@ -444,6 +474,18 @@ public abstract class BrandingModel { icon32 = getBranding().getBrandedFile( "org.netbeans.core.startup",//NOI18N "org/netbeans/core/startup/frame32.gif");//NOI18N + + icon256 = getBranding().getBrandedFile( + "org.netbeans.core.startup",//NOI18N + "org/netbeans/core/startup/frame256.png");//NOI18N + + icon512 = getBranding().getBrandedFile( + "org.netbeans.core.startup",//NOI18N + "org/netbeans/core/startup/frame512.png");//NOI18N + + icon1024 = getBranding().getBrandedFile( + "org.netbeans.core.startup",//NOI18N + "org/netbeans/core/startup/frame1024.png");//NOI18N splash = getBranding().getBrandedFile( "org.netbeans.core.startup",//NOI18N @@ -657,7 +699,7 @@ public abstract class BrandingModel { generalResourceBundleKeys.clear(); internationalizedResourceBundleKeys.clear(); -} + } private String backslashesToSlashes (String text) { return text.replace('\\', '/'); // NOI18N diff --git a/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/BasicBrandingPanel.form b/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/BasicBrandingPanel.form index f15f67a..57b301d 100644 --- a/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/BasicBrandingPanel.form +++ b/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/BasicBrandingPanel.form @@ -1,4 +1,4 @@ -<?xml version="1.1" encoding="UTF-8" ?> +<?xml version="1.0" encoding="UTF-8" ?> <!-- @@ -22,201 +22,143 @@ --> <Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> - <NonVisualComponents> - <Component class="javax.swing.ButtonGroup" name="buttonGroup1"> - </Component> - </NonVisualComponents> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> - <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> - <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="title" min="-2" pref="170" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="titleValue" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="listScrollPane" min="-2" pref="264" max="-2" attributes="0"/> + <EmptySpace min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="browse" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="previewScrollPane" alignment="0" pref="319" max="32767" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace min="-2" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="title" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="titleValue" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="browse" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="previewScrollPane" pref="389" max="32767" attributes="0"/> + </Group> + <Component id="listScrollPane" alignment="0" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> <SubComponents> <Component class="javax.swing.JLabel" name="title"> <Properties> - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> - <ComponentRef name="titleValue"/> - </Property> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="LBL_AppTitle" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> </Property> </Properties> <AccessibilityProperties> <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="ACS_Title" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> + <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="ACS_Title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> </Property> </AccessibilityProperties> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="10" insetsLeft="10" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> </Component> <Component class="javax.swing.JTextField" name="titleValue"> <Properties> <Property name="columns" type="int" value="20"/> </Properties> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="1" gridY="0" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="10" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> </Component> - <Component class="javax.swing.JLabel" name="iconPreview48"> - <Properties> - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> - <ComponentRef name="iconPreview48"/> - </Property> - </Properties> + <Container class="javax.swing.JScrollPane" name="listScrollPane"> <AuxValues> - <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ImagePreview(48,48);"/> + <AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/> + <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> </AuxValues> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="1" gridY="3" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> - </Component> - <Component class="javax.swing.JButton" name="browse48"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="CTL_Browse" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> - </Property> - </Properties> - <AccessibilityProperties> - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="ACS_Browse" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> - </Property> - </AccessibilityProperties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browse48ActionPerformed"/> - </Events> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="2" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> - </Component> - <Component class="javax.swing.JLabel" name="icon48"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="LBL_AppIcon48" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> - </Property> - </Properties> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="10" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> - </Component> - <Component class="javax.swing.JLabel" name="icon16"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="LBL_AppIcon16" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> - </Property> - </Properties> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="23" insetsLeft="10" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> - </Component> - <Component class="javax.swing.JLabel" name="iconPreview16"> - <Properties> - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> - <ComponentRef name="iconPreview48"/> - </Property> - </Properties> - <AuxValues> - <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ImagePreview(16,16);"/> - </AuxValues> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="23" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> - </Component> - <Component class="javax.swing.JButton" name="browse16"> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JList" name="sizeList"> + <Events> + <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="sizeListValueChanged"/> + </Events> + <AuxValues> + <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<Map.Entry<Integer, URL>>"/> + </AuxValues> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="browse"> <Properties> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="CTL_Browse" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> + <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="CTL_Browse" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> </Property> </Properties> <AccessibilityProperties> <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="ACS_Browse" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="ACS_Browse" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> </Property> </AccessibilityProperties> <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browse16ActionPerformed"/> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseActionPerformed"/> </Events> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="23" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> - </Component> - <Component class="javax.swing.JLabel" name="icon32"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="LBL_AppIcon32" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> - </Property> - </Properties> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="10" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> </Component> - <Component class="javax.swing.JLabel" name="iconPreview32"> - <Properties> - <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> - <ComponentRef name="iconPreview48"/> - </Property> - </Properties> + <Container class="javax.swing.JScrollPane" name="previewScrollPane"> <AuxValues> - <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ImagePreview(32,32);"/> + <AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/> + <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/> </AuxValues> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="17" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> - </Component> - <Component class="javax.swing.JButton" name="browse32"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="CTL_Browse" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> - </Property> - </Properties> - <AccessibilityProperties> - <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties" key="ACS_Browse" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </AccessibilityProperties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browse32ActionPerformed"/> - </Events> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> - </Component> - <Component class="javax.swing.JLabel" name="lblSpacer"> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="3" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="10" insetsRight="10" anchor="10" weightX="1.0" weightY="1.0"/> - </Constraint> - </Constraints> - </Component> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Container class="javax.swing.JPanel" name="preview"> + <AuxValues> + <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ImagePreview()"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <EmptySpace min="0" pref="1058" max="32767" attributes="0"/> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <EmptySpace min="0" pref="1898" max="32767" attributes="0"/> + </Group> + </DimensionLayout> + </Layout> + </Container> + </SubComponents> + </Container> </SubComponents> </Form> diff --git a/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/BasicBrandingPanel.java b/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/BasicBrandingPanel.java index 4c713c1..11233d4 100644 --- a/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/BasicBrandingPanel.java +++ b/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/BasicBrandingPanel.java @@ -16,20 +16,29 @@ * specific language governing permissions and limitations * under the License. */ - package org.netbeans.modules.apisupport.project.ui.branding; import org.netbeans.modules.apisupport.project.spi.BrandingModel; -import java.awt.AlphaComposite; +import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; -import java.awt.Graphics2D; +import java.awt.image.BufferedImage; import java.io.File; +import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; -import javax.swing.ImageIcon; +import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; +import static java.util.stream.Collectors.toMap; +import java.util.stream.IntStream; +import javax.imageio.ImageIO; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; import javax.swing.JFileChooser; import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import org.netbeans.modules.apisupport.project.api.UIUtil; @@ -42,18 +51,33 @@ import org.openide.util.Utilities; * * @author Radek Matous, S. Aubrecht */ -final class BasicBrandingPanel extends AbstractBrandingPanel { - - private URL iconSource48; - private URL iconSource32; - private URL iconSource16; +final class BasicBrandingPanel extends AbstractBrandingPanel { + private final SortedMap<Integer, URL> iconSources; private boolean titleValueModified; public BasicBrandingPanel(BrandingModel model) { super(NbBundle.getMessage(BasicBrandingPanel.class, "LBL_BasicTab"), model); //NOI18N - initComponents(); - refresh(); + this.iconSources = IntStream.of(16, 32, 48, 256, 512, 1024).boxed() + .collect(toMap(size -> size, model::getIconSource, + (a, b) -> a, TreeMap::new)); + + initComponents(); + final DefaultListModel<Map.Entry<Integer, URL>> listModel = new DefaultListModel<>(); + iconSources.entrySet().forEach(listModel::addElement); + sizeList.setModel(listModel); + sizeList.setCellRenderer(new DefaultListCellRenderer() { + @Override + public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + final JLabel ret = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + final Integer size = ((Map.Entry<Integer, URL>) value).getKey(); + ret.setText(String.format("Application Icon (%dx%d)", size, size)); + return ret; + } + }); + sizeList.setSelectedIndex(0); + + refresh(); checkValidity(); DocumentListener textFieldChangeListener = new UIUtil.DocumentAdapter() { @Override @@ -66,243 +90,165 @@ final class BasicBrandingPanel extends AbstractBrandingPanel { titleValue.getDocument().addDocumentListener(textFieldChangeListener); titleValueModified = false; } - + protected void checkValidity() { boolean panelValid = true; - + if (panelValid && titleValue.getText().trim().length() == 0) { setErrorMessage(NbBundle.getMessage(BasicBrandingPanel.class, "ERR_EmptyTitle"));//NOI18N panelValid = false; - } - - if (panelValid) { + } + + if (panelValid) { setErrorMessage(null); } setValid(panelValid); } - + void refresh() { BrandingModel model = getBranding(); model.brandingEnabledRefresh(); model.initTitle(true); titleValue.setText(model.getTitle()); - iconSource48 = model.getIconSource(48); - if (iconSource48 != null) { - ((ImagePreview)iconPreview48).setImage(new ImageIcon(iconSource48)); - } - iconSource32 = model.getIconSource(32); - if (iconSource32 != null) { - ((ImagePreview)iconPreview32).setImage(new ImageIcon(iconSource32)); - } - iconSource16 = model.getIconSource(16); - if (iconSource16 != null) { - ((ImagePreview)iconPreview16).setImage(new ImageIcon(iconSource16)); - } - browse16.setEnabled(null != iconSource16 && model.isBrandingEnabled()); - browse32.setEnabled(null != iconSource32 && model.isBrandingEnabled()); - browse48.setEnabled(null != iconSource48 && model.isBrandingEnabled()); + browse.setEnabled(model.isBrandingEnabled()); titleValue.setEnabled(model.isBrandingEnabled()); } - - public @Override void store() { - if (titleValueModified) + + public @Override + void store() { + if (titleValueModified) { getBranding().setTitle(titleValue.getText()); - getBranding().setIconSource(48, iconSource48); - getBranding().setIconSource(32, iconSource32); - getBranding().setIconSource(16, iconSource16); + } + + iconSources.entrySet() + .forEach(e -> getBranding().setIconSource(e.getKey(), e.getValue())); } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + + private void setPreview(final URL res) { + try { + final BufferedImage img = ImageIO.read(res); + ((ImagePreview) preview).setImage(img); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; - buttonGroup1 = new javax.swing.ButtonGroup(); title = new javax.swing.JLabel(); titleValue = new javax.swing.JTextField(); - iconPreview48 = new ImagePreview(48,48); - browse48 = new javax.swing.JButton(); - icon48 = new javax.swing.JLabel(); - icon16 = new javax.swing.JLabel(); - iconPreview16 = new ImagePreview(16,16); - browse16 = new javax.swing.JButton(); - icon32 = new javax.swing.JLabel(); - iconPreview32 = new ImagePreview(32,32); - browse32 = new javax.swing.JButton(); - lblSpacer = new javax.swing.JLabel(); - - setLayout(new java.awt.GridBagLayout()); - - title.setLabelFor(titleValue); + javax.swing.JScrollPane listScrollPane = new javax.swing.JScrollPane(); + sizeList = new javax.swing.JList<>(); + browse = new javax.swing.JButton(); + javax.swing.JScrollPane previewScrollPane = new javax.swing.JScrollPane(); + preview = new ImagePreview(); + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/apisupport/project/ui/branding/Bundle"); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(title, bundle.getString("LBL_AppTitle")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 0); - add(title, gridBagConstraints); - title.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_Title")); // NOI18N titleValue.setColumns(20); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); - add(titleValue, gridBagConstraints); - - iconPreview48.setLabelFor(iconPreview48); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 12); - add(iconPreview48, gridBagConstraints); - - org.openide.awt.Mnemonics.setLocalizedText(browse48, bundle.getString("CTL_Browse")); // NOI18N - browse48.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - browse48ActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0); - add(browse48, gridBagConstraints); - browse48.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_Browse")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(icon48, bundle.getString("LBL_AppIcon48")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 12); - add(icon48, gridBagConstraints); - - org.openide.awt.Mnemonics.setLocalizedText(icon16, bundle.getString("LBL_AppIcon16")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(23, 10, 0, 12); - add(icon16, gridBagConstraints); - - iconPreview16.setLabelFor(iconPreview48); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(23, 0, 0, 12); - add(iconPreview16, gridBagConstraints); - - org.openide.awt.Mnemonics.setLocalizedText(browse16, bundle.getString("CTL_Browse")); // NOI18N - browse16.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - browse16ActionPerformed(evt); + + sizeList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { + public void valueChanged(javax.swing.event.ListSelectionEvent evt) { + sizeListValueChanged(evt); } }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(23, 0, 0, 0); - add(browse16, gridBagConstraints); - browse16.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(BasicBrandingPanel.class, "ACS_Browse")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(icon32, bundle.getString("LBL_AppIcon32")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 12); - add(icon32, gridBagConstraints); - - iconPreview32.setLabelFor(iconPreview48); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 12); - add(iconPreview32, gridBagConstraints); - - org.openide.awt.Mnemonics.setLocalizedText(browse32, bundle.getString("CTL_Browse")); // NOI18N - browse32.addActionListener(new java.awt.event.ActionListener() { + listScrollPane.setViewportView(sizeList); + + org.openide.awt.Mnemonics.setLocalizedText(browse, org.openide.util.NbBundle.getMessage(BasicBrandingPanel.class, "CTL_Browse")); // NOI18N + browse.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - browse32ActionPerformed(evt); + browseActionPerformed(evt); } }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0); - add(browse32, gridBagConstraints); - browse32.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(BasicBrandingPanel.class, "ACS_Browse")); // NOI18N - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 4; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.weighty = 1.0; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10); - add(lblSpacer, gridBagConstraints); + + javax.swing.GroupLayout previewLayout = new javax.swing.GroupLayout(preview); + preview.setLayout(previewLayout); + previewLayout.setHorizontalGroup( + previewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 1058, Short.MAX_VALUE) + ); + previewLayout.setVerticalGroup( + previewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 1898, Short.MAX_VALUE) + ); + + previewScrollPane.setViewportView(preview); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(title, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(titleValue)) + .addGroup(layout.createSequentialGroup() + .addComponent(listScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(browse) + .addComponent(previewScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(title) + .addComponent(titleValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(browse) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(previewScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 389, Short.MAX_VALUE)) + .addComponent(listScrollPane)) + .addContainerGap()) + ); + + title.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicBrandingPanel.class, "ACS_Title")); // NOI18N + browse.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BasicBrandingPanel.class, "ACS_Browse")); // NOI18N }// </editor-fold>//GEN-END:initComponents - - private void browse48ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browse48ActionPerformed - iconSource48 = browseIcon( (ImagePreview) iconPreview48); - }//GEN-LAST:event_browse48ActionPerformed - - private void browse16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browse16ActionPerformed - iconSource16 = browseIcon( (ImagePreview) iconPreview16); - }//GEN-LAST:event_browse16ActionPerformed - - private void browse32ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browse32ActionPerformed - iconSource32 = browseIcon( (ImagePreview) iconPreview32); - }//GEN-LAST:event_browse32ActionPerformed - - + + private void sizeListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_sizeListValueChanged + setPreview(sizeList.getSelectedValue().getValue()); + }//GEN-LAST:event_sizeListValueChanged + + private void browseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseActionPerformed + final URL res = browseIcon(); + setPreview(res); + setModified(); + sizeList.getSelectedValue().setValue(res); + }//GEN-LAST:event_browseActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton browse16; - private javax.swing.JButton browse32; - private javax.swing.JButton browse48; - private javax.swing.ButtonGroup buttonGroup1; - private javax.swing.JLabel icon16; - private javax.swing.JLabel icon32; - private javax.swing.JLabel icon48; - private javax.swing.JLabel iconPreview16; - private javax.swing.JLabel iconPreview32; - private javax.swing.JLabel iconPreview48; - private javax.swing.JLabel lblSpacer; + private javax.swing.JButton browse; + private javax.swing.JPanel preview; + private javax.swing.JList<Map.Entry<Integer, URL>> sizeList; private javax.swing.JLabel title; private javax.swing.JTextField titleValue; // End of variables declaration//GEN-END:variables - private URL browseIcon( ImagePreview preview ) { + private URL browseIcon() { URL res = null; JFileChooser chooser = UIUtil.getIconFileChooser(); int ret = chooser.showDialog(this, NbBundle.getMessage(getClass(), "LBL_Select")); // NOI18N if (ret == JFileChooser.APPROVE_OPTION) { - File file = chooser.getSelectedFile(); + File file = chooser.getSelectedFile(); try { res = Utilities.toURI(file).toURL(); - preview.setImage(new ImageIcon(res)); - setModified(); } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); } @@ -310,40 +256,26 @@ final class BasicBrandingPanel extends AbstractBrandingPanel { return res; } - static class ImagePreview extends JLabel { - private ImageIcon image = null; - private int width; - private int height; - ImagePreview(int width, int height){ - this.width = width; - this.height = height; - } - + private static class ImagePreview extends JPanel { + + private BufferedImage image = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB); + @Override - public void paint(Graphics g) { - super.paint(g); - Graphics2D g2d = (Graphics2D)g; - - if (!isEnabled()) { - g2d.setComposite(AlphaComposite.getInstance( - AlphaComposite.SRC_OVER, 0.3f)); - } - - if ((getWidth() >= width) && (getHeight() >= height) && image != null) { - int x = 0;//(getWidth()/2)-(width/2); - int y = 0;//(getHeight()/2)-(height/2); - g.drawImage(image.getImage(),x, y, width, height, this.getBackground(),null); - } + protected void paintComponent(Graphics g) { + super.paintComponent(g); + g.clearRect(0, 0, getWidth(), getHeight()); + g.drawImage(this.image, 0, 0, image.getWidth(), image.getHeight(), this); } - - private void setImage(ImageIcon image) { + + public void setImage(BufferedImage image) { this.image = image; + revalidate(); repaint(); } @Override public Dimension getPreferredSize() { - return new Dimension(width, height); + return new Dimension(image.getWidth(), image.getHeight()); } } } diff --git a/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties b/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties index 048b6c4..49b9b54 100644 --- a/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties +++ b/apisupport/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/Bundle.properties @@ -89,9 +89,6 @@ SuiteCustomizerWindowSystemBranding.cbEnableSliding.AccessibleContext.accessible SuiteCustomizerWindowSystemBranding.cbEnableMaximization.AccessibleContext.accessibleName=Maximized Windows SuiteCustomizerWindowSystemBranding.AccessibleContext.accessibleName=Window System Features SuiteCustomizerWindowSystemBranding.jLabel1.AccessibleContext.accessibleDescription=List of enabled features -LBL_AppIcon16=Application Icon (16x16): -LBL_AppIcon32=Application Icon (32x32): -LBL_AppIcon48=Application Icon (48x48): LBL_BasicTab=Basic LBL_SplashTab=Splash Screen LBL_WindowSystemTab=Window System --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists