I'm using Netbeans & Maven.
I have some problems using CSS with Vaadin Toolkit.
Some basic problems...
It seems to ignore every line of my custom css, I don't know why.
In "/VAADIN/themes/touchkit" I have 4 css and scss files.
addons.scss styles.css styles.scss touchkit.scss
Basically, I wanto to change the background of a VerticalLayout or a VerticalComponentGroup.
So I've put
#import "../valo/valo.scss";
#mixin touchkit {
#include valo;
.backColorGrey {
background-color: #0FD1B1;
}
}
in touchkit.scss
and then
final VerticalLayout content = new VerticalLayout();
final VerticalComponentGroup content2 = new VerticalComponentGroup();
content.addStyleName("backColorGrey");
content2.addStyleName("backColorGrey");
Nothing happen.
I've compiled the Theme
I've tryed to put the code in the other scss files.
I've downloaded ruby to install Sass.
I've recompiled the Theme, the project, clean, clena &Build, recompile so many times ... and a lot of other action but the result is the same.
I've put this in the pom
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>j`enter code here`ava</goal>
</goals>
<configuration>
<classpathScope>compile</classpathScope>
<mainClass>com.vaadin.sass.SassCompiler</mainClass>
<arguments>
<argument>src/main/webapp/VAADIN/themes/touchkit/styles.scss</argument>
<argument>src/main/webapp/VAADIN/themes/touchkit/styles.css</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
Nothing happen.
It seems to ignore any css line... but it is a so basic action!!!!
It's frustrating, it is totally a waste of time.
Frankly I hate css.
Is there any way to set this value ignoring css by java code ?
Like .setBackgroundColor ?
Related
I would like to exclude few API methods in a class from Enunciate documentation.
Is there a way to achieve it using enunciate ?
Thanks in Advance
Enunciate 1.27 has a feature "Facet"(http://docs.codehaus.org/display/ENUNCIATE/Enunciate+API+Facets) which helps in achieving the above.
Requires following changes
1.) pom.xml
Added the plugin
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.27</version>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
2.) In the API Method you want to exclude, add Facet annotation like below
#GET
#Path("/{memberId}")
#Produces(APPLICATION_JSON)
#Facet(name = "external")
3.) Change enunciate xml to refer to 1.27 enunciate xsd
4.) Add Facets tag in your enunciate xml
<facets>
<exclude name ="external"/>
</facets>
Result - Enunciate report excludes selected APIs methods in class "A" and includes the rest.
Hope you are rocking at your end but i need a small help.
I am working on vaadin portlet and i need to create a vaadin chart(sample).
I downloaded required jars (vaadin-charts-vaadin6-1.1.7.jar and gson-2.2.1.jar) and created
an application as give below:
#SuppressWarnings("serial")
public class UserloginchartApplication extends Application {
public void init() {
Window window = new Window();
setMainWindow(window);
Chart chart = new Chart(ChartType.BAR);
window.setModal(true);
window.addComponent(chart);
}
}
After compiling and deploying on tomcat server i am getting following error on UI
Widgetset does not contain implementation for com.vaadin.addon.charts.Chart. Check its #ClientWidget mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions. Unrendered UIDL:
-Unrendered UIDL
-com.vaadin.addon.charts.Chart(NO CLIENT IMPLEMENTATION FOUND) id=PID3 height=400px width=100.0% confState={ "chart": { "type": "bar" }, "series": [], "exporting": { "enabled": false } }
Can any one tell me steps to achieve/create vaadin chart in liferay.
Thanks in Advance:
-Vikash
The problem is that the vaadin.addon.charts has some client side widget that are not included in default widge-set then you need to recompile your widget-set. If you are using maven like build toll you can do in this way:
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
<configuration>
<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<!-- <runTarget>mobilemail</runTarget> -->
<!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This way
compatible with Vaadin eclipse plugin. -->
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
<noServer>true</noServer>
<!-- Remove draftCompile when project is ready -->
<draftCompile>false</draftCompile>
<compileReport>true</compileReport>
<style>OBF</style>
<strict>true</strict>
<runTarget>http://localhost:8080/</runTarget>
</configuration>
<executions>
<execution>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
<!-- <modules> <module>com.vaadin.demo.mobilemail.gwt.ColorPickerWidgetSet</module>
</modules> <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> -->
</configuration>
<goals>
<goal>resources</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
I have packaged a number of composite components in a JAR. However, when using them in another project (using Maven), Netbeans editor puts red error lines under lines which use the composite component, even though the project compiles and runs as expected.
The folder structure for the composite component JAR look like:
compositeComponent.jar
META-INF
faces-config.xml
highcharts-taglib.xml
MANIFEST.MF
web.xml
maven
// maven stuff.
resources
highcharts
Chart.xhtml
Series.xhtml
Tooltip.xml
nz
co
kevindoran
highcharts
example
NZPopulationTrend.class
The highcharts.taglib.xml looks like:
<facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd">
<namespace>http://nz.co.kevindoran/highcharts-jsf</namespace>
<composite-library-name>highcharts</composite-library-name>
</facelet-taglib>
[Side note: The faces-config.xml and web.xml are present to allow the 'JAR' to be deployed as a WAR by changing the file extension to WAR (this is to done to run the examples).]
In my current project, I have specify a Maven dependency on the above project like so:
<dependency>
<groupId>nz.co.kevindoran</groupId>
<artifactId>jsf-menu</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
In a JSF page, I use on of the composite components like so:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:hc="http://nz.co.kevindoran/highcharts-jsf">
....
<hc:TimeChart title="Price Over Time" xLabel="Date" yLabel="Sold Price (NZD)">
<hc:TimeSeries name="Sold" series="#{cc.attrs.model.priceVsTimeChart.soldSeries}"/>
</hc:TimeChart>
....
</html>
Red error lines appear under all lines above, with message: "No library found for namespace http://nz.co.kevindoran/highcharts-jsf"
How do I get these error lines to be removed? I have seen many Netbeans bug reports for similar issues, but all seem resolved.
This error occurs on Netbeans 7.1, 7.2 and 7.3 (including 7.3.1).
I have absolutely the same problem. In my case it depends on the /src/main/java folder. If it's exist (only in the project and not even in the jar) the project which includes this library shows the "No library found for namespace... "
When i remove the "java" folder it works. But then my backing bean class is missed in the jar...
Tried with Netbeans 7.2 and 7.3, maven 2
Solution:
Generate a second project which contains the Java source files. (called: jsf-lib-java)
In jsf-lib project (your composite component project with xhtml) delete the "java" folder and all *.java sources.
add in the jsf-lib pom.xml following configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.mycompany.project</groupId>
<artifactId>jsf-lib-java</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>src/main/</outputDirectory>
<includes>**/*.class</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
That's it. This will generate a "good" jar file with the required *.class files. So it's possible to "trick" Netbeans.
Now i work with this solution. It's a hack but didn't found a better solution.
I have custom theme for my VAADIN application in src/main/webapp/VAADIN/themes/mytheme/ with files mytheme.scss and styles.scss.
Everything works fine when the vaadin productionMode deployment parameter is set to false in web.xml. When I set the parameter to true, suddenly Vaadin cannot find the resources for my theme and keeps complaining with:
Requested resource [/VAADIN/themes/mytheme/styles.css] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder
I dont have a /WebContent directory but /webapp instead, since its a maven web-app project.
I tried putting the VAADIN folder to:
src/main/resources
src/main/webapp
src/main/webapp/WEB-INF
but nothing works for the production mode. Any suggenstions?
Thank you in advance for help.
You need to add following goal to your pom.xml, which will compile the .scss files to .css files:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<classpathScope>compile</classpathScope>
<mainClass>com.vaadin.sass.SassCompiler</mainClass>
<arguments>
<argument>src/main/webapp/VAADIN/themes/heijunka/styles.scss</argument>
<argument>src/main/webapp/VAADIN/themes/heijunka/styles.css</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
Source: http://dev.vaadin.com/ticket/10291
#Develman already answered how to fix the problem but a bit more explanation.
When a Vaadin application is in development mode, it does the SCSS -> CSS compilation automatically when styles.css is requested and the file does not exist. In the production mode this does not happen. If styles.css exists, regardless of mode, the file is used and there is no SCSS -> CSS compilation.
I got this error even-though I've added maven goal to pom.xml
Finally got to know the reason, Its because of I've enabled production mode of Vaadin on web.xml
So when production mode on, its not generating styles.css file.
So you need to disable production mode in order to enable this SCSS - > CSS compilation.
<context-param>
<description>Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
I want to share test resources between 2 modules A and B. In A test resources I have directory with some files. Like this
-dir
----f1
----f2
I've done all according to Share test resources between maven projects . Now from B test I can access to resources using syntax like:
this.getClass().getClassLoader().getResource("dir/f1")
And it's works perfectly fine. But I don't want hardcore all file names like f1 or f2. What I really want is getting all files from directory. Like
File foo = new File(this.getClass().getClassLoader().getResource("dir").getFile());
assert foo.isDirectory()
foo.list()
...
But when I create foo in such way it even doesn't exist (foo.exist() returns false).
How can I deal with it?
Update. Alternative solution using ant
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<configuration>
<target>
<fileset id="d" dir="${basedir}/src/test/resources/dir" includes="*"/>
<pathconvert property="d" refid="d">
<map from="${basedir}/src/test/resources/" to=""/>
</pathconvert>
<touch file="${basedir}/src/test/resources/d/listOfCharts.txt"/>
<echo file="${basedir}/src/test/resources/d/listOfCharts.txt" message="${charts}"/>
</target>
</configuration>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
The approach you talk about creates a JAR which can be used in later tests. You can't list the contents of a Jar this way. You need to use Jar you need to read it as a Jar specially
How do I list the files inside a JAR file?