JSF :: 2.0 - How To Show Dialog Without Using Any Faces
Mar 19, 2014How can I display a modal dialog in JSF 2.0 without using any faces like primefaces, icefaces...
View RepliesHow can I display a modal dialog in JSF 2.0 without using any faces like primefaces, icefaces...
View Replies<rich:column>
<f:facet name="header">
<h:outputText
value="#{msgs.viewErrorSearchCriteria_createDateTime}" />
[Code] .....
Above code is always showing date as "31-Oct-2014 10:28:57 AM GMT". I want to display this in "31-Oct-2014 10:28:57 AM EDT".
I am wondering why , when I click on the "Add Student" button on the GUI,the message dialog is not popping up.
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
[Code] ......
I am a newbie in java prgmming using netbeans IDE . I have a code Java Code:
List<String> files = service.getSecureCloudStoragePort().listFiles();
SelectFileDialog dialog = new SelectFileDialog(this.getFrame(),true,files); mh_sh_highlight_all('java');
My files value get as :
[1_car.txt@2, 5_Van.txt@6]
The 2 and 6 refers user id ... I need to show only particular user with his own id.
So need to filter the files value with that id (after @ in raw data) .. How it can do ? any method to filter the data . That data format could not be changed in any way...
When i click on 'Add Invoice' button open a dialog box. input data in dialog box. After click on 'Save Invoice' all the data of dialog box is render in primfaces datatable. After that click on 'Save Invoices' all data of primefaces datatable and HTML table data are store in ipsDetail and Invoice object of Managed Bean class.
XHTML file :
<!DOCTYPE html>
<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:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
[Code] .....
Here, Problem is ipsDetail elements NULL when click on 'Save Invoice' button in addRow() so that primefaces datatable not updated. So that i can not insert new invoice data in database table.
I am using jsf rich faces to dispay the page. Pagination is not working in the same page.Problem here is i am able to see the first page only for the pagination functionality.
Below is the part of the code from xhtml.
<rich:dataTable value="#{selectedBean.bean.attributes}" var="attribute" iterationStatusVar="it" id="table" rows="20">
<f:facet name="caption">
<h:outputText value="#{selectedBean.bean.name}" />
</f:facet>
<f:facet name="header">
<h:outputText value="Attributes" />
[Code] ....
1. If we have and xhtml page and we just have a datatable to show some records through a managed bean, I think there is no validation phase, apply request values phase... so it would be a faces request but not with the lifecycle of a jsf request, right?
2. In the previous case because the normal phases of a jsf request are not going to be called, the method that will be called in the backing bean to get the records, could be called more than once although its not a normal faces request?
I am retrieving data in <rich:datatable> , but the default skin color is not being applied in my page. My web.xaml is as below
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>richFacesApp</display-name>
[Code] ....
I am using tomcat 7.0 and Richfaces 4.0
I have a print button as below
<p:commandButton id="printit" value="Print" type="button" icon="icn-print">
<p:printer target=":topForm:data" />
</p:commandButton>
when i click print button only top half of the page is getting printed and bottom half is pushed to next page. How do i fix this issue.
URL....In the mentioned project in this blog I used Spring Web Flow to satisfy some requirements but now that development of the Spring Web Flow stopped I like to check what Faces Flows can present to satisfy the same requirements.From a quick look similarities between Spring Web Flow and Faces Flows are obvious but there is one specific point I like to ask.In SWF it is possible to define flowing element at the beginning of an flow.
<on-start>
<evaluate expression="CustomerSearchSM.resetStateMachine()"/>
</on-start>
which will trigger an event when you will start executing a flow, I look to the Faces Flows flow descriptors but I can see an element that fullify similar requirement.similar functionality built into the Faces Flow or not?And is there a way to configure Faces Flows that it reacts to events from the users like the following.
<transition on="onStartCustomerSearch" history="invalidate">
<evaluate expression="customerSearchInputBB.searchCustomer()"/>
</transition>
<transition on="onCustomerAuthenticated" history="invalidate">
<evaluate expression="customerSearchAuthenticationBB.customerGivesAuthentication()"></evaluate>
</transition>
I have the following code.
class A {
List<StringBuilder> list;
public void output(List<StringBuilder> objectToOutput){
try(BufferedWriter bw = new BufferedWriter(new FileWriter("temp.txt"))){
for(StringBuilder row:objectToOutput) bw.write(row.toString());
}catch(IOException e){}
[code]....
Why don't the a's show up on the console? I put them in as part of the debugging process and now I don't understand why they don't show up in both places.
I have a requirement where in my primefaces datatable ,the filterMatchMode attribute(like any part of field,whole field) needs to be selected by the user by select menu .
To achieve this i have declared a variable in my viewscoped managed bean as filterCriteria and set the filterMatchMode attribute as filterMatchMode="#{beanName.filterCriteria}".The bean variable is getting set in the managed bean on submit but the filtering is not happening,i am getting empty message.
Also when i remove the keyed in value from filter box the data table is not restored which otherwise must be restored in normal situations. I have used and modified the example code given in primefaces showcase here.The code snippet is as below
<h:form id="tblFrm">
<h:selectOneMenu id="filterOptions"
value="#{dtFilterView.filterOption}" required="true"
requiredMessage="You must select an option!">
<f:selectItem id="hd1" itemLabel="Select" itemValue="#{null}" />
[code]....
How do i make the 'date' column show only the date and 'timeIn' and 'timeOut' column only show the time. In my database table my 'date' column is a date type and 'timeIn' and 'timeOut' column is time.
View Replies View RelatedThis is the code I have written so far. This program calculates tax from multiple tax payers.
import javax.swing.JOptionPane;
public class CalcutateTax
{
public static void main (String [] args)
[code]....
The problem is I cant think how to ask the use if he wants to calculate tax due for another taxpayer. If the user says yes, keep calculating, otherwise exit from the program. And how do I keep count of how many people got their tax calculated? Say for example,
JOptionPane.showMessageDialog (null, " We calculated tax for " + xnumber + " number of people.");
This is the question asked on my assignment ask the user if he wants to calculate the tax due for another taxpayer if so, do it again.At the end of the main method, output a message in a dialog box that says: Hello, We calculated taxes for [number of taxpayers].replace [number of taxpayers] with the actual number of taxpyers you calculated taxes for.
i am using a frame over which i am loading a dialog. The singleton dialog holds a progress bar. I have created my own swing worker. i am controlling the construct method of swing worker(which functions like doInBackground method).I am trying to call hidedialog from an external file. The dialog gets stuck sometimes. How do i solve it . It works fine on win7 but fails on win8.
public class LoadingProgressDialogSingleton extends com.manu.scpoweb.common.ds.client.swing.dialog.Dia log {
protected static LoadingProgressDialogSingleton oneAndOnlyProgressDialog = null;
JProgressBar progressBar = null;
DFULoadStatusBean dfuLoadStatusBean = null;
[code]....
I am in my first Java class and this is the second assignment. I am supposed to write a program that prints a table of squares and cubes and also uses dialog boxes for the input and the output. The output should look like this:
0 0 0
1 1 1
2 4 8
3 3 27
. . .
. . .
. . .
10 100 1000
I've figured it out but my only problem is the output dialog box displays each row individually (a new dialog box pops up for each row). How do I get it to display the whole table???Here's my code:
Java Code: import java.util.Formatter;
import javax.swing.JOptionPane;
public class Homework2 {
public static void main(String[] args) {
[code]....
I have managed to write the program where the user can input kg and the formula converts it into lbs. I have also written a program where I can get a dialog box to appear to ask the user to input the kg, but I can't figure out how to combine the two.
This program allows the user to input the kg, it converts it to lbs and then displays the output:
import java.util.Scanner;
import javax.swing.JOptionPane;
//creates a dialog box
public class convert {
public static void main(String args[]) {
[Code] ....
This program only brings in the first variable and the initial dialog box:
import java.util.Scanner;
import javax.swing.JOptionPane;
//creates a dialog box
public class KgLbs {
public static void main(String args[]) {
[Code] ...
I have attached the actual assignment and what the program should look like.
The below program ask the user to enter the value of x 1 , Y 1 and radius in separate boxes , What would look nice is if the user can Enter the Value X ,Y and radius in the same box.
import javax.swing.JOptionPane;
public class C3E29GeometryTwoCircles {
public static void main(String[] args) {
// Ask the user to enter the x1 coordinate.
String strNumber = JOptionPane.showInputDialog("Enter the value of x1 coordinate " );
double x1 = Double.parseDouble(strNumber);
strNumber = JOptionPane.showInputDialog("Enter the value of y1 coordinate " );
double y1 = Double.parseDouble(strNumber);
[code]...
I have to return the minimum and maximum value entered by the user, so far the program returns the maximum but the minimum stays at 0. I assigned 0 to the min and max variables. I believe that is part of the problem, but why do I get an accurate answer on the max if both variables are assigned to 0?
int min = 0;
int max = 0;
int option = JOptionPane.YES_OPTION;
while ( option == JOptionPane.YES_OPTION){
String dataString = JOptionPane.showInputDialog("Enter an integer");
int data = Integer.parseInt(dataString);
if ( min > Integer.parseInt(dataString)) min = Integer.parseInt(dataString);
if ( max < Integer.parseInt(dataString)) max = Integer.parseInt(dataString);
option =JOptionPane.showConfirmDialog(null, "Continue?");
}
JOptionPane.showMessageDialog(null, "Minimum: " + min + "
Maximum: " + max);
}
I have an application that has a text field I want to use Jfilechooser to save or save As the data.
If the file already exisits i want the end user to be able to hit save without the dialog box popping up asking for a file name folder etc, like it would in MS Word etc..
Is this possible?
I found different ways to code this for a button named "closeButton":
- closeButton.getRootPane().setDefaultButton(closeButton);
- thisDialog.getRootPane().setDefaultButton(closeButton);
- SwingUtilities.getRootPane(closeButton).setDefaultButton(closeButton);
Which is best?
The goal of this section of my assignment is to ask the user for a password. The password entered has to match the password I set in the code. If it is correct the next dialog box will pop up.
my password is set to:
String enterpwd = "";
String correctPassword = "Setpassword";
I am asked to use JOption, I completed as follows:
enterpwd = JOptionPane.showInputDialog(""............JOptionPane.QUESTION_MESSAGE);
then I use IF statements
if (enterpwd == correctPassword)
xyz = JOption .......();
I am getting an error "java.lang.NumberFormatException: For input string: """
My program never compiled. the code is for a dialog box that calculates the volume of a cylinder, and i know there are simpler codes to do it, but this is the format my teacher wants...Heres the code:
import javax.swing.*;
public class classTwo
{
public static void main(String[] args)
{
String rad, hei, vol;
Scanner joe = new Scanner(System.in);
System.out.println ("Hi, please enter a radius.");
double rad = joe.nextLine();
System.out.println ("Enter a height.");
[code]....
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] ....
I need to validate an input box so that the user can enter only round numbers.
The user can't enter any other characters except 0 to 9, they shouldn't be able to enter decimal points either.
They would be answering questions like, 'What is 7 times 8?'
Also, I need to validate it so that the program doesnt crash if they leave the input box blank or empty.
This assignment uses the following description to implement a Dialog class for the Leap Year Problem. We need to decompose this problem into 2 classes:
1.The Date.java class: is a public class that represents a date composed of a month , day, and a year. So you need to declare month, day, and year as integers. Date has 1 constructor and 4 methods. Write the constructor for Date which has 3 parameters: int m, int d, int y ; (As an example of a constructor with 2 parameters for example chapter 3 page 152 code listing 3-13 has a perfect example for you to use which is the BankAccount.java.) and the 4 methods:
"dayIs()" which returns a day. It has no parameter.
"monthIs()" which returns a month. It has no parameter.
"yearIs()" which returns a year. It has not parameter.
"isLeapYear()" which returns a boolean value.
"isLeapYear()" has one parameter year and returns a boolean. Write the method isLeapYear() knowing that a year is defined to be a leapyear it is a multiple of 4, and if it is is a multiple of 100, it must also be a multiple of 400. isLeapYear() thus decides when a year is a leap year. (see the discussion on "Hints for Assign5" to discover specific examples of a LeapYear).
The purpose of the Date.java is to decide whether a year is a leap year. Here is a definition of when a year is considered a leap year :
-year y1 is a leap year if it is multiple of 4.
-year y1 is a leap year if it is a multiple of 100, it must be a multiple of 400.
-Otherwise y1 is not a leap year.
2. The DateJDialog.java class: implements the GUI. Please use the Dialog boxes developed in the book in chapter2 in pages 99-100 in the code-listing 2-32 (NamesDialog.java) for input and output.
Remember that you will prompt the user to enter:
-a month;
-a day;
-a year
And out of these 3 you will be able to create a Date. Then you will use the dialog box to tell the user whether the year entered was a leapyear or not a leapyear.
Remember that we defined in 1- what it means a year is a leap year or not a leap year.
Do not forget to compile the 2 java files. To verify that the DateJDialog.java works, in TextPad after you compile DateJDialog.java, Click on Tools, Click on "Run Java Application".
When you have completed the assignment, please remember to submit Date.java and DateJDialog.java.