Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
#59 [Template] Refactore the templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoghuman committed Nov 27, 2016
1 parent 4e7a3ec commit 0b74221
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 50 deletions.
4 changes: 2 additions & 2 deletions nbproject/genfiles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ build.xml.script.CRC32=f3f52a7a
build.xml.stylesheet.CRC32=a56c6a5b@2.67.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=7a30a11a
nbproject/build-impl.xml.data.CRC32=c0dbdb1a
nbproject/build-impl.xml.script.CRC32=3f932814
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.71.1
17 changes: 17 additions & 0 deletions nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
<specification-version>1.60.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.modules.java.project.ui</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.66.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.modules.projectapi</code-name-base>
<build-prerequisite/>
Expand Down Expand Up @@ -106,6 +115,14 @@
<specification-version>8.25.2</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util.ui</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>9.4.1</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages>
<package>com.github.naoghuman.netbeanside.afterburnerfx.plugin</package>
Expand Down
49 changes: 49 additions & 0 deletions releases/Release_v1.5_2016-12-dd_HH-mm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Welcome to `NetBeansIDE-AfterburnerFX-Plugin` with the new release `v1.5`.

The NetBeansIDE-AfterburnerFX-Plugin is a `NetBeans IDE` plugin which supports
the file generation in `convention` with the library `afterburner.fx` in a
`JavaFX` project.


#### Summary
* ...
* ...



#### New



#### Feature



#### Enhancement



#### Bug



#### Refactoring
#59 [Template] Refactore the templates.



#### Additional



Greetings
Naoghuman



[//]: # (Issues which will be integrated in this release)



[//]: # (Links)

35 changes: 0 additions & 35 deletions releases/Release_v1.5_2016-MM-dd_HH-mm.md

This file was deleted.

48 changes: 48 additions & 0 deletions releases/Release_v1.6_2016-MM-dd_HH-mm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Welcome to `NetBeansIDE-AfterburnerFX-Plugin` with the new release `v1.6`.

The NetBeansIDE-AfterburnerFX-Plugin is a `NetBeans IDE` plugin which supports
the file generation in `convention` with the library `afterburner.fx` in a
`JavaFX` project.


#### Summary
* ...
* ...



#### New



#### Feature



#### Enhancement



#### Bug



#### Refactoring



#### Additional



Greetings
Naoghuman



[//]: # (Issues which will be integrated in this release)



[//]: # (Links)

Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ private Map<String, DataObject> mapDataObjectsForPrimaryFiles() throws IOExcepti
private Map<String, String> mapParametersForPrimaryFiles() {
final Map<String, String> parameters = new HashMap<>();
final String fileName = NbPreferences.forModule(PluginWizardIterator.class).get(PROP__FILENAME_CHOOSEN, PROP__FILENAME_CHOOSEN_DEFAULT_VALUE);
parameters.put(TEMPLATE_PARAMETER__CONTROLLER, fileName + "Presenter"); // NOI18N
parameters.put(TEMPLATE_PARAMETER__CONTROLLER, fileName + FILE_SUFFIX__PRESENTER);

final String layoutContainer = NbPreferences.forModule(PluginWizardIterator.class).get(PROP__LAYOUT_CONTAINER, DEFAULT_LAYOUT_CONTAINER);
parameters.put(TEMPLATE_PARAMETER__LAYOUT_CONTAINER, layoutContainer);

final boolean shouldFXMLtoLowerCase = NbPreferences.forModule(PluginWizardIterator.class).getBoolean(PROP__FXML_TO_LOWERCASE, Boolean.TRUE);
parameters.put(TEMPLATE_PARAMETER__FXML, shouldFXMLtoLowerCase ? fileName.toLowerCase() : fileName);

parameters.put(TEMPLATE_PARAMETER__PRESENTER, fileName + "Presenter"); // NOI18N
parameters.put(TEMPLATE_PARAMETER__VIEW, fileName + "View"); // NOI18N
parameters.put(TEMPLATE_PARAMETER__PRESENTER, fileName + FILE_SUFFIX__PRESENTER);
parameters.put(TEMPLATE_PARAMETER__VIEW, fileName + FILE_SUFFIX__VIEW);

return parameters;
}
Expand All @@ -194,7 +194,12 @@ private List<DataObject> createDataObjectsForOptionalFiles() throws IOException
return dataObjects;
}

private Map<String, DataObject> mapDataObjectsForOptionalFiles(boolean shouldCreateCSS, boolean shouldCreateProperties, boolean shouldCreateConfigurationProperties) throws IOException {
private Map<String, DataObject> mapDataObjectsForOptionalFiles(
boolean shouldCreateCSS, boolean shouldCreateProperties,
boolean shouldCreateConfigurationProperties
)
throws IOException
{
final FileObject firstTemplate = Templates.getTemplate(wizard);
final FileObject[] fileObjects = firstTemplate.getParent().getChildren();

Expand All @@ -221,12 +226,15 @@ private Map<String, DataObject> mapDataObjectsForOptionalFiles(boolean shouldCre
return mapDataObjects;
}

private Map<String, String> mapParametersForOptionalFiles(boolean shouldCreateCSS, boolean shouldCreateProperties, boolean shouldCreateConfigurationProperties) {
private Map<String, String> mapParametersForOptionalFiles(
boolean shouldCreateCSS, boolean shouldCreateProperties,
boolean shouldCreateConfigurationProperties
) {
final Map<String, String> parameters = new HashMap<>();
final String fileName = NbPreferences.forModule(PluginWizardIterator.class).get(PROP__FILENAME_CHOOSEN, PROP__FILENAME_CHOOSEN_DEFAULT_VALUE);
// .css
if (shouldCreateCSS) {
parameters.put(TEMPLATE_PARAMETER__CONTROLLER, fileName + "Presenter"); // NOI18N
parameters.put(TEMPLATE_PARAMETER__CONTROLLER, fileName + FILE_SUFFIX__PRESENTER);

final boolean shouldCSStoLowerCase = NbPreferences.forModule(PluginWizardIterator.class).getBoolean(PROP__CSS_TO_LOWERCASE, Boolean.TRUE);
parameters.put(TEMPLATE_PARAMETER__CSS, shouldCSStoLowerCase ? fileName.toLowerCase() : fileName);
Expand All @@ -244,7 +252,7 @@ private Map<String, String> mapParametersForOptionalFiles(boolean shouldCreateCS
if (shouldCreateProperties) {
final boolean shouldPropertiesToLowerCase = NbPreferences.forModule(PluginWizardIterator.class).getBoolean(PROP__PROPERTIES_TO_LOWERCASE, Boolean.TRUE);
parameters.put(TEMPLATE_PARAMETER__PROPERTIES, shouldPropertiesToLowerCase ? fileName.toLowerCase() : fileName);
parameters.put(TEMPLATE_PARAMETER__PRESENTER, fileName + "Presenter"); // NOI18N
parameters.put(TEMPLATE_PARAMETER__PRESENTER, fileName + FILE_SUFFIX__PRESENTER);
}

boolean shouldInjectProperties = NbPreferences.forModule(PluginWizardIterator.class).getBoolean(PROP__PROPERTIES_FILE_SHOULD_INJECT, Boolean.TRUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ public interface IPluginSupport {

public static final Color LIGHTGRAY_COLOR = new Color(124, 127, 130);

public static final String DEFAULT_LAYOUT_CONTAINER = "AnchorPane"; //NOI18N
public static final String DEFAULT_MAVEN_FXML_PACKAGE = "fxml"; //NOI18N
public static final String DEFAULT_MAVEN_IMAGES_PACKAGE = "images"; //NOI18N
public static final String DEFAULT_MAVEN_CSS_PACKAGE = "styles"; //NOI18N
public static final String DEFAULT_LAYOUT_CONTAINER = "AnchorPane"; // NOI18N
public static final String DEFAULT_MAVEN_FXML_PACKAGE = "fxml"; // NOI18N
public static final String DEFAULT_MAVEN_IMAGES_PACKAGE = "images"; // NOI18N
public static final String DEFAULT_MAVEN_CSS_PACKAGE = "styles"; // NOI18N

public static final String FILE_SUFFIX__PRESENTER = "Presenter"; // NOI18N
public static final String FILE_SUFFIX__VIEW = "View"; // NOI18N

public static final String MSG_INFO__FILE_NAME_ISNT_VALID = "info.filename.isnt.valid"; // NOI18N
public static final String MSG_ERROR__FILE_NAME_CONTAINS_WRONG_CHARS = "error.filename.contains.wrong.chars"; // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<#assign licensePrefix = "# ">
<#include "${project.licensePath}">

################################################################################
#
# Access to the parameters in this files can be done via injection in your
# presenter. Currently dot named keys aren't supported.
#
Expand All @@ -15,8 +17,8 @@
#
# @Override
# public void initialize(URL location, ResourceBundle resources) {
# System.out.println("parameter.equals("MyParameter"): "
# + parameter.equals("MyParameter")); // true
# assert (parameter.equals("MyParameter")); // true
# }
# }
#
################################################################################
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<#assign licensePrefix = "# ">
<#include "${project.licensePath}">

################################################################################
#
# Access to the parameters in this files can be done in your presenter via:
#
# public class ${presenter} implements Initializable {
Expand All @@ -18,3 +20,4 @@
# options to create (and to inject) the 'optional' .properties file into your
# presenter selected in the page 'Optional Files'.
#
################################################################################

0 comments on commit 0b74221

Please sign in to comment.