Adding Complicated Selections To Eclipse Link Criteria Builder?

Jan 21, 2015

How to add select case

when to_char(trunc(TO_DATE ('03-APR-2015','DD-MM-YYYY'), 'mm'), 'FMDAY') = 'SUNDAY'
then to_number(to_char(TO_DATE ('03-APR-2015','DD-MM-YYYY'), 'W'))+1
             else ceil((to_char(TO_DATE ('03-APR-2015','DD-MM-YYYY'), 'dd') + 1 - to_char(next_day(trunc(TO_DATE ('03-APR-2015','DD-MM-YYYY'), 'mm'), 'SUNDAY'), 'dd'))/7)+1
        end week_no
from dual
query to Eclipse Link CriteriaBuilder

I am able to add distinct(to_char(sum(datecolumn,number),'W-MM-YYYY')) like
 
                       Expression sum = cb.sum(CriteriaQueryUtils.getPath(rt, breakupFields), cb.literal(miliSecToAdd));
                        Expression<String> literal = cb.literal("W-MM-YYYY");
                        Expression<String> functionselectclause = cb.function("TO_CHAR", String.class, sum,literal);
                        return query.select(functionselectclause ).distinct(true).where(p).orderBy(orders);

But need to know how to add case when else to CriteriaBuilder...

View Replies


ADVERTISEMENT

JavaFX 2.0 :: How To Add Screen Builder To Eclipse 4.2.2

May 29, 2015

I want to include JavaFX in my Eclipse IDE.  I found intructions on how to import JavaFX Screen Builder into Eclipse 4.4 but my version is 4.2.2
 
I noticed that JavaFX is included into Java JDK now, I have installed Java JDK 8_45
 
The info on the oracle java pages is telling me i have to install JavaFX Screen Builder 2 before installing the plugin.
 
So, how to i proceed ???
 
I tried to inport e(fx)clipse plugin 1.2 and 0.9 but both refuses to install.  Messages received as follows:
 
Cannot complete the install because one or more required items could not be found.

  Software being installed: e(fx)clipse - IDE - FXML 1.2.0.201501301049 (org.eclipse.fx.ide.fxml.feature.feature.group 1.2.0.201501301049)
  Missing requirement: JavaFX Preview 1.2.0.201501301049 (org.eclipse.fx.ide.ui.preview 1.2.0.201501301049) requires 'bundle com.google.inject 2.0.0' but it could not be found
  Cannot satisfy dependency:
    From: e(fx)clipse - IDE - FXML 1.2.0.201501301049 (org.eclipse.fx.ide.fxml.feature.feature.group 1.2.0.201501301049)
    To: org.eclipse.fx.ide.ui.preview [1.2.0.201501301049]

View Replies View Related

Using Method In Eclipse IDE - Adding Records In Database

Sep 7, 2014

I am very confused about why my code is not working.. The function of my code will add records in my database (MySQL), Swing components of my frame..

btnUserAdd = jButton
txtUname, txtPword, txtLname, txtFname, txtMname, txtEmpNo = jTextField
cbAccType = jComboBox
EmpNo, Uname, Pword, Lname, Fname, Mname, AccType = MySQL fields

I created a method to be called when btnUserAdd is clicked. here is the code for the method:

public void UserAdd(){
String sql = "SELECT * FROM User WHERE Uname = ? and EmpNo = ?";
try {
pst = conn.prepareStatement(sql);

[Code] ....

the error is that it does not add the record it will display JAVA.LANG.NULLPOINTEREXCEPTION...

View Replies View Related

Authenticating A Password With Criteria

Dec 4, 2014

I have a question but dont know how I could verify the criterias..

The password should be at least six characters long
The password should contain at least one uppercase and at least one lowercase letter
The password should have at least on digit

Write a class that verifies that a password meets the stated criteria. Demonstrate the class in a program that allows the user to enter a password and then displays a message indicating whether it is valid or not.

I have not created a class because I really have no clue what to write in this case. My main method is:

import java.util.Scanner; // Needed for the Scanner class
 public class Password {
public static void main(String[] args) {
// Create a Scanner object to read input.
Scanner keyboard = new Scanner(System.in);
String input;// To hold the input

[Code] .....

View Replies View Related

Building A Document Based On A Series Of Check Box Selections?

Jan 17, 2014

I'm trying to build a program that would present the user (well...me) with a rather large list of various check boxes (and combo boxes, etc...but for sake of the question I'll limit it to check boxes) and the selections would not only need to be stored in some way so they could be reloaded, but also they would need to have the "data" used to build sentences.

For example, part of the form would have a checkbox list like:

Emotional Issues -
Emotion 1, Emotion 2...Emotion 40

Then, at the end of the form I would be able to save client, load client, or generate report. When doing the generate it would output something like:

"Client's first name reported having emotional disturbance in areas of 'Emotion 1', 'Emotion 4', and 'Emotion 12'."

There, of course, would be probably several hundred check boxes, combo boxes, etc. throughout this program building a rather complex "report" when it's all said and done. So where I am stumped in on the methodology or approach that would be best for getting, storing, retrieving, and outputting this information.

View Replies View Related

Creating Complicated Objects

Dec 30, 2014

I'm trying to create complex Character objects. Each object has a name, and for each object with the same name, they share some of the same initial data. However, there are also some bits of data that are given to the object when it's created. For example, an "Elephant" always starts out having a weight of 500, but its position is determined when it's created. Any of these values may later be changed during runtime.

class CharacterStaticParameters {
int weight;
int numberOfFeet;
int numberOfEyes;

[code]....

For example, whether I should try to use words other than 'static' and 'dynamic', or a nicer word than 'parameters'?

View Replies View Related

Complicated Data Copy

Jun 14, 2014

Disaster has struck some of ACME's redundant data centers. The administrators have managed to restore backups, but some data sets are still missing from some data centers. Fortunately, every data set can be found at least once in one or more of the data centers. However, before ACME can resume normal operations, it needs to ensure that each data center has a copy of every data set.Your goal is to ACME resume normal operations by writing a program to synchronize data sets between data centers using as few copies as possible.

The first line of input will contain an integer between 0 and 999999 inclusive, representing the number of data centers.Following that will be one line of input for each data center. Each line will contain an integer from 0 to 299 representing the number of data sets at that data center, followed by a space and space-separated list of data set ids currently present at that data center. Data set ids are each an integer between 1 and 999999, inclusive. Each line will be at most 999 characters long.Data set ids are not necessarily consecutive. The list of data sets will not be in any particular order.

Output:The program must output an optimal data set copy strategy to ensure that every data center has a copy of every data set. Output one line for every copy instruction.A copy instruction is of the form <data-set-id> <from> <to>, where <data-set-id> is the data set id, <from> is the index of the data center the data set will be copied from (1 = the first data center), and <to> is the index of the data center to copy the data set to.When there are no more copy instructions, the program must output the word "done" on a line by itself. There is often more than one correct output with minimal number of operations for a given input, and any output that satisfies the requirements is valid.

Example 1:
----------
Input:
4
3 1 3 4
3 1 2 3
2 1 3
3 1 4 2
One Possible Correct Output:
2 2 1
4 1 2
2 2 3
4 4 3
3 1 4
done

Example 2:
----------
Input:
2
2 1 2
2 2 1
Output:
done

View Replies View Related

Complicated ArrayList Function - Moving Between Fields Which A Player Can Perform Based On Game Rules

May 27, 2014

I have been working on this function and i can't get it to work. It's a little bit complicated so let me first explain what this is about:

1. As a little exam in my studies i have to program a halma console game with KI an stuff.

2. Everything is finished and works except for the Move-Calculation.

3. A Move is a Move from Field a to Field b which a player can perform in one round based on the game rules (Careful: We are not using the standard halma rules, we use different ones).

4. Class Move consists of the Starting Cell where the Figure before the Move stands and a target Cell where the figure will stay on at the Move end. It may include an Array of serveral Cells, the stop cells which the figure passes from start -> target since several jumps can be performed in one Move.

Valid Examples for Moves:

a -> b (From Field a to Field b)
d -> f through g,h,i (From Field d to Field f through the Field g,h,i

My Move Calculation where all possible Moves are calculated for a given figure consists of 2 parts. An expand() function which will generate all possible moves (works perfectly) and a jumpFix() function which isn't working properly.

Example:

After expand() I'm getting something like that:

a -> b
b -> c
c -> d
s -> t

This is however not finished, because the first 3 Moves are actually 1 Move. Because the player can Move from a -> d in one turn because those 3 are consecutive Move. The fixed Move would look like that:

a -> d through b,c

jumpFix() is also perfectly working for that situation, however there is one specific situation when it doesn't work. Let's say we have this situation.

a -> b
b -> c
c -> d
b -> e
e -> f
f -> g
s -> t

Then the only valid jumpFix() output would be:

a -> d through b,c
a -> g through b,e,f
s -> t

However i can not get it to work yet. Note: It definitely needs to be iterative, not rekursive else i would get an StackoverflowError.

This is my current Code of jumpFix():

Java Code:

/**
* Takes a look into all calculated moves and finds those which should be seen as one move, but are still considered to be more than one move (several jumps in one move)
*/

public static List<Move> jumpFix(List<Move> moves) {
Set<Move> result = new HashSet<Move>();
Set<Move> remove = new HashSet<Move>();
int lastSize = -1;
// repeat action until no moves could be merged
while (lastSize != remove.size()) {

[Code] ....

How to implement the special case where a Move splits into 2 or more branches and jumpFix() able to handle this case.

View Replies View Related

GUI Builder Yes Or No

Dec 23, 2014

I am doing an online course in Java. Mainly for Windows Applications using Eclipse.In the course that I m doing the Instructor has said that most Java programmers dont bother with GUI builders and tend to hand code everyhing. Is this correct? I ask because my previous language I made good use of a GUI builder due to its ease and speed.

Is this because the code is more stable than the generated code offered by GUI builders in Java or is it just better to have full control and to gain a better understanding on how it all works with the layout managers?

View Replies View Related

Aligning Components In Java Window Builder

May 10, 2015

I'm trying to get my components to align in the proper position but I'm having no luck what so ever. I have my code and I've attached an image of my window builder.

Here's my code

package tsd.view;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SpringLayout;

[Code] ....

View Replies View Related

Integrating MySQL Into JavaFX Scene Builder

Jul 4, 2014

I am new to javafx and my goal is to basically just test if my java code works with Mysql. What I'm planning to do is to display one data of the sakila database into a Label named greetingLabel. And I can't seem to find where i went wrong so i'll show you my whole code.

Here is the main code for my controller class from scene builder:

package main;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;

[Code] .....

Here is the error displayed when pressing the button

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)

[Code] .....

View Replies View Related

Swing/AWT/SWT :: To Build Online Website Builder

Oct 29, 2009

I want build to build a website buider in java that contains drag & drop functionality for editing templates of websitesI need to build a replica of the site URL....I want to know what framework would i use for building this in java whether it shuold be swings,awt or some other i need to integerate in java like flex or something.how to get started with this.

View Replies View Related

JavaFX 2.0 :: Scene Builder On High DPI Screen

Jun 6, 2015

I'm trying to follow the Scene Builder tutorials on a 3200 X 1800 screen which makes the size of the content pane 3'' x 2" ....

View Replies View Related

Using Only Java Swing Without Windows Builder To Build GUI Application?

Oct 8, 2014

Difference between using windows builder in eclipse v/s using only java swing without windows builder to build GUI application?

View Replies View Related

Swing/AWT/SWT :: Panels Switching On A Single Frame Using Netbeans Builder

Feb 3, 2014

I am writing a ComputerBaseTest application with Netbeans. I have each question on a panel and I want the questions(panels) to be switched, viewing the previous and the next question on a single frame, but I do not know how.

I only understand frame switching if each questn is to be on a frame but each score on each question (frame) do not sum up to give the overall score at the end of the test. Using multi-frame shows a sign of bad programming.

View Replies View Related

JavaFX 2.0 :: Custom ComboBox Implementation Not Recognized By Scene Builder 2.0

Jun 3, 2015

I did an implementation which is an extension of javafx.scene.control.ComboBox

Inside I imported the Class ComboBoxListViewSkin

import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin;
 
I think this might be the reason as this comboBox is not recognized at the import to the scene builder library. I can show up the import dialog of custom controls, but my custom ComboBox is not showing up. All other implementations are there correctly as they are loaded from my customControl.jar file
 
I use the ComboBoxListViewSkin for the functionality to scroll to an item in the combo as a user types a letter on the keyboard.

I do this by:

/**
     * This method scrolls the itemView of the items to the first item starting
     * with the given char or string
     *
     * @param pressedKey
     */
    public void scrollToChar(String pressedKey) {
        String value = pressedKey.toUpperCase(); 
        for (Object userEntry : getItems()) {

[Code] ....
 
I really need to show up my custom Combo in the scenebuilder, as otherwise the rest of my fxml is not editable in sceneBuilder 2.0 ....

View Replies View Related

JavaFX 2.0 :: Why Does Scene Builder Constantly Create New Instances Of Nodes

Nov 28, 2014

I thought I had a simple idea for creating a control that would let me get some of the behavior of a card pane.  This is the entire control:
 
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Node;

[Code] ....
 
The idea is pretty simple; extend StackPane, add an active property, bind the visible and managed properties of the pane to the active property, and, whenever the active property is changed to true, iterate sibling nodes de-activating any siblings that are also of the type Card.
 
However, this doesn't work with Scene Builder.  While trying to debug, I created an ExtStackPane:
 
import javafx.collections.ListChangeListener;
import javafx.scene.Node;
import javafx.scene.layout.StackPane;
public class ExtStackPane extends StackPane {
    {
        getChildren().addListener((ListChangeListener<Node>) c -> {
            System.out.println("ExtStackPane children change: " + c.toString());
        });
    }
}
 
All this does is log list change events.  However, I was very surprised by the output when working in Scene Builder.  I added both controls to Scene Builder and did the following:
 
0) Added an ExtStackPane
1) Added a Card to the ExtStackPane
2) Added another Card to the ExtStackPane
3) Added a Label to the first Card
4) Added a Label to the second Card
5) Changed the text of the first Label to Hello
6) Changed the text of the second Label to World
7) Set the first Card to active
8) Set the second Card to active
 
I get the following output:
 
1)
ExtStackPane children change: { [Card@5b9067b3] added at 0 }

2)
ExtStackPane children change: { [Card@6b6328bd] added at 0 }
ExtStackPane children change: { [Card@6aca8cc5] added at 1 }

[Code] ....
 
This is what things look like in Scene Builder:
 
Does Scene Builder recreate the entire hierarchy every time I make a small change?  Here's an application that does the same as the manual steps I performed in Scene Builder:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;
public class CardApplication extends Application {

[Code] ....

The output when running the above is:

1)
ExtStackPane children change: { [Card@6dfaa767] added at 0 }

2)
ExtStackPane children change: { [Card@6aa2c411] added at 1 }

[Code] ....
 
The behavior is obviously a lot different than when I'm working with the control in Scene Builder. What Scene Builder is doing to change the behavior of my Card control so much?  Does my Card control break some rule(s) I'm not aware of?

View Replies View Related

Real Reference Values (memory Locations) Of 2 String Builder Objects

Mar 7, 2014

My intention is to see the real reference values (memory locations) of 2 StringBuilder objects as below:

StringBuilder sb2 = new StringBuilder("123");
StringBuilder sb3 = sb2;
System.out.println(sb2);
System.out.println(sb3);

I was expecting a printout like

@S234853
@S984724

But all I got was 123 printed twice. How can i print out the reference values instead of what is inside the StringBuilder object ?

View Replies View Related

JavaFX 2.0 :: ImageView Image Created In Scene Builder 2.0 Doesn't Display In Running App

Sep 9, 2014

I'm using Scene Builder 2.0 and have added an ImageView to the parent AnchorPane.  I've added my PNG files for the app icon and the various buttons. I select the ImageView in Scene Builder and then crawl the filesystem to the project package folder and select the PNG for the Image.  The assigned image is displayed in the Imageview in Scene Builder in both design mode and Preview mode.
 
While everything else shows up properly when the app is executed, the image assigned to the ImageView does not display.
 
From the FXML file:

<ImageView fx:id="ivBRULogo" fitHeight="64.0" fitWidth="64.0" layoutX="14.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0">
         <image>
            <Image url="@BRU_PE_B_64.png" />
         </image>
      </ImageView>
 
What might be occurring between the compiled app and what Scene Builder generates?

View Replies View Related

How To Create And Link Two Classes

Apr 16, 2014

i have tried moving the

//create line
Point beginOfLine = new Point(point1, point2);
//ask user for second pair of coordinates
System.out.print("Enter the coordinates for X2 or <Random> or <Exit>:");
userInput=keyboard.nextLine();

code part to another class but nothing..this is what a second class should be doing

1 - Write a java class called Point to represent a 2-D point (With x and y)

- The constructor should take the x & y as double

- The class should have accessor / mutator methods for all coordinates

2 - Write a java class called Line to represent a line (with a starting point and an ending point)

- The constructor arguments are the start and end points

//import utilities to be used in the program
import java.util.Scanner;
import java.util.Random;
public class Point {
//declare variables
private double pointX, difX;
private double pointY, difY;

[code]....

View Replies View Related

Link Not Working In Jtable

May 26, 2014

The JTable that I'm using in my program fetches its value from the database. Now one of the fields contain the link item. I basically want it to be clickable so that once the user clicks on this link then he is directed to the desired webpage. I've tried to implement this in my code but somehow nothing seems to work.

Java Code:

public class JTableButtonMouseListener extends MouseAdapter
{
private final JTable table;
public JTableButtonMouseListener(JTable table) {
this.table = table;

[Code] .....

View Replies View Related

How To Link Netbeans To Netlogo

Mar 9, 2015

I want to connect netbeans to netlogo. I have a class: NetLogoConnection I want to call the class when I click on OK btn in my GUI. The codes are as following:

XML Code: import org.nlogo.app.App;
public class NetLogoConnection {
public static void main(String[] argv) {
App.main(argv);
try {
java.awt.EventQueue.invokeAndWait(
new Runnable() {
public void run() {

[code]....

View Replies View Related

JSP :: Change The Status Of Link

Sep 19, 2014

In my jsp page , functionality is their to change the status of the employee, so i want that if i click on activate it should change the link to the deactivate and when i click on deactivate it should change to activate. How can i do that?

View Replies View Related

JSP :: Display The Data On Edit Link?

Feb 10, 2014

I want to display the data on edit link according to Id no .For Ex I have data on the table below

IDName Emp ID Dept Edit
1xyz 3425 abcd Edit

On Edit link display the data according to ID number. How can i write the code.

View Replies View Related

JSP :: Unable To Send Parameters In A Link

Dec 17, 2014

What's wrong ? I'm trying to send parameters in a link so I can get this parameter (an id) and get all the forum-threads that are relatives to this parameter. Because I can't set attributes in a link. Or can I ?

<c:out value='<a href="<c:url value="threads.jsp">
<c:param name="idSub" value="${subforum.idsubforum }"/>
<c:param name="subName" value="${subforum.name }"/>
</c:url>">${subforum.name}</a>' escapeXml=""/>

does not work but I read it's not used in html. I'm really lost on this one.

View Replies View Related

Copy Target Of Link In Windows

Dec 8, 2014

How to copy the target of a link? I am using Apache's FileUtils class. I have tried the following and it only copies the link, not the target:

import org.apache.commons.io.FileUtils;
import java.io.File;
public class Copier {
public static void main(String[] args) {
File sourceFile = new File("C:/Demo/sourceDir/a_link.lnk");
File destinationDirectory = new File("C:/Demo/destinationDirectory");
FileUtils.copyFileToDirectory(sourceFile, destinationDirectory);
}
}

View Replies View Related







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