JSF :: Tomahawk Tree - Find Node ID In Bean Side?

Jan 6, 2015

I used tomahawk t:tree for showing my data in tree structure and displayed that very fine. But my problem is how can we find the node id in bean side when we select one node .Because i want to show some data based on that node.

View Replies


ADVERTISEMENT

Find Node Method Within Binary Tree

Mar 29, 2015

I have some work where I have to create a binary tree. Anyway I am stuck on one of the classes which has several methods I must fill in! The code is below

The headers for each method are: public Node find (member p1)The method find(Member p1) is used to return the node which contains a particular member. It is a private method because the interface to CabinetTree should not provide direct access to the internal nodes. It makes use of the method Node findNode (Member p1, Node current)

and the next method is : Node findNode(Member p1, Node current) which searches the tree from current node to find a node whose value is equal to the Member p1, i.e. a node in the tree such that p1.equals(current.getMember()) is true. If there is no such node then the method should return null.

public class CabinetTree {
private Node head;
CabinetTree(Member p1) {
head = new Node(p1, null);

[Code] ....

View Replies View Related

Java N-node Tree

Mar 30, 2015

I'm trying to write Java code for the following figure. Where, if node:4 will create following separate 4 trees. Number of node in

LEVEL1 (yellow) : n node.
LEVEL2 (green) : n-1 node.
LEVEL3 (blue) : n-2 node.

See image for node:4.
4node.jpg

The example out for node:4 :
012
013
021
023
031
032 and so on.

View Replies View Related

Swing/AWT/SWT :: Sorting In File Tree Node

May 12, 2014

I have requirement of sorting the files in tree structure with name and timestamp of creation, i am new to swings...

Here we are using FileTreeModel.

Root Folder:
folder1;
file1
file2
.
.

View Replies View Related

JavaFX 2.0 :: Mouse Event For Tree Node

Jun 10, 2014

I have a TreeView insight TabPane
 
treeView.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent mouseEvent) {
                if (mouseEvent.getClickCount() == 2 && mouseEvent.getButton() == MouseButton.PRIMARY) {
                    // Some action
                }
            }
        });

For some reason when I click on a tab body I can also perform the listener action. How I can add additional statement to perform the action only if I select node?

View Replies View Related

Unable To Remove Node From Binary Search Tree?

Apr 1, 2015

So in my binary search tree I'm trying to write a method that deletes the idem but for some reason it's not working. I have two things, I have the method and then another piece of code that tests the deletion method. Here's the actual method
 
public void delete(String word) {
root = deleteItem(root, word);
}
protected TreeNode deleteItem(TreeNode r, String word) {
if (r == null){
return r;
}
if(word.compareTo(r.item.getWord()) < 0){

[Code]...

Here's the test code

message = "Test: deleting 'word' -- ";
t = new BSTRefBased();
try {
t.delete("word");
result = t.getRootItem().getWord().equals(null);
} catch (Exception e) {
result = false;
}
System.out.println(message + (result ? "passed" : "FAILED"));

So for some reason it keeps saying that the test failed. Why does it keep saying that.

View Replies View Related

JavaFX 2.0 :: Select Tree Node On Button Click

Jun 20, 2014

I want to develop simple example in which I can select TreeView Nodes with Buttons(in some cases clicking on image and etc). I created this simple sample:
 
<pre style="" _modifiedtitle="true" jivemacrouid="_14032555963537721" ___default_attr="java" jivemacro="code" class="jive_text_macro jive_macro_code jivemacrouid_14032555963537721">
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.geometry.Insets;

[Code] .... 
 
The question is how I can select tree Node when I click on a button. For example when I click on a button Item A1 I want to select tree idem Item A1.

View Replies View Related

Why Reference Node Doesn't Change It Value In Binary Search Tree

Feb 10, 2015

the problem was :

i wrote it on paper with my examples.and just for laughts , i uploaded another picture that dont belong to my problem. its just my way to understand binary search tree implementation , so i wanted so share.just for laught : looks like the map of the universe.

now my problem : why after i changed Current to Current.left, Parent still has the value of root. i draw and wrote it on a paper. to be clear as possible - picture 2 :

View Replies View Related

Linked Binary Search Tree - Creating Node Object

Apr 5, 2015

I'm trying to use LinkedBinarySearchTree but a lot of the variables are protected in BinaryTreeNode. I am creating a BinaryTreeNode object but it still isn't allowing me to use them. The variables I am trying to use are element, left, and right.

import ch11.exceptions.*;
import ch10.LinkedBinaryTree;
import ch10.BinaryTreeNode;
/**
* LinkedBinarySearchTree implements the BinarySearchTreeADT interface with links.

*/
public class LinkedBinarySearchTree<T> extends LinkedBinaryTree<T>
implements BinarySearchTreeADT<T>

[Code] ....

View Replies View Related

Dummy Node In Doubly Linked List - Cannot Find Symbol Variable Error

Jun 5, 2012

Im running into some problems with the Java compiler. This is my code:

public class DoublyLinkedList<T> implements SimpleList<T> {
protected Node dummy;
protected int n;
public DoublyLinkedList(){

dummy = new Node();
dummy.next = dummy;
dummy.pre = dummy;

n = 0;

[Code] ....

I want to use a dummy node in my implementation of the Doubly Linked List, so it will be easier to code all the methods I need to write. I keep on getting a problem with line 14 and 15:

dummy.next = dummy;

dummy.pre = dummy;

// cannot find symbol variable next (compiler error)

// cannot find symbol variable pre

View Replies View Related

Swing/AWT/SWT :: How To Display Two JComboBoxes Side By Side

Jan 20, 2015

I am trying to display two JComboBoxes side by side. I can successfully display them as part of a BorderLayout if they are in the North and East, but when I try to display them side by side in the same area, eg North, only one of the combo boxes gets displayed.

package selectingshapes;
import java.awt.Graphics;
import java.awt.Color;
import javax.swing.JPanel;
import java.awt.Graphics2D;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;

[Code] .....

View Replies View Related

Find Minimum Spanning Tree Java

Mar 20, 2015

I am using the following code: But doesn't work fine. I try to find the Minimum spanning and print it out from house to which hose.

public class MinimumSpanning {
public static void main(String[] args) {
// [][] edge= are price between each hose edgs.
int [][] edge= {{0,7,9,12,0,0,0},
{7,0,0,10,0,0,0},
{10,0,0,12,0,0,0},
{12,10,12,0,11,0,10},
{0,0,0,11,0,4,8},
{0,0,0,0,4,0,6},
{0,0,0,10,8,6,0}};

[code]....

It should only print one time. Example between K to L prints many time.

View Replies View Related

Schedule More Tasks Side By Side

Aug 16, 2014

I'm using SchedulerExecutorServices to Schedule a task. My Question is how can i schedule more than one task side by side:

Here is what I'm doing:

public class Scheduler {
public Scheduler(Runnable thread, int startAfter, int iterateAfter, TimeUnit timeUnit, int length) {
ScheduledExecutorService scheduler = Executors
.newSingleThreadScheduledExecutor();
final ScheduledFuture<?> timeHandle = scheduler.scheduleAtFixedRate(

[Code] ....

View Replies View Related

Enterprise JavaBeans :: Calling Singleton Bean From Session Bean Returns NullPointerException

Feb 23, 2013

I am doing this

@Startup
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.CONTAINER)
@Lock(LockType.READ)
public class ResourceBean {

[Code] ....

And I call this singleton bean from a stateless session bean like this

@Stateless
public class ClientBean {
@EJB
ResourceBean resource;

public String create(String r)
{
String res=resource.returnString(r);
return res;
}
}

But resource.returnString(r); gives a org.apache.jasper.JasperException: java.lang.NullPointerException I started the glassfish server in debug mode and found out that "resource" was null. but @PostConstruct in singleton does print which means singleton bean exists.

Can we call singleton beans with no interface in such a way form a session bean? I actually want to acquire instance of singleton bean when a client invokes method in Client bean...

View Replies View Related

JSP / JSTL :: Page Set Bean Variables But Give NullPointerException When Bean Try To Merge In DB

Nov 21, 2013

I'm new to JSP but I've to use it to grab data coming from an external site, pass data to a Bean, write data in a DB and redirect the user to another page. Follow the JSP page.

<%@page import="EJB.getResponse"%>
<%
long paymentID = Long.parseLong(request.getParameter("paymentid"));
String responsecode = "9999";
getResponse g = new getResponse();

[Code] ....
 
This is the bean:

@ManagedBean
@RequestScoped
public class getResponse implements Serializable {
private Long paymentId;
private String result;
private String auth;

[Code] ....
 
On the console I see the prints but I receive the NullPointerException

WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at EJB.getResponse.printData(getResponse.java:72)
at org.apache.jsp.notify_jsp._jspService(notify_jsp.java from :60)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)

[Code] ....

View Replies View Related

Rubik Cube - Aligning Middle Side Color With Bottom Middle Side Color

Jan 16, 2015

I am trying to align the core/middle side color of a cube, index 4, with the bottom middle color of the same side, index 7. (Each side has values 0-8 where 0 - is the top left corner, 1 is the top mid corner, 2 is the top right corner, 3 is the middle left corner, etc).

In addition to lining up those two colors, I am also making sure that the neighbor color of index 7(the color that it is attached), in this case the bottom color, matches with the top core/middle color. I will attach some pictures and a print out to show what I am talking about...

However, in my code when I am trying to align all of these up together, it does not go into the while loop. Each of the loops essentially is trying to get a match of same color with index 4 and 7, as well as making sure that index 7's neighbor color (the bottom color, in this case) matches with the top color.

Here is what I have tried:

private void alignSideColor(){//make the bottom colors neighbor match with a middle side value and rotate it to the top, for the top cross

if(cube.bottom.square[1].charAt(0) == topColor){
while(cube.front.square[7].charAt(0) != frontColor && cube.bottom.square[1].charAt(0) != topColor){
rotateBottomClockwise(1);
System.out.println("Trying to align side color...");

[Code] .....

The print out of the ELSE IF is:
alignment is: W-G and tops: R-R
NOW ITS ALIGNED
even though the sides, index 4 and 7, are NOT aligned with each other

I have also tried the same thing but with out the 2nd condition in each while loop, and although is DOES enter the while loop, it does not perform correctly -- index 4 and 7 WILL have matches colors, but it does not check to see if index 7's neighbor matches with the top color.

Here is how it prints out
** ** ** G7 B6 Y1 ** ** **//this portion is the back of the cube
** ** ** R6 W5 O4 ** ** **
** ** ** R3 W2 O1 ** ** **
B3 G4 Y9 W9 O8 Y7 W3 B4 G9//this portion is the left, top, and right of the cube
B2 G5 R8 W4 R5 Y6 O2 B5 G8
O7 W8 R9 B7 B8 B9 R1 R4 R7
** ** ** O3 O6 O9 ** ** **//this portion is the front of the cube
** ** ** Y2 Y5 Y8 ** ** **
** ** ** B1 G6 W7 ** ** **
** ** ** Y3 Y4 G1 ** ** **//this portion is the bottom the cube
** ** ** R2 O5 G2 ** ** **
** ** ** W1 W6 G3 ** ** **

Here is the cube showing the top, left and front side

Here is the left and bottom side. As you can see index 4, G5 -- yes that is a 5 lol -- does not have the same color as index 7, W8.

I need to rotate the bottom until W8 is aligned with a middle white value. An examples of a neighbor is: W8-R2

View Replies View Related

Java Tree Structure - Build Tree Based On Traversal Results

Jun 17, 2014

How to do draw the original binary tree based on traversal results?

A binary tree has this pre-order traversal result: A,B,D,H,I,E,F,C,G,K,J (TreeNodes) And the same tree gives the following in-order traversal: B,H,I,D,A,C,F,E,K,G,J. Can you draw the tree structure?

View Replies View Related

EJB / EE :: Session Bean Must Not Extend Another Session Bean?

Nov 9, 2014

I have tried this example ([URL].../) with CarDao extending the BaseDao, it works like a charm.However, from the CarDao class, my NetBeans underlined the class name “CarDao” with the error message “A session bean must not extend another session bean.” But I can compile, deploy and run the application without any problem.

I have also heard that a session bean cannot extend another session bean, but why it works here?

I am using Java EE 6, NetBeans 8.0.1 and WebLogic 12c for this code testing.

View Replies View Related

Cannot Get Numbers To Switch To The Other Side Of Table

Oct 23, 2014

I was making this program and I ran into an issue which is that I cant seem and understand how to get the numbers to go to the other side of the table

I had to make a program that converted 1-9 miles to kilometers and the other side 25-65 (increments of 5) kilometers to miles and thats the part I am having trouble with.

Here is what I have so far

import java.util.Scanner;
public class MilesAndKilos {
public static void main(String[] args) {
int miles;
double kilometers=1.60934;

[Code] ....

and this is how I want it to look

MilesKilometersKilometers Miles
1 1.609 | 25 12.430
2 3.219 | 30 15.538
3 4.828 | 35 # here
4 6.437 | 40 # here
5 8.047 | 45 # here
6 9.656 | 50 # here
7 11.265 | 55 # here
8 12.875 | 60 37.290
9 14.484 | 65 40.398

View Replies View Related

Client Info On Server Side

Apr 6, 2014

I want to ask that, when a server listen to A port and it accepts a request from a client then the server accepts the request using accept method,but how does the server get the info about the client like wat is the port no and ip address of the client,I read a answer regarding this that Server never gets the port no of client only the ip address and it connects to client using a connection stream but as far I know from networking, a device must have the ip address and port no of the device it wants to connect to.

View Replies View Related

JSF :: Server-side State Saving

Nov 25, 2014

in my web.xml the.STATE_SAVING_METHOD setting is server

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>

for measurement of application security isn't not allow to change this parameter to client , so the problem when I access for application and I open a new page via linker for print for example and I would access for my initial page to make change or modify my initial page it s no possible to make any modification because I have a empty bean , but if the state saving is a client I haven't a problem because a tree map is stored in client browser, so my version of JSF is 1.1.1 ,

View Replies View Related

2D Side Scroller Moving Background In Java

Jan 18, 2014

I have been following a 2d side scroller tutorial in java and have got the basics working, I changed the code a bit to make it so that the tiles and background are always moving, this worked as i intended.Within the character class:

if (speedX < 0) {
centerX += speedX;
}
if (speedX == 0 || speedX < 0) {
bg1.setSpeedX(0);
bg2.setSpeedX(0);
 
[code]....

I wanted a way to make it so that if the character moves left, the tiles + background move slower. I am having issues with variable scope and setters/getters. Within the main game class, I have the code:

case
KeyEvent.VK_LEFT:
character.moveLeft();
character.setMovingLeft(true);
break;

How can i include an if statement within the tile class that reads whether the character is moving left (determined from a keyPressed event in the main game class) and adjusts the speed of the tiles accordingly?I want to write something to the effect of:

if (setMovingLeft = true){
speedX = bg.getSpeedX() * 3;
tileX = tileX + speedX - 1; << changed from - 4

View Replies View Related

How To Update To Allocate Memory In Windows Side

Sep 12, 2014

i am running unix scp command as below using Runtime.getRuntime.exec();

scp -P10022 -i /home/.ssh/id_ds 2937_filename.xls Username@hostname

following is the syntax in java:

final Runtime r=Runtime.getRuntime(0;
final String[] arg={ "/bin/sh","-c",command};
final Process process=r.exec(arg);

i am getting followin error java.io.IOException: cannot run program "/bin/sh: java.io.IOException: error=12, Cannot allocate memory

what i need to update to allocate memory in windows side.

View Replies View Related

Servlets :: How To Provide Server Side Validation With JSP

Apr 8, 2014

I want to know what is the best way for server side validation in servlets with JSP.

View Replies View Related

JSP :: User Server Side Validation In Pages

Apr 3, 2015

I have a Registration Form in which I am registering user to perform some sort like Entering messages I want to perform some Server Side validation.

Like suppose a user has Enter an Id then as soon as he start entering the Id then I want that this Id should be checked in database that if this Id exists in database or not.

and similar types of validation I want to apply on other fields to.

How can I acheive this?

View Replies View Related

Web Services :: JAX-WS How To Log Request And Response On Client Side

Nov 27, 2014

I am calling a SOAP based webservice using JAX-WS and a client jar. I want to get a request and response somehow and save it for audit purposes. How I can do this?

When I google it, only Handlers come up, but, as far as I understand, it is not applicable on client side.

View Replies View Related







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