JSF :: Styling Primefaces Elements With CSS File
Nov 19, 2014
Currently I am having difficulties styling a particular prime faces element in a JSF application for work. I'm tasked with giving the ui a styling and color scheme acceptable to our project design. However I am finding myself unable to "hook" a particular pf element with an ID so that I can proceed with styling a imported .css file.
I'm trying to style the commandLink button to display in Orange 20px font with Italic but when I inspect the element in chrome after being rendered It doesn't even show its style linked to the assigned ID. The class style for mainMenuItem is being applied to the commandlink but is immediately over written by ui-widget. I'm trying to style that one single component(override/replace ui-widget with the properties in the #loggedInUserID)
Current .XHTML code and the css file has been linked with
<h:outputStylesheet library="css" name="masterPW.css"/>
<div class="mainMenuItem"><p:commandLink id="loggedInUserId" styleClass="maserPW.css" value="#{loginController.userFullName}"/>
</div><!--End of mainMenuItem-UserID div -->
[Code] ....
View Replies
ADVERTISEMENT
Mar 22, 2014
I'm having some problems styling the PrimeFaces upload tag <p:fileUpload /> in my application.
In my xhtml code I have the following:
<p:fileUpload id="fileUpload" fileUploadListener="#{filters.upload}"
allowTypes="#{filters.uploadTypes}" invalidFileMessage="#{filters.uploadBadType}"
sizeLimit="#{filters.uploadSize}" invalidSizeMessag="#{filters.uploadBadSize}"
update="fileUpload fileTable filterTab uploadMessage hiddenNum hiddenPhoto uploadError footer
namePhotSystem checkOverwrite"
description="Select Text File" disabled="#{filters.fileuploadDisabled}" fileLimit="1"
fileLimitMessage="You are only allowed to upload one file at a time"
styleClass="fileUploadClass" label="Choose the File to Upload" auto="true" />
This all works correctly, both the AJAX update and on the server, but I'm unable to get the button or buttons displayed in the way I need.
By including the following in my CSS:
.ui-fileupload.fileUploadClass {width:428px;}
.ui-icon-plusthick {display:none;}
.ui-button-text {width:200px; height:20px;}
the first sets the width of the button bar, and by looking at the HTML code generated by PrimeFaces, I discovered that the second hides the "+" to the left of the "Choose" button, which here has been replaced by the text "Choose the File to Upload". However, this text is displayed on two lines, with the word "Upload" on the second. I want the whole text to be on one line, but no matter what I do, I cannot get this to work properly. The third line of my CSS code does indeed reduce the height of the button, but the width does not work at all, and the last part of the text is simply lost. How do I put all the text on one line and adjust the width of the button?
Another question is that when I remove the auto="true" attribute from the tag, which I had originally, the "Upload" button is displayed to the right of the "Choose" button, and when a file is chosen but not yet uploaded, it is displayed below the button. This is a capability that I might still want, however, I am unable to style the display, and in particular the progress window to the right of the file name and size. All the files I want to upload are relatively small text files, and I want to adjust this window or even hide it completely. How is this done?
Incidentally, because the files are all quite small, I have disabled the display of the "Cancel" button, so either only the "Choose" button is shown, or the "Choose" and "upload" buttons.
View Replies
View Related
Apr 16, 2015
I am not all secure on the execution of the fileupload Primefaces.
The uploading execution occurs normally, but I would like to have a counter that control's the received files. The problem is that sending files go by so fast by this method that appears to be running in parallel. My question is whether this behavior is normal while sending files.
If it is not, where may be the error. If it is normal what can i do to make the counter really take the right value?
I'm using the scope of the "bean" type of view, but when im trying to run the session the problem also occurs depending on the file size.
If my files are very small, the execution is very fast and I cant follow the counter. If I clean the code the execution usually occurs no matter the size of the files.
@ManagedBean (Name = "bean")
@ViewScoped
public class BeanUpload {
private int counter;
@PostConstruct
public void init () {
counter = 0;
[Code] .....
The result on the console for 3 files is:
COUNTER EX: 1
COUNTER EX: 1
COUNTER EX: 1
If I run the code in debug mode on the console this is the result:
COUNTER EX: 1
COUNTER EX: 2
COUNTER EX: 3
Versions: Mojarra 2.1. Primefaces 5.1.15
View Replies
View Related
Feb 5, 2015
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class array
{
public static void main(String[] args)
[Code] ...
Is there a way to write this, where, alpha is one array.
Write a program that declares an array "alpha" of 50 elements of type "double". Initialize the array so that the first 25 elements are equal to the square of the index variable and the last 25 elements are equal to three times the index variable. Output the array so that 10 elements per line are printed.
If I have an array of 50 integers, can I break that to read in lines of 10?
View Replies
View Related
Jun 6, 2014
TableView selection model allows selecting single cells in the table but the default styling highlights the whole row regardless of the actual column selected in the row.
I am just wondering what options are there to change this behaviour so that the actual cell (row/column) get highlighted rather then the whole row.
Something like the $18,000 cell in the "Figure 1 Table overview" in [URL] ....
View Replies
View Related
Dec 9, 2014
I have a stylesheet (mystylesheet.css) with following entry:
.flowpane{
-fx-background-color: rgb(0,0,0);
}
In then start-method of my application I execute:
StackPane root = new FlowPane();
Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
scene.getStylesheets().add(css.getFile());
root.applyCss();
No FlowPane gets black. But if I do that in SceneBuilder and add the stylesheet to root than after loading Fxml-file the FlowPane gets black.
Another approach:
StackPane root = new FlowPane();
Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
scene.getStylesheets().add(css.getFile());
root.getStyleSheets().add(css.getFile());
root.applyCss();
Nothing happens.
StackPane root = new FlowPane();
Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
scene.getStylesheets().add(css.getFile());
root.getStyleSheets().add(css.getFile());
root.getStyleClass().add("flowpanel");
root.applyCss();
Doesn't work too;
but root.setStyle("-fx-background-color: rgb(0,0,0) works. But I need to style my application by css-files.
View Replies
View Related
Sep 15, 2014
I am trying to style the TableCell that has focus in a TableView to simulate how Excel does it. Excel uses a white background with a 3px black border which seems to be centered on the nominal cell edges. That is (and this is issue I am having), the border extends outside of the nominal cell boundaries.
My first naive attempt was to to override the CSS for .table-cell as follows:
.table-cell:selected:focused
{
-fx-background-color: white;
-fx-text-fill: -fx-text-base-color;
[Code]....
Doing this fixed problem (1) from the first attempt since this approach tweaks the background colors without affecting overall TableCell size. However, it still puts the black border completely inside the cell. My attempt to set -fx-background-position to a negative value in an attempt to offset the background seems to be ignored.
Having done this before using a Flex AdvancedDataGrid, my solution was to add a layer on top of the grid which renders the focus rectangle. I wonder if I would have to do a similar thing here.
View Replies
View Related
May 20, 2015
I want to eliminate duplicate element in xml file using stax parser.
View Replies
View Related
Jan 12, 2015
I am trying to make a 2d array that keeps track of comparison counts. what I have so far works ok but writes over the previous elements with 0. can't seem to find where I am re-initializing the previous elements.
//this is one of my fill sort arrays
public void fillSelectionArray(int index, long countSum) {
//rand = new Random( );
//for ( int i = 0; i < listsize; i++) {
selectionList[ index -1] = countSum;
// }
[Code] ....
I know I am missing something just not sure what.
View Replies
View Related
Mar 24, 2015
I am taking the Class Algorithms and Datastructures and got an assignment for Lab that really throws me off. The goal is to create an Array out of a given CSV file, implement several Methods that get the size of array, etc.
I am still stuck in the first part where the CSV has to be imported into the Array. My problem is that I need a mechanism that figures out the needed size for the Array, creates the array, and only then transfers the data from the CSV.
The list consists of the following wifi related values:
MAC-Adress, SSID, Timestamp, Signalstrength.
These are on the list, separated by comma. The Columns are each of these, and the rows are the four types of values making up the information on a certain wifi network.
The catch is, we are not allowed to use any of the following:
java.util.ArrayList
java.util.Arrays
and any class out of java.util.Collection.
So far I used the BufferedReader to read in the file and tried to implement the array, but I get an arrayindexoutofboundsexception.
Below is my Code (Its still an active construction zone):
public class WhatsThere {
public WhatsThere(String wifiscan) throws IOException {
}
public static void main(String[] args) throws IOException {
// WhatsThere Liste = new WhatsThere(String wifiscan);
String[][] arrayListe = new String[0][0];
[Code] ....
View Replies
View Related
Jul 25, 2014
Really need some simple and complete example on how to extends components (graphically and functionally) for primefaces 5.
For example I can't figure how to add custom attributes to existing component or define default values for existing attributes.
Is there any tutorial or a basic common way to achieve this goal or each component have to be extended in its way?
View Replies
View Related
Dec 31, 2013
I would like to create this type of chart with Primefaces (or another JSF API), what is the best component to use to do this:
[URL] .....
View Replies
View Related
Dec 23, 2012
i am having issues using the primefaces file upload, i have it set up, very much the same as the example version but it does not work, i never get the successful message and also where does it store the file once uploaded ?
heres my code so far :
web.xml
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
[Code]....
View Replies
View Related
Mar 22, 2015
i bought a theme from themeforest but the primefaces conflicts with the js of the theme. Is there any way to fix this conflict without changing all the js?
View Replies
View Related
Oct 2, 2011
<p:commandButton> of primefaces is not working but that same code working with <h:commandButton>Login bean is present with all valid getter and setter with loginAction
public String loginAction(){
if(userid.equals("ashok")&&
password.equals("admin")){
return "success";
} else {
return "login";
[code]....
View Replies
View Related
Jun 3, 2014
I have 4 Primefaces bar charts which sometimes renders, sometimes not. In one of them, I inject a http user session attribute and use it to render the chart (the idea is to show only the data that corresponds to the (logged in) user department).
There are 4 session beans which I'm using the javax.enterprise.context.RequestScoped. Sometimes, the Glassfish destroys the instance as expected, but sometimes not.Based on Exception below, how can I resolve it?
The xhtml below shows the main code for only 2 of the 4 bar charts:
<p:tab title="Horas de Treinamento (por Funci)" closable="true" >
<p:barChart id="horasBars" value="#{chartHorasFunci.modelHoras}"
legendPosition="ne"
orientation="horizontal"
seriesColors="AA5555, 00438F"
xaxisLabel="Horas" yaxisLabel="Funcis"
title="34 Horas de Treinamento (Orçado/Realizado) por Funci"
[Code] .....
The Exception:
SEVERE: Error Rendering View[/capacitacao/capacitacao/index.xhtml]
javax.el.ELException: /WEB-INF/include/capacitacao/capacitacao/List.xhtml @145,38 value="#{chartHorasFunci.modelHoras}": org.jboss.weld.exceptions.WeldException: WELD-000049 Unable to invoke private void br.com.bb.upb.diage.atb.capacitacao.beans.ChartHorasFunci.initialize() on br.com.bb.upb.diage.atb.capacitacao.beans.ChartHorasFunci@3e9c727c
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
[Code] .....
View Replies
View Related
Jul 28, 2014
I am developing one form in jsf/primefaces. I have two inputText(inputMask) for e.g moble number and telephone number. I want to restrict the user to put only one of these two fields . That means if user starts putting value in mobile no. then telephone no. field should be disabled and if user starts putting value in telephone no. then mobile no. field should be disabled.
how should I do this.
View Replies
View Related
Aug 13, 2014
I have an JSF that uses primefaces accordion snippet. However I want to populate the information from each tab from a seperate webpage that would also have accordion snippet in it. I can do this on a single page no problem, but the length of the program (webpage) is getting to the point that it is unmanageable.
The code I have:
<p:layoutUnit position="center">
<p:accordionPanel activeIndex="null">
<p:tab title="Burglar">
<h:outputText value= "Burglar"/>
<p:accordionPanel activeIndex="null">
<p:tab title="Skills">
<h:outputText value= "Skills"/>
[Code] ....
What I am after:
<p:layoutUnit position="center">
<p:accordionPanel activeIndex="null">
<p:tab title="Burglar">
<h:outputText value= "Burglar"/>
<p:accordionPanel activeIndex="null" url="burglar.xhtml">
</p:accordionPanel>
[Code] ....
How to get this to work... I am sure that it has something to do with my url but not sure how to fix it and I can not find anything on the web on how to do this.
View Replies
View Related
Apr 9, 2014
I am new to jsf i have been given a task to create a tree structure in jsf but cant use richfaces and primefaces. I need a complete project for reference as i am to totally new to this.
View Replies
View Related
Aug 31, 2014
I'm trying to get a primefaces data list working and not sure I'm doing this correctly, having a problem with getting this view to display. Here is my xhtml .
<f:view>
<p:scrollPanel id="cclist" header="CCList" styleClass="cc-log">
<p:dataList value="contactController.contacts" var="contact" type="ordered">
<f:facet name="header">
Call List
</f:facet>
#{contact.firstName}, #{contact.lastName}
</p:dataList>
</p:scrollPanel>
</f:view>
[code]....
View Replies
View Related
Mar 5, 2014
I have a TabView that generates the numbers of tabs, titles and content based off of the selected project from another field. I have managed to get it to load the proper number of tabs and content, but the first tab title displays the title of the first tab from the previous query.
The jsf is:
<h:panelGroup id="equipmentWrapper">
<p:tabView effect="blind">
<c:forEach items="#{databaseViewHandler.deviceTypes}" var="deviceType">
<p:tab title="#{deviceType.key}">
<ui:include src="#{deviceType.value}"/>
[Code] ....
And the method handling the content and number of tabs:
public DatabaseViewHandler() {
deviceTypes = new LinkedHashMap();
}
public Map<String, String> getDeviceTypes() {
return this.deviceTypes;
[Code] ....
The method findAssociatedEquipment() is called when it recieves a selected project to display.
The command button calls the update for panelGroup "equipmentWrapper". It updates fine for the ui:include and generates the correct number of tabs in the correct order.
So for example the first query might only generate one tab for an 881 device. Then if you select a project that should have a 2911 and 2960 it will correctly load both, but the title for the first tab will retain 881. Should you select a third it will have the title 2911 from the second project.
View Replies
View Related
Jul 1, 2014
After some fiddling, I have the visual format that I want for my dialog.
First, I had to set the scrollHeight for the dataTable to 25% to get have the whole scrollable table contained in the dialog. Why 25%? What is that relative to?
Second, I had to use the !important declaration for the width and height of the dialog to get the sizing to take. Is that normal with PrimeFaces when styling using a CSS class?
<p:dialog widgetVar="notesDialog" header="Handset Notes"
styleClass="notesDialog">
<p:dataTable id="notesTable" widgetVar="notesTable"
var="note" value="#{handsetBean.handsetNotes}"
scrollable="true" resizableColumns="false"
scrollHeight="25%">
[Code] ....
View Replies
View Related
Feb 9, 2014
I am generating pdf and displaying it in separate window/tab using the approach described in BalusC Code: PDF handling.I need to display blockui ajax loader when i select the commandlink to display pdf.The pdf gets generated but the ajax loader image remains as it is.I need to manually refresh the page to hide it.Is there any way using which it can be hidden as soon as the pdf gets displayed.My code snippet is as below
JSF page
<h:form id="subFrm">
<p:commandLink value="Download PDF" action="#{pdfBean.downloadPDF}"
onclick="blkUi.show()" oncomplete="blkUi.hide()" id="cmdLink"
ajax="false" />
[code]....
View Replies
View Related
Nov 5, 2014
how to use a Primefaces TabView for input.
I have found this link that implements the behaviour of the TabView. It basically says to make my own Tab model.
But I want each tab to contain something like this:
I tried adding the inputTexts in my Tab model but it doesn't work, I guess I was way too optimistic :P
The only reason I want this is because I don't know how many tabs I need. It's totally dynamic, the number of Lectures is added on demand.
View Replies
View Related
Jul 21, 2014
I have created one dataTable in page and shown some columns but I want to show only those columns which have entries ( if any column doesn't have record then it should not be displayed on the page.) . How should I put validation on this and display table.
View Replies
View Related
Jul 27, 2014
I'm trying to create a simple bar chart from integer values (measuring number of bulldozers) stored in a mySql DB, in the following schema:
Integer rigId PK;
Integer rigQty;
Date recordDate;
String country FK;
I want to plot the date on the x-axis and quantity on y-axis. I can't seem to find any examples of how to render charts from a database. I just find the generic Primefaces 4.0 examples which uses static data like this:
private void createCategoryModel() { // category chart
categoryModel = new CartesianChartModel();
ChartSeries boys = new ChartSeries();
boys.setLabel("Boys");
[Code] ....
I'm really not sure how to adapt the above to a database method nor have any web searches produced useful examples. I tried something like this, but how to find examples or the type of methods I need to use to create a bar graph from Db values:
@ManagedBean(name = "chartb")
@SessionScoped
public class BarChartBean {
private final Map<Integer, Map<String, Number>> rigNums = new HashMap<>();
// private final Map<Integer, Map<String, Number>> HorasOrcadasPorFunci = new HashMap<>();
private CartesianChartModel cartesianChartModel;
[Code] ....
View Replies
View Related