Social networks
You can find me on:
   
Open sharing content

These articles are available under Creative Commons license BY-SA-3.0

Archive for February, 2014

This is a very simple solution, that unfortunately took me a couple of hours because I couldn´t find it anywhere…

Place your server properties in the maven settings.xml file (found in the .m2 folder) like this:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

	<profiles>
		<profile>
			<id>wildfly-remote</id>
			<properties>
				<wildfly-hostname>199.181.11.11</wildfly-hostname>
				<wildfly-port>9990</wildfly-port>
				<wildfly-username>remoteuser</wildfly-username>
				<wildfly-password>remotepassword</wildfly-password>
			</properties>
		</profile>

		<profile>
			<id>wildfly-local</id>
			<properties>
				<wildfly-home>/home/laura/wildfly-8.0.0.Final</wildfly-home>
				<wildfly-hostname>127.0.0.1</wildfly-hostname>
				<wildfly-port>9990</wildfly-port>
				<wildfly-username>laura</wildfly-username>
				<wildfly-password>localpassword</wildfly-password>
			</properties>
		</profile>

	</profiles>

	<activeProfiles>
		<activeProfile>wildfly-local</activeProfile>
		<activeProfile>wildfly-remote</activeProfile>
	</activeProfiles>

</settings>

In the pom.xml file place the plugins under build>plugins> and set the server configuration parameters as maven properties (without adding the in your pom):

<plugin>
				<groupId>org.wildfly.plugins</groupId>
				<artifactId>wildfly-maven-plugin</artifactId>
				<version>1.0.0.Final</version>
				<configuration>
					<hostname>${wildfly-hostname}</hostname>
					<port>${wildfly-port}</port>
					<username>${wildfly-username}</username>
					<password>${wildfly-password}</password>
				</configuration>
				<executions>
					<execution>
<!-- 						<phase>package</phase> -->
<!-- 						<goals> -->
<!-- 							<goal>deploy</goal> -->
<!-- 						</goals> -->
					</execution>
				</executions>
			</plugin>

To deploy on the localhost server run the following command:

wildfly:deploy -P wildfly-local

To deploy on the remote server run:

wildfly:deploy -P wildfly-remote

You can also run undeploy, redeploy…For further information see: https://docs.jboss.org/wildfly/plugins/maven/latest/

After trying without success the Monitoring plugin for Notepad ++, Windows powershell, I have finally found this:

http://ophilipp.free.fr/op_tail.htm

Thank god, I can finally monitor the server log files properly on the bloody Microsoft Windows!

On the top on the right there is a button that allows you to clear the monitor… very useful!

If you have tried some primefaces features, you have probably noticed than some of those pretty things in the official showcase don´t work straight and easy in the application you´re developing. The problem is that even the latest 4.0 version is bugged.

I have been trying to use a Dialog Framework, but there´s something missing from the JqueryUI library and I have found out that the only way to make it work was including an external one, like:

There´s something missing from the JqueryUI library and I have found out that the only way to make it work was including the jqueryUI library (with the h:outputScript component).

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">

<h:head>
<title>Enter Product Mapping</title>
</h:head>

<h:outputScript name="js/jquery-ui-1.10.4.custom.min.js"/>

<p:commandButton value="Map"
actionListener="#{managedBean.showDialog}" />
</h:form>

</h:body>
</html>

Importing the jqueryui library is the only way to let the browser find the dialog properties (like “draggable”, “resizable”, “width”…). So I could make the following method work:

public void showDialog(){

Map<String,Object> options = new HashMap<String, Object>();
options.put("contentHeight", 340);
options.put("height", 400);
options.put("width",700);

RequestContext.getCurrentInstance().openDialog("dialog",options,null);

}

It will open the dialog that you need to put in another page (in this case the dialog.xhtml file):

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Enter Product mapping</title>
</h:head>
<h:body>
<h:form id="form">

<h:panelGrid id="grid" columns="3">

<f:facet name="header">
<p:messages for="query" />
</f:facet>

<h:outputLabel value="Username" />
<p:inputText id="username" value="#{managedBean.userName}" />
<p:message for="username" />

<h:commandButton value="Save" id="btn" process="@form" actionListener="#{managedBean.updateDialog}" />

</h:panelGrid>
</h:form>

</h:body>

</ui:composition>

The actionListener refers to a method in the managed bean class, that will process the submitted form.

To make it work you also need to add some properties in the faces-config.xml:

..

<application>

..

<action-listener>org.primefaces.application.DialogActionListener</action-listener>
<navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler>
<view-handler>org.primefaces.application.DialogViewHandler</view-handler>

....

</application>

...

ctrl + + = move to problem

ctrl + E = find file in editor

ctrl + Q=  go to the end of the method

ctrl + shift + T  = find item

ctrl + shift + R = open resource

ctrl + shift + E= switch to editor

ctrl + O = find method

ctrl + shift + arrow up/down = jump method

ctrl + L = go to line

ctrl + alt + H = hierarchy

ctrl + shift + G = find usages

ctrl + t = implementation hierarchy

alt+R= run (opens menu from the menu bar)

alt + shift + R = refactor

alt + shift +S = open source window

ctrl + M = maximize window

Ctrl+Tab=change editor

alt + <- or alt + -> = navigate code

And last but not least… ALT+F5 = update Maven Project (VERY useful!)