JSF :: Extending Primefaces 5 Components

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


ADVERTISEMENT

Extending And Inheriting Classes

Jan 30, 2015

My teacher told me : It looks like everything is working except that in the Box, the method returns true if it is not a box.

The only other thing missing is the if statements in the main method using the .equals() method to do the comparisons. But, now I am lost on how to do my if statement.

HTML Code:
private int height;
/**
* Constructor for objects of class box
*/
public Box3(int l, int w, int h)
{
// call superclass
super(l, w);
// initialise instance variables
height = h;

[Code] ....

View Replies View Related

Constructor Error When Extending A Class?

Oct 21, 2014

I am writing a program that should take a url and scan the page for any links. It is in the beginning stages, but I ran into an error when I tried to extend a class. There's a lot going on in this code, but the error is caused by the constructor.

Error message at compile time:

"constructor Page in class Page cannot be applied to given types;
{//Constructor
^
required: String
found: no arguments
reason: actual and formal argument lists differ in length".

Here's the code(first my class, then the class I extended)

public class SearchEngine extends Page {
public static Color customGreen = new Color(69, 194, 33);
public static Color customYellow = new Color(232, 166, 12);
public static Color customBlue = new Color(25,97,255);
public static Color customYellowComp = new Color(178,125,0);

[code]...

View Replies View Related

Implementing Classes Instead Of Extending To Get Methods?

Sep 20, 2014

Basically I want to make a class called library, but I don't want to make an interface because I actually want to define the methods. I think I can only use abstract classes but not really sure how to use those. But I still have a problem, I want to create a Map that classes implementing Library class have to have in their code, and the Map will be a HashMap with <String, ParentClassHere>, so basically let's say I make a class called Car, implemeing Library to the Car class would create a Map library = new HashMap<String, Car>. Can I do something like this? And also include methods to get values and set values to the library Map?

View Replies View Related

Java 2D Game - Use Canvas Without Extending It

Apr 10, 2014

Java Code:

public class Game extends Canvas implements Runnable, KeyListener {
private static final long serialVersionUID = 1L;

public Game() {
setMinimumSize(new Dimension(width, height));
setMaximumSize(new Dimension(width, height));
setPreferredSize(new Dimension(width, height));
}

[code]...

I want to remove the extends Canvas from the top line and when I use JFrame to add canvas, I don't do add.(this, but instead I do add a canvas variable I make. So instead of extending I want to make a variable. But then how would I do the start, stop and run?I want to use Graphics, Canvas (Not Jpanel because I want to use BufferedImage) & JFrame. I don't want to extend Canvas, how could I use Canvas identically to shown above but instead of extending using it as a variable? or, how could I do this?

View Replies View Related

Extending Classes In Inheritance Hierarchy

Jan 4, 2015

I have a working program, except that it does not calculate the credit hours and the financial aid. When I enter an input, it works, until it should show the student name, credit hours and financial aid. the error i get from the command is "Hours invalid for false student". Here is the program i think i might have the problem.

import java.text.DecimalFormat;
public abstract class Student
{
//initialise variables
String name;
int creditHrs;

[Code] .....

View Replies View Related

JavaFX 2.0 :: Extending SplitPane Correctly

May 26, 2014

I'm having a problem with SplitPane (horizontal Flow). What I'm looking for is to find a way to maintain  the left pane in the same position when the main window maximizes. I do not want the left pane to grow on its width. If I go into the AnchorPain Constraint in the Scene Builder and remove the right and left constraints, when I run the application, the left pane keeps its position, but it appears a gap between the two panes (the left pane and the right one).
 
I need to find the way to expand the right pane to the position where the left pane is.
 
The link shows an image that illustrates the problem. [URL]

View Replies View Related

Difference Between Extending JFrame And Just Creating One In The Class?

Oct 18, 2014

What is the difference between extending JFrame in one class and simply constructing a new JFrame object in that same class? What benefits do I have with each solution, providing I want to use that class to create the GUI. Is it the same or are there differences rather than not having to reference to a new JFrame to be able to use its functions?

View Replies View Related

Swing/AWT/SWT :: Extending Classes And Importing Libraries Basics?

Mar 12, 2015

1. Tried to use setLayout() but it wouldn't let me. Have imported libs

import javax.swing.*;
import java.awt.*;

but it doesn't work. It only worked when I extended a class with JFrame. Why do I have to do it? I already have a JFrame instance:

public test(){
JFrame frame = new JFrame();
frame.setTitle("Workshop");
frame.setBounds(500,300,400,300);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
....
}

This code runs smooth, so it's confusing for me that it lets me create a JFrame object, and put buttons onto it, but it wants me to extend the class onto JFrame class in order to use a method.

2. I've read somewhere that AWT is old and should not be used anymore. Is there a diagram or a list with objects and properties that are manipulated only by Swing so that I could concentrate only on those? For example (made up list):

JPaper -

- width, setWidth(x)
- height, setHeight(x)
- position, setPosition(x,y)
- color, setBackground(RGBa)
- acquire, add(subordinate component)
- deprive, remove( subordinate comopnent)
- etc...

JSticker -

- width ...
- height ...
- write, setText(String)
- etc...

View Replies View Related

Extending Calculator - Added Function To Square Numbers

Feb 14, 2014

I am new to java and during my classes we built a basic calculator. I want to extend my calculator and added function to square numbers.Here is my program:

Java Code:

package calculator02;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

[code]...

View Replies View Related

Unable To Pull Data From Another Class Into GUI Already Extending JFrame

Apr 26, 2014

I've been trying to pull data from another class file "Calculations.java" and have it be displayed in a TextField in "DataAnalyzerGUI.java". Here is how the hierarchy is broken down for my assignment:

DataAnalyzerGUI.java extends JFrame
ReadFiles.java extends DataAnalyzerGUI.java
Calculations.java extends ReadFiles.java

Everything displays and functions correctly in a command prompt if I use a line like this:

System.out.println ("Lowest opening " + dateArray[lowestOpenIndex] + ": " + dataArray[lowestOpenIndex][2]);

But trying to get it to display in a GUI has been quite troubling.

I know the code is supposed to look something like this:

dataOutput.setText(DESIRED CODE HERE);

But I am unable to find anything of value to work out.

I have attached my complete project....

Attached File(s)

Assignment 4.pdf (247.05K)
Assignment 4.zip (235.81K)

View Replies View Related

Extending Static Inner Class Defined Within Inheriting Class?

Jul 3, 2014

I am working on a project involving a class that has the attributes of one of its inner classes. Now, if possible, I would like to make it so that the inner class is not visible outside of the class. Also, some of the functional mechanics require that the class be an instance of the nested inner class (it extends the inner class). The following code snippet demonstrates the situation.

public class A extends A.B {
public static class B { //ideally I would like this to be private/protected.
}
}

When I try to compile this program, I get the error message "Cyclical inheritance involving A." This error does not make much sense because, since the inner class "B" is static, it requires no instance of "A" (it does not inherit from "A" or uses it). My question is "Is it possible to do something similar to this structure?" I have searched many forums in search of the answer but have not found anything that attempts to explain it. The closest problem that I have found is one relating to the inheritance of a nested inner class from another class. I would like to express that the problem that I am having involves a class defined within the inheriting class.

View Replies View Related

JSF :: Organizational Chart In Primefaces

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

JSF :: PrimeFaces Fileupload Not Working

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

JSF :: Primefaces Conflicts With Theme

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

JSF :: Styling PrimeFaces File Upload Tag

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

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 View Related

JSF :: Primefaces Command Button Is Not Working

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

JSF :: CDI With Primefaces Charts Not Rendering Properly

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

JSF :: Enable / Disable One Inputmask Out Of Two In PrimeFaces

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

JSF :: PrimeFaces Accordion Panel Information

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

JSF :: Tree Structure - Cannot Use Richfaces And Primefaces

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

Getting Primefaces Data List Working

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

JSF :: Updating Primefaces TabView Title

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

Set Components To GridbagLayout

Jan 1, 2014

I decide to make a new GUI just for fun and practise and i want to learn more about Layouts.. right know i am try to understand some staff about GridBagLayout.

I want to make a GUI with this Layout :

So..first i am a frame with borderlayout then i put a JMenuBar and bla bla bla and i create panel with GridLayout which i put on myFrame.add(panel1,BorderLayout.WEST) and also i make an another JPanel which i put of the Center of main Frame (myFrame.add(panel2,BorderLayout.Center))

when i run the program i get this GUI :

Now the problem is that i can't put the JButton on the top of the gridLayout just to look like the first picture.. i Read about anchor and i try to

gbc.anchor = GridBagConstraints.NORTH; but without results.. still the components are on the middle of the JPanel..

Here is my Code () :

Java Code:

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

[Code] .....

View Replies View Related

How To Sequence Through Components

Mar 28, 2014

I know my problem is my lack of understanding of OOP but I have searched for a solution and can't even seem to get close.This is a very simplified version of what I will need to do. I have a button and six textboxes. When the button is pressed I want to take the text from textbox6 and place it in textbox1, textbox2, textbox3, textbox4, and textbox5.

I need sometthing better then this brut force method.Java Code:

package textboxes;
public class TextBoxesGUI extends javax.swing.JFrame {
public String NewText;
public TextBoxesGUI() {
initComponents();

[code]....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved