Skip to content

Commit

Permalink
Merge pull request #24 from clagomess/demanda_23 Fix #23
Browse files Browse the repository at this point in the history
Demanda 23
  • Loading branch information
clagomess authored Sep 25, 2018
2 parents c1e0645 + 5832ea4 commit 48fdaef
Show file tree
Hide file tree
Showing 77 changed files with 4,031 additions and 2,061 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.idea
*.iml
src/main/java/br/com/pirilampo/htmlTemplate/bower_components
src/main/java/br/com/pirilampo/htmlTemplate/node_modules
src/main/java/br/com/pirilampo/htmlTemplate/.bowerrc
src/main/resources/htmlTemplate/node_modules
yarn-error.log
38 changes: 25 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,38 @@
<version>1.16.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.0</version>
<scope>provided</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.6</version>
</dependency>
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>

<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
<include>**/resources/img_01.png</include>
<include>**/htmlTemplate/dist/*.*</include>
<include>**/htmlTemplate/html/*.*</include>
</includes>
<directory>src/main/resources</directory>
<excludes>
<exclude>htmlTemplate/node_modules/**</exclude>
<exclude>htmlTemplate/css/**</exclude>
<exclude>htmlTemplate/js/**</exclude>
<exclude>htmlTemplate/build.sh</exclude>
<exclude>htmlTemplate/gulpfile.js</exclude>
<exclude>htmlTemplate/package.json</exclude>
<exclude>htmlTemplate/yarn.lock</exclude>
<exclude>htmlTemplate/yarn-error.log</exclude>
</excludes>
</resource>
</resources>

Expand All @@ -128,12 +146,6 @@
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding><!-- try to force encoding -->
<excludes>
<exclude>**/bower_components/**</exclude>
</excludes>
<testExcludes>
<testExclude>**/bower_components/**</testExclude>
</testExcludes>
</configuration>
</plugin>

Expand Down
11 changes: 11 additions & 0 deletions src/main/java/br/com/pirilampo/bean/Indice.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package br.com.pirilampo.bean;

import lombok.Data;

import java.util.LinkedHashSet;

@Data
public class Indice {
private String name = null;
private LinkedHashSet<String> values = new LinkedHashSet<>();
}
36 changes: 36 additions & 0 deletions src/main/java/br/com/pirilampo/bean/MainForm.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package br.com.pirilampo.bean;

import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;

public class MainForm {
@FXML protected GridPane root;
@FXML protected TextField txtNome;
@FXML protected TextField txtVersao;
@FXML protected TextField txtLogoSrc;
@FXML protected Button btnSelecionarLogoSrc;
@FXML protected ToggleGroup tipLayoutPdf;
@FXML protected ColorPicker clrMenu;
@FXML protected ColorPicker clrTextoMenu;
@FXML protected CheckBox sitEmbedarImagens;
@FXML protected ToggleGroup tipCompilacao;
@FXML protected TextField txtSrcFonte;
@FXML protected TextField txtSrcFonteMaster;
@FXML protected Button btnSelecionarFonte;
@FXML protected Button btnSelecionarFonteMaster;
@FXML protected Button btnGerarHtml;
@FXML protected Button btnGerarPdf;
@FXML protected ProgressBar progressBar;
@FXML protected TextArea txtConsole;

protected void setData(Parametro parametro){
this.txtNome.setText(parametro.getTxtNome());
this.txtVersao.setText(parametro.getTxtVersao());
this.txtLogoSrc.setText(parametro.getTxtLogoSrc());
this.clrMenu.setValue(Color.web(parametro.getClrMenu()));
this.clrTextoMenu.setValue(Color.web(parametro.getClrTextoMenu()));
this.sitEmbedarImagens.setSelected(parametro.getSitEmbedarImagens());
}
}
39 changes: 39 additions & 0 deletions src/main/java/br/com/pirilampo/bean/Menu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package br.com.pirilampo.bean;

import br.com.pirilampo.constant.Diff;
import lombok.Data;
import lombok.ToString;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Data
public class Menu implements Comparable<Menu> {
private String titulo;

@ToString.Exclude
private String url = null;

@ToString.Exclude
private Diff diff = Diff.NAO_COMPARADO;

@ToString.Exclude
private List<Menu> filho;

public Menu(String titulo){
this.titulo = titulo;
this.filho = new ArrayList<>();
}

public List<Menu> getFilho(){
Collections.sort(this.filho);

return this.filho;
}

@Override
public int compareTo(Menu o) {
return titulo.compareTo(o.getTitulo());
}
}
64 changes: 64 additions & 0 deletions src/main/java/br/com/pirilampo/bean/Parametro.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package br.com.pirilampo.bean;

import br.com.pirilampo.constant.Artefato;
import br.com.pirilampo.constant.Compilacao;
import br.com.pirilampo.constant.LayoutPdf;
import javafx.scene.paint.Color;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.lang.StringUtils;

import java.util.Properties;

@NoArgsConstructor
@Data
public class Parametro {
private String txtNome = "Pirilampo";
private String txtVersao = "1.0";
private String txtLogoSrc;
private LayoutPdf tipLayoutPdf = LayoutPdf.RETRATO;
private String clrMenu = "#14171A";
private String clrTextoMenu = "#DDDDDD";
private Boolean sitEmbedarImagens = true;
private Compilacao tipCompilacao = Compilacao.PASTA;
private Artefato artefato = Artefato.HTML;
private String txtSrcFonte;
private String txtSrcFonteMaster;
private String txtOutputTarget;

public Parametro(MainForm form){
this.txtNome = !StringUtils.isEmpty(form.txtNome.getText()) ? form.txtNome.getText() : this.txtNome;
this.txtVersao = !StringUtils.isEmpty(form.txtVersao.getText()) ? form.txtVersao.getText() : this.txtVersao;
this.txtLogoSrc = form.txtLogoSrc.getText();
this.tipLayoutPdf = LayoutPdf.valueOf((String) form.tipLayoutPdf.getSelectedToggle().getUserData());
this.clrMenu = colorHex(form.clrMenu.getValue());
this.clrTextoMenu = colorHex(form.clrTextoMenu.getValue());
this.sitEmbedarImagens = form.sitEmbedarImagens.isSelected();
this.tipCompilacao = Compilacao.valueOf((String) form.tipCompilacao.getSelectedToggle().getUserData());
this.txtSrcFonte = form.txtSrcFonte.getText();
this.txtSrcFonteMaster = form.txtSrcFonteMaster.getText();
}

public Parametro(CommandLine cmd){
this.txtNome = cmd.getOptionValue("name");
this.txtVersao = cmd.getOptionValue("version");
this.txtSrcFonte = !StringUtils.isEmpty(cmd.getOptionValue("feature")) ? cmd.getOptionValue("feature") : this.txtSrcFonte;
this.txtSrcFonte = !StringUtils.isEmpty(cmd.getOptionValue("feature_path")) ? cmd.getOptionValue("feature_path") : this.txtSrcFonte;
this.txtSrcFonteMaster = cmd.getOptionValue("feature_path_master");
this.txtOutputTarget = cmd.getOptionValue("output");
}

public Parametro(Properties properties){
this.txtNome = !StringUtils.isEmpty(properties.getProperty("txtNome")) ? properties.getProperty("txtNome") : this.txtNome;
this.txtVersao = !StringUtils.isEmpty(properties.getProperty("txtVersao")) ? properties.getProperty("txtVersao") : this.txtVersao;
this.txtLogoSrc = !StringUtils.isEmpty(properties.getProperty("txtLogoSrc")) ? properties.getProperty("txtLogoSrc") : this.txtLogoSrc;
this.clrMenu = !StringUtils.isEmpty(properties.getProperty("clrMenu")) ? properties.getProperty("clrMenu") : this.clrMenu;
this.clrTextoMenu = !StringUtils.isEmpty(properties.getProperty("clrTextoMenu")) ? properties.getProperty("clrTextoMenu") : this.clrTextoMenu;
this.sitEmbedarImagens = !StringUtils.isEmpty(properties.getProperty("sitEmbedarImagens")) ? Boolean.valueOf(properties.getProperty("sitEmbedarImagens")) : this.sitEmbedarImagens;
}

public String colorHex(Color color){
return '#' + color.toString().substring(2, 8);
}
}
17 changes: 17 additions & 0 deletions src/main/java/br/com/pirilampo/bind/ConsoleBind.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package br.com.pirilampo.bind;

import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import lombok.Getter;

public final class ConsoleBind {
@Getter
private static StringProperty logData = new SimpleStringProperty();

public static void setLogData(String data) {
try {
Platform.runLater(() -> logData.set(data));
}catch (Exception ignored){}
}
}
17 changes: 17 additions & 0 deletions src/main/java/br/com/pirilampo/bind/ProgressBind.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package br.com.pirilampo.bind;

import javafx.application.Platform;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import lombok.Getter;

public final class ProgressBind {
@Getter
private static DoubleProperty progress = new SimpleDoubleProperty();

public static void setProgress(double data) {
try {
Platform.runLater(() -> progress.set(data));
}catch (Exception ignored){}
}
}
15 changes: 15 additions & 0 deletions src/main/java/br/com/pirilampo/constant/Artefato.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package br.com.pirilampo.constant;

public enum Artefato {
HTML("HTML"), PDF("PDF");

private final String vl;

Artefato(String vl){
this.vl = vl;
}

public String getValue(){
return vl;
}
}
15 changes: 15 additions & 0 deletions src/main/java/br/com/pirilampo/constant/Compilacao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package br.com.pirilampo.constant;

public enum Compilacao {
PASTA("PASTA"), FEATURE("FEATURE"), DIFF("DIFF");

private final String vl;

Compilacao(String vl){
this.vl = vl;
}

public String getValue(){
return vl;
}
}
18 changes: 18 additions & 0 deletions src/main/java/br/com/pirilampo/constant/Diff.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package br.com.pirilampo.constant;

public enum Diff {
NAO_COMPARADO(0),
IGUAL(1),
DIFERENTE(2),
NOVO(3);

private final Integer vl;

Diff(Integer vl){
this.vl = vl;
}

public Integer getValue(){
return vl;
}
}
37 changes: 37 additions & 0 deletions src/main/java/br/com/pirilampo/constant/HtmlTemplate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package br.com.pirilampo.constant;

final public class HtmlTemplate {
public static final String HTML_TEMPLATE = "<script type=\"text/ng-template\" id=\"%s\">%s</script>\n";
public static final String HTML_JAVASCRIPT = "<script type=\"text/javascript\">%s</script>\n";
public static final String HTML_CSS = "<style>%s</style>\n";
public static final String HTML_FEATURE_PDF = "<h1 class=\"page-header\">%s <small>%s <em>%s</em></small></h1>\n" +
"%s\n<span style=\"page-break-after: always\"></span>";


// FEATURE
public static final String HTML_TITULO = "<h2>%s</h2>\n";
public static final String HTML_PARAGRAFO = "<p>%s</p>\n";
public static final String HTML_STEP = "<p><span class=\"keyword\">%s</span> %s</p>\n";
public static final String HTML_CODE = "<pre>%s</pre>\n";

public static final String HTML_CHILDREN = "<div class=\"panel panel-default\">\n" +
"<div class=\"panel-heading\" style=\"cursor: pointer;\" data-toggle=\"collapse\" data-target=\"#scenario-%s\"><h3>%s</h3></div>\n%s\n</div>\n";
public static final String HTML_CHILDREN_BODY = "<div id=\"scenario-%s\" class=\"panel-body collapse in\">%s</div>\n";
public static final String HTML_CHILDREN_TABLE = "<div class=\"table-responsive\">\n" +
"<table class=\"table table-condensed table-bordered table-hover table-striped\">\n" +
"<thead>\n%s\n</thead>\n" +
"<tbody>\n%s\n</tbody>\n" +
"</table>\n</div>\n";
public static final String HTML_CHILDREN_TABLE_TR = "<tr>%s</tr>\n";
public static final String HTML_CHILDREN_TABLE_TH = "<th>%s</th>\n";
public static final String HTML_CHILDREN_TABLE_TD = "<td>%s</td>\n";

// MENU
public static final String HTML_MENU_FILHO = "\t\t<li><a href=\"#/feature/%s\">%s%s</a></li>\n";
public static final String HTML_MENU_PAI = "<li>\n" +
"\t<a href=\"javascript:;\" data-toggle=\"collapse\" data-target=\"#menu-%s\">%s</a>\n" +
"\t<ul id=\"menu-%s\" class=\"collapse\">\n%s\t</ul>\n" +
"</li>\n";
public static final String HTML_MENU_ICON_DIFF_NOVO = "<span class=\"icon-diff-novo\"></span> ";
public static final String HTML_MENU_ICON_DIFF_DIFERENTE = "<span class=\"icon-diff-diferente\"></span> ";
}
15 changes: 15 additions & 0 deletions src/main/java/br/com/pirilampo/constant/LayoutPdf.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package br.com.pirilampo.constant;

public enum LayoutPdf {
RETRATO("R"), PAISAGEM("P");

private final String vl;

LayoutPdf(String vl){
this.vl = vl;
}

public String getValue(){
return vl;
}
}
Loading

0 comments on commit 48fdaef

Please sign in to comment.