Skip to content

Commit

Permalink
Fix for #159.
Browse files Browse the repository at this point in the history
Added explicit version for spring maven addon due to 3.x issues. Updated to Vaadin 4.9.3

Version 4.1.4
  • Loading branch information
stefanuebe committed Dec 15, 2022
1 parent fe797af commit 3d8bbe7
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 150 deletions.
6 changes: 3 additions & 3 deletions addon-scheduler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

<groupId>org.vaadin.stefan</groupId>
<artifactId>fullcalendar2-scheduler</artifactId>
<version>4.1.3</version>
<version>4.1.4</version>

<name>FullCalendar Scheduler for Flow</name>
<description>A web component that wraps the FullCalendar Scheduler extension (https://fullcalendar.io).
</description>

<properties>
<vaadin.version>14.8.3</vaadin.version>
<vaadin.version>14.9.3</vaadin.version>

<fullcalendar.version>4.1.3</fullcalendar.version>
<fullcalendar.version>4.1.4</fullcalendar.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
4 changes: 2 additions & 2 deletions addon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.vaadin.stefan</groupId>
<artifactId>fullcalendar2</artifactId>
<version>4.1.3</version>
<version>4.1.4</version>

<name>FullCalendar for Flow</name>
<description>A web component that wraps the FullCalendar (https://fullcalendar.io).</description>

<properties>
<vaadin.version>14.8.3</vaadin.version>
<vaadin.version>14.9.3</vaadin.version>

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import {html, PolymerElement} from '@polymer/polymer/polymer-element.js';
import {afterNextRender} from '@polymer/polymer/lib/utils/render-status.js';

import '@fullcalendar/core'; // https://github.com/stefanuebe/vaadin_fullcalendar/issues/159
import {Calendar} from '@fullcalendar/core';
import interaction from '@fullcalendar/interaction';
import dayGridPlugin from '@fullcalendar/daygrid';
Expand Down
21 changes: 11 additions & 10 deletions demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@

<groupId>org.vaadin.stefan</groupId>
<artifactId>fullcalendar-demo</artifactId>
<version>4.1.3</version>
<version>4.1.4</version>

<name>Full Calendar web component demo</name>

<packaging>war</packaging>

<properties>
<vaadin.version>14.8.3</vaadin.version>
<vaadin.version>14.9.3</vaadin.version>

<fullcalendar.version>4.1.3</fullcalendar.version>
<fullcalendar.scheduler.version>4.1.3</fullcalendar.scheduler.version>
<fullcalendar.version>4.1.4</fullcalendar.version>
<fullcalendar.scheduler.version>4.1.4</fullcalendar.scheduler.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -132,12 +132,12 @@
</dependency>

<!-- used for the helper class StyleConverter - not used in Demo directly -->
<dependency>
<groupId>net.sourceforge.cssparser</groupId>
<artifactId>cssparser</artifactId>
<version>0.9.27</version>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>net.sourceforge.cssparser</groupId>-->
<!-- <artifactId>cssparser</artifactId>-->
<!-- <version>0.9.27</version>-->
<!-- <optional>true</optional>-->
<!-- </dependency>-->

<dependency>
<groupId>org.projectlombok</groupId>
Expand All @@ -154,6 +154,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.8</version>
<!-- Clean build and startup time for Vaadin apps sometimes may exceed
the default Spring Boot's 30sec timeout. -->
<configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
@CssImport("./app-layout-styles.css")
@SuppressWarnings("rawtypes")
public abstract class AbstractLayout extends AppLayoutRouterLayout implements AfterNavigationObserver {
public static final String ADDON_VERSION = "4.1.3";
public static final String ADDON_VERSION = "4.1.4";
private static final long serialVersionUID = -7479612679602267287L;

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -134,7 +134,7 @@ protected Component generateMenu() {
});
toggleButton.setWidthFull();

Div footer = new Div(new Html("<span>Using the FullCalendar library " + FullCalendar.FC_CLIENT_VERSION + " and Vaadin 14.8.3. " +
Div footer = new Div(new Html("<span>Using the FullCalendar library " + FullCalendar.FC_CLIENT_VERSION + " and Vaadin 14.9.3. " +
"More information can be found <a href=\"https://vaadin.com/directory/component/full-calendar-flow\" target=\"_blank\">here</a>.</span>"));

footerLayout.addClassName("footer");
Expand Down
264 changes: 132 additions & 132 deletions demo/src/main/java/org/vaadin/stefan/util/StyleConverter.java
Original file line number Diff line number Diff line change
@@ -1,133 +1,133 @@
/*
* Copyright 2020, Stefan Uebe
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package org.vaadin.stefan.util;

import com.steadystate.css.dom.CSSStyleDeclarationImpl;
import com.steadystate.css.dom.CSSStyleRuleImpl;
import com.steadystate.css.dom.Property;
import com.steadystate.css.parser.CSSOMParser;
import com.steadystate.css.parser.SACParserCSS3;
import org.w3c.css.sac.InputSource;
import org.w3c.css.sac.Selector;
import org.w3c.css.sac.SelectorList;
import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSRuleList;
import org.w3c.dom.css.CSSStyleSheet;

import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;

public class StyleConverter {
public static void main(String[] args) throws Exception {
Path styles = Paths.get("styles").toAbsolutePath();

Files.list(styles).filter(path -> path.toString().endsWith(".css")).forEach(path -> {
try {

CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
CSSStyleSheet styleSheet = parser.parseStyleSheet(new InputSource(path.toUri().toString()), null, null);

Map<String, String> defs = new HashMap<>();
Set<String> usage = new LinkedHashSet<>();

CSSRuleList rules = styleSheet.getCssRules();
for (int i = 0; i < rules.getLength(); i++) {
final CSSRule rule = rules.item(i);

if (rule instanceof CSSStyleRuleImpl) {
CSSStyleRuleImpl sRule = (CSSStyleRuleImpl) rule;

SelectorList selectors = sRule.getSelectors();
List<Property> properties = ((CSSStyleDeclarationImpl) sRule.getStyle()).getProperties();

for (int j = 0; j < selectors.getLength(); j++) {
Selector item = selectors.item(j);
String prefix = item.toString().trim();
prefix = prefix.replace(".", "");
prefix = prefix.replace(" ", "_");
prefix = prefix.replace(">", "_LACE_BRACE_");
prefix = prefix.replace(":", "_COLON_");
prefix = prefix.replace("*", "_ASTERISK_");
prefix = prefix.replace("+", "_PLUS_");
prefix = prefix.replace("[", "_SQUARE_BRACKET_OPEN_");
prefix = prefix.replace("]", "_SQUARE_BRACKET_CLOSE_");
prefix = prefix.replace("(", "_R_BRACKET_OPEN_");
prefix = prefix.replace(")", "_R_BRACKET_CLOSE_");


for (Property property : properties) {
String fullName = prefix + "-" + property.getName().trim();

String cssText = property.getValue().getCssText();
if (cssText.matches("-[a-zA-Z].*")) {
fullName += "-" + cssText.split("\\(")[0].trim();
}


// if (cssText.startsWith("rgb") ) {
// fullName += "-" + cssText.split("\\(")[0].trim();
///*
// * Copyright 2020, Stefan Uebe
// *
// * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
// * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
// * permit persons to whom the Software is furnished to do so, subject to the following conditions:
// *
// * The above copyright notice and this permission notice shall be included in all copies or substantial portions
// * of the Software.
// *
// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// */
//package org.vaadin.stefan.util;
//
//import com.steadystate.css.dom.CSSStyleDeclarationImpl;
//import com.steadystate.css.dom.CSSStyleRuleImpl;
//import com.steadystate.css.dom.Property;
//import com.steadystate.css.parser.CSSOMParser;
//import com.steadystate.css.parser.SACParserCSS3;
//import org.w3c.css.sac.InputSource;
//import org.w3c.css.sac.Selector;
//import org.w3c.css.sac.SelectorList;
//import org.w3c.dom.css.CSSRule;
//import org.w3c.dom.css.CSSRuleList;
//import org.w3c.dom.css.CSSStyleSheet;
//
//import java.io.BufferedWriter;
//import java.io.IOException;
//import java.nio.file.Files;
//import java.nio.file.Path;
//import java.nio.file.Paths;
//import java.util.*;
//
//public class StyleConverter {
// public static void main(String[] args) throws Exception {
// Path styles = Paths.get("styles").toAbsolutePath();
//
// Files.list(styles).filter(path -> path.toString().endsWith(".css")).forEach(path -> {
// try {
//
// CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
// CSSStyleSheet styleSheet = parser.parseStyleSheet(new InputSource(path.toUri().toString()), null, null);
//
// Map<String, String> defs = new HashMap<>();
// Set<String> usage = new LinkedHashSet<>();
//
// CSSRuleList rules = styleSheet.getCssRules();
// for (int i = 0; i < rules.getLength(); i++) {
// final CSSRule rule = rules.item(i);
//
// if (rule instanceof CSSStyleRuleImpl) {
// CSSStyleRuleImpl sRule = (CSSStyleRuleImpl) rule;
//
// SelectorList selectors = sRule.getSelectors();
// List<Property> properties = ((CSSStyleDeclarationImpl) sRule.getStyle()).getProperties();
//
// for (int j = 0; j < selectors.getLength(); j++) {
// Selector item = selectors.item(j);
// String prefix = item.toString().trim();
// prefix = prefix.replace(".", "");
// prefix = prefix.replace(" ", "_");
// prefix = prefix.replace(">", "_LACE_BRACE_");
// prefix = prefix.replace(":", "_COLON_");
// prefix = prefix.replace("*", "_ASTERISK_");
// prefix = prefix.replace("+", "_PLUS_");
// prefix = prefix.replace("[", "_SQUARE_BRACKET_OPEN_");
// prefix = prefix.replace("]", "_SQUARE_BRACKET_CLOSE_");
// prefix = prefix.replace("(", "_R_BRACKET_OPEN_");
// prefix = prefix.replace(")", "_R_BRACKET_CLOSE_");
//
//
// for (Property property : properties) {
// String fullName = prefix + "-" + property.getName().trim();
//
// String cssText = property.getValue().getCssText();
// if (cssText.matches("-[a-zA-Z].*")) {
// fullName += "-" + cssText.split("\\(")[0].trim();
// }
//
//
//// if (cssText.startsWith("rgb") ) {
//// fullName += "-" + cssText.split("\\(")[0].trim();
//// }
//
// if (defs.containsKey(fullName) && !defs.get(fullName).equals(cssText)) {
// System.err.println(fullName + " already in there with diff css text: " + cssText + " vs. " + defs.get(fullName));
// } else {
// defs.put(fullName, cssText);
// usage.add(item.toString() + " { " + property.getName() + ": var(--" + fullName + ", " + cssText + "); }");
// }
// }
// }

if (defs.containsKey(fullName) && !defs.get(fullName).equals(cssText)) {
System.err.println(fullName + " already in there with diff css text: " + cssText + " vs. " + defs.get(fullName));
} else {
defs.put(fullName, cssText);
usage.add(item.toString() + " { " + property.getName() + ": var(--" + fullName + ", " + cssText + "); }");
}
}
}
}

BufferedWriter bufferedWriter = Files.newBufferedWriter(Paths.get(path.toString() + ".def"));

bufferedWriter.write("<custom-style>\n <style>\n html{\n");

defs.entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey)).forEach(e -> {
try {
bufferedWriter.write(" --" + e.getKey() + ": " + e.getValue() + ";");
bufferedWriter.newLine();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
});
bufferedWriter.write(" }\n </style>\n</custom-style>");
bufferedWriter.close();

BufferedWriter bufferedWriter2 = Files.newBufferedWriter(Paths.get(path.toString() + ".usage"));
usage.stream().sorted(Comparator.naturalOrder()).forEach(s -> {
try {
bufferedWriter2.write(s);
// bufferedWriter2.newLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
});

bufferedWriter2.close();
}

} catch (Exception e) {
throw new RuntimeException(e);
}
});
}

}
// }
//
// BufferedWriter bufferedWriter = Files.newBufferedWriter(Paths.get(path.toString() + ".def"));
//
// bufferedWriter.write("<custom-style>\n <style>\n html{\n");
//
// defs.entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey)).forEach(e -> {
// try {
// bufferedWriter.write(" --" + e.getKey() + ": " + e.getValue() + ";");
// bufferedWriter.newLine();
// } catch (IOException ex) {
// throw new RuntimeException(ex);
// }
// });
// bufferedWriter.write(" }\n </style>\n</custom-style>");
// bufferedWriter.close();
//
// BufferedWriter bufferedWriter2 = Files.newBufferedWriter(Paths.get(path.toString() + ".usage"));
// usage.stream().sorted(Comparator.naturalOrder()).forEach(s -> {
// try {
// bufferedWriter2.write(s);
//// bufferedWriter2.newLine();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// });
//
// bufferedWriter2.close();
// }
//
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
// });
// }
//
//}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.vaadin.stefan</groupId>
<artifactId>fullcalendar-parent</artifactId>
<version>4.1.3</version>
<version>4.1.4</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down

0 comments on commit 3d8bbe7

Please sign in to comment.