Child Window Communicate with Parent Window Question
I am new to the ADF. If I want to create a page which has a button that open a new window. On the new window, user can update something and close the window. After the close of the new window, the parent window should be notified and do some action. How can I implement this logic in ADF. Please advise. Thank you
Hi,
such window dependencies can only be handled if you use window.open in JavaScript so that you can build up a window handle that allows you to call back to the parent window. Question: Do you need a new window, or would a lightweigh popup do as well ? If yes, then this can be achieved easy and with no JavaScript, which should be seen as preferred
Frank
Similar Messages
-
Session expiration issue with parent and child window
Hi,
We have two applications (App1 - Implemented using JSF, Spring and Hibernate and App2 -Implemented using Spring MVC, Spring JDBC).
I have implemented 'Test Access Content' functionality in App1.
First admin user (Role- Manager) needs to login to App1
As part of 'Test Access Content' functionality, he enters URL with encrypted key and click 'Test Access' button.
It opens new window (implemented using java script - window.open) and hits spring controller of App2.
In spring controller of App2, I am decrypting the key to get user details. After that i am setting user details in session, constructing final URL to display actual content.
Problem is parent window maintains session till child window renders response. Once child window renders response, parent window loosing session.
So, if i click any button in parent window after child window renders response, it displays login page as there is no session for parent window.
Please note that App1 and App2 are sharing same domain. only context paths are different for both apps (app1 and app2).
Any suggestions on this issue are much appreciated. Please let us know if you have any questions.Hi,
When you open a child window from parent window then you can access child data in the parent window through javascript.
We have a main web page. There are quite many links on it from which >user can open new web pages but the data is saved when the submit >button on the main page is clicked. Also data that user entered on the >other sub pages is not displayed in the main window.
1 is this a case of parent and child window.case 1 When you are submitting the main page you need to run javascript function and get data from child windows and save that to database or session. next time when you are displaying the main window you need to query session or database to display the child window data in the main window.
Case 2> closing child window and you need data in the parent. This can be done in two ways.
1> When you are closing the child window populate some variables of the main window using javasript.
2> Save the values in the database or session and refresh the main window and extract data from database or session
Where should the data be saved that user enetered on the sub pages as the data is not shown in the main page - should it be stored in the session?It is design decision. You can store data in either session or database when you are closing the child window. But ifyou are saving the data on the main page then you can populate main page with child windows data using javascript. Save the data t database when main window data is saved. Depends on business requirements.
In short if you are saving child windows data in session or database then you need to refresh main screen to pull that data otherwise populate main screen using javascript.
I hope i answered your questions :) best of luck -
Window.open always opens a child window with parent window propertiesin firefox 30
By clicking on a link my code uses window.open which should open the response in child window. I am not specifying any height and width(as per requirement). In firefox alone, the window takes up the properties of child window and opens with same size as of parent window. Is there a way to restrict Firefox from inheriting the properties of parent window?
Hi prajulakc,
Thank you for your question. Currently the active window selected when you create a new window that new window will take the active window's screensize.
You can add a preference: see also [https://support.mozilla.org/en-US/questions/754273 question/754273] -
Data transfer B/W parent windonw and child window with out java script
hi ,
i am using h:outputLink Tag to open child window , i am unable to pass parent window text box value to child window with out java script , Here i am using two different backing beans for parent and child windows . Plz help me .Hi -- I pass details between pages regularly. The following has worked for me:
ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
ValueBinding binding = factory.getApplication().createValueBinding("#{beanName}");
BeanName beanProperty = (BeanName) binding.getValue(FacesContext.getCurrentInstance());
... then set the you can set the values. Can't recall if I need to use SaveStates for the items. Probably if you use request scope beans. -
Communicating between the parent and child windows in Struts
Hey,
I would like to know what is the best way to communicate between the child and parent windows on a struts based web application. For example i have a struts based jsp page. I call a child window from this page. On the child window i select few values and they have to be shown on the parent. What is the best way to achieve this in struts.
Thanks
in advance.
KMThe only way to do this without Javascript is to have the child window have a form and the form has a target defined as the name of the parent window (how to name it without using frames or having it open from another window, I'm not sure), and when you submit the form, it'll submit to the parent window/frame and you can process that form on the server and return the same parent page with the selected values.
Otherwise, you need Javascript to set form values to "window.opener" from the child window.
Either way, it's not really a Struts thing, technically. -
Thanks for the info, Kyle. I will probably try to find an older 32-bit XP machine. VM is just not an option for me right now.
Hello everybody,
I am trying to use the DIgilent Spartan 3E board with Labvew 2012 SP1 32 bit. I am able to compile the example code for LED shift. I am however unable to transfer code to the FPGA. I get the following error message:
Error Code: -310602
NI-COBS: Unable to communicate with device over communication cable.
Please verify that the cable is connected to a supported device and that the appropriate drivers are installed.
My system configuration is as follows:
Windows 7 (64 bit) on Dell XPS laptop.
Labview 2012 SP1 (32 bit)
Labview FPGA 2012 SP1
Labview 2012 FPGA support for Spartan3E
Xilinx 13.4 tools
DEFB LV FPGA 2012sp1 support installer
Xilinx USB cable driver v1.3 installed.
I took all the precautions mentioned by others on this forum and others, mainly that the cable must be disconnected before installing the Xilinx cable driver. All software and drivers were installed correctly. I even uninstalled and reinstalled the entire Labview software set I had. I still get the same error.
A few other questions:
1. Is the Xilinx cable different from a regular USB cable of the same configuration ?
2. When I program the FPGA I only have the USB cable connected between my computer and the Spartan 3e board. Should any other cable be connected ?
3. What should be the correct jumper settings for J1 - JP30 (especially J30, J11, JP9, JP6, JP7, etc) ?
I have been at this or over 3 days trying to figure it out. Any help will be greatly appreciated.
-
Accessing variables from Child window from the parent window
Hi All,
I am in the process of integration of payment gateway, here I am opening payment gateway page as a new window, and after payment is done then I need access one variable which is hidden variable ...any ideasHave a hidden field/js variable in the parent page. Add a Javascript function in parent page which would take a value as parameter and set in the parent page hidden field/js variable. In the child window, you can invoke the method from script block as window.opener.setValue(document.getElementById('CHILD_WINDOW_HIDDEN_FIELD_ID').value)
For Javascript related questions, please visit Javascript forums. -
Calling a Function in the Parent Window from the Child Window
QUESTION: How do I call a function resident in the parent
window from a child window?
BACKGROUND
I have a JavaScript function resident in the parent window
that reformats information obtained from the Date object and writes
the result to the parent window using the document.write( ) method.
I would like to call this function from the child window and have
it write to the child window instead. Is this possible? If not,
must I rewrite the entire function and nest it in the below code?
If so, what is the proper form of nesting?
CODE: The code that creates and fills the child window is
provided below. The highlighted area indicates where I would like
to enter the information from the function resident in the parent
window. I have tried every imaginable permutation of code that I
can imagine and nearly destroyed my parent document in the process.
I am very happy that I had a back-up copy!
function openCitationWindow() {
ciDow = window.open("", "", "width=450, height=175, top=300,
left=300");
ciDow.document.write("A proper way to cite a passage of text
on this page:<br /><br />Stegemann, R. A. 2000.
<cite>Imagine: Bridging a Historical Gap</cite>. " +
document.title + ". [<a href='" + location.href + "'
target='_blank'>online book</a>] <" + location.href
+ "> (");
MISSING CODE;
ciDow.document.write(").<br /><br /><input
type='button' value='Close Window' onclick='window.close()'>");
ciDow.focus();Never mind - I was doing something very stupid and wasn't
calling the function as a method of a movie clip. I was simply
calling checkTarget(event) rather than
event.currentTarget.checkTarget(event); which seems to work. -
How to parse parameter from child window to parent window in JSP
I have two JSP i.e. course1.jsp and course2.jsp. I would want to find out how I could parse the parameter/value from child window to the parent window when the child window get closed.
What I am trying to do is actually a file upload process. The child windows will open for user to upload the file, and when close, the file name will be parse into the parent form for database update. Is this something possible at all? or is there any other better approaches.
Thank you.
These are the two files:
--------course1.jsp ------------
Attach File <p>
<FORM name="courseForm" action="course2.jsp" method="post" enctype="multipart/form-data">
<TABLE cellSpacing=1 cellPadding=3 border=0 WIDTH=500>
<TR >
<TD>
<input type="text" NAME="f_file_name" size="30" VALUE="this value should be taken from child windows">
get file name
<p>
<INPUT class="buttons" TYPE="submit" NAME="submit" VALUE="Submit">
</TD>
</TR>
</TABLE>
</FORM>
---- course2.jsp -------
<%
String filename = "this is the string needs to go back to parent windows when I click on close";
%>
<p>
closeIn course2.jsp, you have to write some javascript code to reload the parent window document to reload the document with an added parameter. But, instead of doing this, you can also do simple thing; in course2.jsp, you can reference course1.jsp controls via javascript object, "parent". On closing event of course2, you can write:
parent.courseForm.f_file_name.text = '<%=filename%>' ;
window.close() ;
But for this to work, you must open your course2.jsp document thru window.open() function instead of simple hyper link (as you did thru ).
So, modify the hyperlink line like below:
get file name
Hope it helps. -
How to pass a data from child window to parent window
Hi,
I have a jsp page with two hidden fields and a button, On clicking the button a popup will come out. There are two combobox in the popup and a search button. After putting a value in the comboboxes,if I click the search button, I need the datas of the combobox to pass to the parent's hidden fields then I need to do a data base search with that values of hidden fields and display the result in the parent page.
I could I solve this problem, Please help, Its urgent.
Thanks and Regards
Rajib SharmaI think that you can use the JavaScipt as follow to pass a data from child window to parent window
<HEAD>
<script>
function passData(){
opener.form1.test1.value=form2.test2.value; //pass the value of test2 to the parent's test1
window.close();
</script>
</HEAD>
<BODY>
<form name=form2>
<input name=test2 type=text>
<input type=button onclick="passData()" value=CLOSE>
</form>
</BODY> -
Parent child window functionality using CFM
In .cfm page I am trying to implement the following
functionality
I got a parent window contains a button.
On button click a child window should get open.
This child Window should get embed in that parent window
(like MDI application)
1)i.e While minimizing the parent window this child window
should also get minimized
2)While closing the parent window this child window should
also get closed
3) We should also be able to close the child window alone.
4) If you double click on the title bar of the child window
it should get maximized
5) Again double click on the title bar of the child window it
should get minimized.
I tried with <embed> tag but it seems its for audio ,
flash kind files.
If we can use <embed> tag means whats should be the
value of the "Type" attribute.
waiting for your valuable informationWindow handlers and controls are generally a function of the
browser and not really manipulatable using ColdFusion, as it runs
on server-side only, not client-side. JavaScript would be more the
thing to play with in this regard, although I don't think there is
an "onClose" event handler.
HOWEVER!
All browsers have a security feature that prevents pop-up
child windows from "hijacking" their parents window behaviors,
including resizing, moving, changing the toolbars, closing, etc.
This security feature cannot be bypassed, and is an integral
hard-coded aspect of all modern browsers. I suspect that what you
are looking to do may be impossible due to this one fact, unless
someone knows a bypass. -
Popup not communicating with parent/opener window
I use an eCommerce system that when we are entering an item, a popup window will come up, asking us to choose the product. When I click the button that is supposed to link back to the parent/opener page with that product included, it does not link back and does not respond at all. Why is this a problem ONLY in Firefox? I have all the latest updated plug-ins (besides Google Earth and Yahoo! plug-ins). I even disabled pop-ups thinking that would help (not so much).
Let's check something. In the opener (original tab), press Ctrl+Shift+k to open the Web Console. Paste the following line of code and press Enter:
<br>alert(typeof self.iform);
If you get something other than "undefined" then there appears to be a problem with the child window accessing the object in the opener. If you get "undefined", then the object reference is not valid in Firefox regardless of which window the code is in. -
ADF: Parent Child Window Popup
Hi All,
I am having a requirement in which, I am trying to create Parent Child window in ADF. I will give some information in the Parent form and there will be a button which will popup a child window and I will enter some information in a child window and submit, it should come to parent page without displaying the details entered in the child window and once I click the submit button in the Parent window, both the Parent and Child window Detaiils should get saved to the database. I am trying to use ADF or ADF BC.
Please provide me the steps that need to be followed.
Thanks.This is a common use case. You question on the other hand shows that you not really tried the figure our the answers yourself.
It's too much you ask us to do your work.
First you should think which technology (swing or faces) you want to use. Then you should read up some of the documents (i.e. the Fusion Order Demo, or any other sample or cue card) to get some knowledge of the framework.
I you have a problem then, come back and mention the jdev Version you are using.
Timo -
Move data from Child window textbox to Parent window Mainwindow WPF
I'm trying to take what's in a textbox in the child window to the textbox in the Parent window and close the child window...? any links or a code example to help please
Thank you in advanceHi
Create a Main window with a button and a child window with a text box in it and try to use this code in the main window
namespace WpfApplication
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public MainWindow()
InitializeComponent();
ChildWindow childWindow;
string CaptureMessageFormChildWindow;
private void button1_Click(object sender, RoutedEventArgs e)
childWindow = new ChildWindow();
childWindow.Show();
childWindow.Closed += (s, args) => MessageBox.Show(childWindow.textBox1.Text);
CaptureMessageFormChildWindow = childWindow.textBox1.Text;
//Now you can use the data captured form the child windows
The complexity resides in the simplicity Follow me at: http://smartssolutions.blogspot.com -
Image displayed by child window captured by parent window.
This is a rather peculiar problem.
My application starts with a JFrame which takes some file as an input and then open another window and plot the graph.What happens is whatever is drawn on the child window(graph) is captured by the parent window which looks quite odd.Could anyone help me out the how to solve this problem??sure... here are the codes......
//parent window:
package igib.genebrowser;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import igib.genebrowser.menu.*;
import igib.genebrowser.plot.*;
public class GeneBrowserMain extends JFrame
public GeneBrowserMain()
super("GenomeBrowser-1.0");
Container cp = this.getContentPane();
cp.setLayout(new BorderLayout());
DrawFeature df = new DrawFeature();
cp.add(df, BorderLayout.CENTER);
public static void main(String args[])
Point p = new Point(400,300);
GeneBrowserMain gbm = new GeneBrowserMain();
GeneBrowserMenu menu = new GeneBrowserMenu();
gbm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gbm.setSize(300,200);
gbm.setLocation(p);
gbm.setJMenuBar(menu);
gbm.setResizable(false);
gbm.setVisible(true);
//GeneBrowserMenu file
package igib.genebrowser.menu;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import igib.genebrowser.plot.*;
import igib.genebrowser.menu.*;
import igib.genebrowser.*;
public class GeneBrowserMenu extends JMenuBar implements ActionListener
JMenu fileMenu;
JMenuItem open;
JMenuItem quit;
GeneBrowserMain gbm;
public GeneBrowserMenu()
this.gbm = gbm;
fileMenu = new JMenu("File");
this.add(fileMenu);
open = new JMenuItem("open");
fileMenu.add(open);
quit = new JMenuItem("quit");
fileMenu.add(quit);
open.addActionListener(this);
quit.addActionListener(this);
public void actionPerformed(ActionEvent e)
if(e.getSource() == open)
try
Point p = new Point(300,200);
FileOpenWindow f = new FileOpenWindow();
f.setSize(450,250);
f.setLocation(p);
f.setVisible(true);
catch(Exception ex)
if(e.getSource() == quit)
System.exit(1);
//FileOpenWindow which takes file as input and opens GBMainFrame and plot graphs
package igib.genebrowser.menu;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.colorchooser.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import javax.swing.filechooser.*;
import java.io.FileWriter;
import java.io.BufferedReader.*;
import java.io.File;
import igib.genebrowser.util.*;
import igib.genebrowser.plot.*;
import igib.genebrowser.*;
//import java.io.*;
public class FileOpenWindow extends JFrame implements ActionListener, ItemListener
public JTabbedPane tPane ;
public File seqFile, repeatFile, snpFile, geneFile;
JLabel sequenceFile, repeatfile, snpfile, genefile, jb, winsize, shiftsize;
JButton browse1, browse2, ok1, ok2, browse3, browse4, browse5, browse6;
JTextField jtf1, jtf2, jtf3, jtf4, jtf5, jtf6;
File f;
PlotGraph pg;
GBMainFrame gb;
GeneBrowserMain gbm;
JComboBox shiftSize, winSize;
public FileOpenWindow()
super("Open File");
ImageIcon icon = new ImageIcon("images/middle.gif");
Container cp = this.getContentPane();
tPane = new JTabbedPane();
JPanel jp1 = addNCBI();
JPanel jp2 = addOther();
tPane.addTab("NCBI", icon, jp1);
tPane.setSelectedIndex(0);
tPane.addTab("Other", icon, jp2);
tPane.setSelectedIndex(0);
//tPane.add(jp1);
cp.add(tPane,BorderLayout.CENTER);
this.setResizable(false);
private JPanel addNCBI()
JPanel cp = new JPanel();
cp.setLayout(new GridLayout(8,5));
//***********************1st row*************************************************//
for(int i = 0; i < 5; i++)
jb = new JLabel(" ");
cp.add(jb);
//***********************1st row*************************************************//
//***********************2nd row*************************************************//
for(int i = 0; i < 5; i++)
jb = new JLabel(" ");
cp.add(jb);
//***********************2nd row*************************************************//
//***********************3rd row*************************************************//
jb = new JLabel(" Sequence");
cp.add(jb);
sequenceFile = new JLabel(" File :");
cp.add(sequenceFile);
browse1 = new JButton("browse");
cp.add(browse1);
jtf1 = new JTextField(" ");
cp.add(jtf1);
jb = new JLabel(" ");
cp.add(jb);
//***********************3rd row*************************************************//
//***********************4th row*************************************************//
jb = new JLabel(" Repeat");
cp.add(jb);
repeatfile = new JLabel(" File :");
cp.add(repeatfile);
browse2 = new JButton("browse");
cp.add(browse2);
jtf2 = new JTextField(" ");
cp.add(jtf2);
jb = new JLabel(" ");
cp.add(jb);
//***********************4th row*************************************************//
//***********************5th row*************************************************//
for(int i = 0; i < 5; i++)
jb = new JLabel(" ");
cp.add(jb);
//***********************5th row*************************************************//
//***********************1st row*************************************************//
winsize = new JLabel("Window Size: ");
cp.add(winsize);
winSize = new JComboBox();
winSize.addItem("100");
winSize.addItem("500");
winSize.addItem("1000");
winSize.addItem("5000");
cp.add(winSize);
jb = new JLabel(" ");
cp.add(jb);
shiftsize = new JLabel("Shift Size: ");
cp.add(shiftsize);
shiftSize = new JComboBox();
shiftSize.addItem("25");
shiftSize.addItem("50");
shiftSize.addItem("100");
shiftSize.addItem("500");
cp.add(shiftSize);
//***********************1st row*************************************************//
//***********************5th row*************************************************//
for(int i = 0; i < 5; i++)
jb = new JLabel(" ");
cp.add(jb);
//***********************5th row*************************************************//
//***********************6th row*************************************************//
for(int i = 0; i < 2; i++)
jb = new JLabel(" ");
cp.add(jb);
ok1 = new JButton("OK");
cp.add(ok1);
for(int i = 0; i < 2; i++)
jb = new JLabel(" ");
cp.add(jb);
//***********************6th row*************************************************//
browse1.addActionListener(this);
browse2.addActionListener(this);
ok1.addActionListener(this);
shiftSize.addItemListener(this);
winSize.addItemListener(this);
return cp;
private JPanel addOther()
JPanel cp = new JPanel();
cp.setLayout(new GridLayout(9,5));
//***********************1st row*************************************************//
for(int i = 0; i < 5; i++)
jb = new JLabel(" ");
cp.add(jb);
//***********************1st row*************************************************//
//***********************2nd row*************************************************//
jb = new JLabel(" ");
cp.add(jb);
sequenceFile = new JLabel("sequenceFile :");
cp.add(sequenceFile);
browse3 = new JButton("browse");
cp.add(browse3);
jtf3 = new JTextField(" ");
cp.add(jtf3);
jb = new JLabel(" ");
cp.add(jb);
//***********************2nd row*************************************************//
//***********************3rd row*************************************************//
jb = new JLabel(" ");
cp.add(jb);
repeatfile = new JLabel("RepeatFile :");
cp.add(repeatfile);
browse4 = new JButton("browse");
cp.add(browse4);
jtf4 = new JTextField(" ");
cp.add(jtf4);
jb = new JLabel(" ");
cp.add(jb);
//***********************3rd row*************************************************//
//***********************4th row*************************************************//
jb = new JLabel(" ");
cp.add(jb);
snpfile = new JLabel("SNP File :");
cp.add(snpfile);
browse5 = new JButton("browse");
cp.add(browse5);
jtf5 = new JTextField(" ");
cp.add(jtf5);
jb = new JLabel(" ");
cp.add(jb);
//***********************4th row*************************************************//
//***********************5th row*************************************************//
jb = new JLabel(" ");
cp.add(jb);
genefile = new JLabel("Gene File :");
cp.add(genefile);
browse6 = new JButton("browse");
cp.add(browse6);
jtf6 = new JTextField(" ");
cp.add(jtf6);
jb = new JLabel(" ");
cp.add(jb);
//***********************5th row*************************************************//
//***********************6th row*************************************************//
for(int i = 0; i < 5; i++)
jb = new JLabel(" ");
cp.add(jb);
//***********************6th row*************************************************//
//***********************1st row*************************************************//
winsize = new JLabel("Window Size: ");
cp.add(winsize);
winSize = new JComboBox();
winSize.addItem("100");
winSize.addItem("500");
winSize.addItem("1000");
winSize.addItem("5000");
cp.add(winSize);
jb = new JLabel(" ");
cp.add(jb);
shiftsize = new JLabel("Shift Size: ");
cp.add(shiftsize);
shiftSize = new JComboBox();
shiftSize.addItem("25");
shiftSize.addItem("50");
shiftSize.addItem("100");
shiftSize.addItem("500");
cp.add(shiftSize);
//***********************1st row*************************************************//
//***********************6th row*************************************************//
for(int i = 0; i < 5; i++)
jb = new JLabel(" ");
cp.add(jb);
//***********************6th row*************************************************//
//***********************7th row*************************************************//
for(int i = 0; i < 2; i++)
jb = new JLabel(" ");
cp.add(jb);
ok2 = new JButton("OK");
cp.add(ok2);
for(int i = 0; i < 2; i++)
jb = new JLabel(" ");
cp.add(jb);
//***********************7th row*************************************************//
browse3.addActionListener(this);
browse4.addActionListener(this);
browse5.addActionListener(this);
browse6.addActionListener(this);
ok2.addActionListener(this);
return cp;
public void actionPerformed(ActionEvent e)
if(e.getSource()==ok1)
String ncbi = "";
String repeat= "";
try
ncbi = jtf1.getText();
repeat = jtf2.getText();
System.out.println("NCBI" + ncbi + "www");
if( ncbi.equals(" ") && repeat.equals(" "))
System.out.println("NCBI333" + ncbi);
DisplayInfo di = new DisplayInfo("Sorry!, Please select some file", "");
di.setSize(450,100);
di.setLocation(600,600);
di.setVisible(true);
GBFileProp.snpFile = "";
GBFileProp.geneFile = "";
return;
catch(Exception ex)
GBFileProp.fileFormat="NCBI";
GBFileProp.fileName = ncbi;
GBFileProp.repeatFile = repeat;
ReadNCBI readFile1 = new ReadNCBI(ncbi);
ReadRepeatFile rrf = new ReadRepeatFile(repeat);
try
gb = new GBMainFrame();
gb.setSize(1200,750);
catch(Exception ex)
DisplayInfo di = new DisplayInfo("Sorry!, Wrong File", "Enter file in \".gbk\" format");
di.setSize(450,100);
di.setLocation(600,600);
di.setVisible(true);
setVisible(false);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
if(e.getSource()==ok2)
String sequence= "";
String repeat= "";
String snp= "";
String gene= "";
try
sequence = jtf3.getText();
repeat = jtf4.getText();
snp = jtf5.getText();
gene = jtf6.getText();
if( sequence.equals(" ") && repeat.equals(" ") && snp.equals(" ") && gene.equals(" "))
DisplayInfo di = new DisplayInfo("Sorry!, Please select some file", "");
di.setSize(450,100);
di.setLocation(600,600);
di.setVisible(true);
System.out.println("File " + GBFileProp.repeatFile);
return;
catch(Exception ex)
GBFileProp.fileFormat="Other";
GBFileProp.fileName = sequence;
GBFileProp.repeatFile = repeat;
GBFileProp.snpFile = snp;
GBFileProp.geneFile = gene;
ReadGeneFile a = new ReadGeneFile(gene);
ReadSNPFile rsp = new ReadSNPFile(snp);
GCReadFile grf = new GCReadFile(sequence);
ReadRepeatFile rrf = new ReadRepeatFile(repeat);
try
gb = new GBMainFrame();
gb.setSize(1200,800);
catch(Exception ex)
DisplayInfo di = new DisplayInfo("Sorry!, Wrong File", "Enter file in corresponding format");
di.setSize(450,100);
di.setLocation(600,600);
di.setVisible(true);
setVisible(false);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
if(e.getSource()==browse1)
String w;
Fselect(1);
try
w=f.toString();
jtf1.setText(w);
catch(Exception ex)
if(e.getSource()==browse2)
String w;
Fselect(4);
try
w=f.toString();
jtf2.setText(w);
catch(Exception ex)
if(e.getSource()==browse3)
String w;
Fselect(3);
try
w=f.toString();
jtf3.setText(w);
catch(Exception ex)
if(e.getSource()==browse4)
String w;
Fselect(2);
try
w=f.toString();
jtf4.setText(w);
catch(Exception ex)
if(e.getSource()==browse5)
String w;
Fselect(4);
try
w=f.toString();
jtf5.setText(w);
catch(Exception ex)
if(e.getSource()==browse6)
String w;
Fselect(2);
try
w=f.toString();
jtf6.setText(w);
catch(Exception ex)
if(e.getActionCommand().equals("sequence_ncbi"))
final JFileChooser chooser = new JFileChooser();
FileFilter type1 = new ExtensionFilter ("Fasta File(.faa)", new String[] {".faa",".txt"});
chooser.addChoosableFileFilter (type1);
chooser.setFileFilter (type1);
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION)
seqFile = chooser.getSelectedFile();
else if(e.getActionCommand().equals("sequence_other"))
final JFileChooser chooser = new JFileChooser();
FileFilter type1 = new ExtensionFilter ("Fasta File(.faa)", new String[] {".faa",".txt"});
chooser.addChoosableFileFilter (type1);
chooser.setFileFilter (type1);
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION)
seqFile = chooser.getSelectedFile();
public void itemStateChanged (ItemEvent e)
GBFileProp.windowsize = (int)Integer.parseInt(winSize.getSelectedItem().toString());
GBFileProp.shiftsize = (int)Integer.parseInt(shiftSize.getSelectedItem().toString());
public void Fselect(int sel)
final JFileChooser chooser = new JFileChooser();
ImageIcon openIcon = new ImageIcon("images/open.gif");
FileFilter type1 = new ExtensionFilter ("NCBI File(.gbk)", new String[] {".gbk",".txt"});
FileFilter type2 = new ExtensionFilter ("ptt File(.ptt)", new String[] {".ptt",".txt"});
FileFilter type3 = new ExtensionFilter ("Fasta File(.faa)", new String[] {".faa",".txt"});
FileFilter type4 = new ExtensionFilter ("Text File(.txt)", new String[] {".txt",".txt"});
chooser.setCurrentDirectory (new File (System.getProperty ("user.dir")));
if(sel == 1)
chooser.addChoosableFileFilter (type1);
chooser.setFileFilter (type1);
if(sel == 2)
chooser.addChoosableFileFilter (type2);
chooser.setFileFilter (type2);
if(sel == 3)
chooser.addChoosableFileFilter (type3);
chooser.setFileFilter (type3);
if(sel == 4)
chooser.addChoosableFileFilter (type4);
chooser.setFileFilter (type4);
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION)
f = chooser.getSelectedFile();
//System.out.println("path of open "+ f);
//GBMainFrame file
package igib.genebrowser;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import igib.genebrowser.menu.*;
import igib.genebrowser.plot.*;
import igib.genebrowser.util.*;
public class GBMainFrame extends JFrame
GBMainMenu gb;
PlotGraph pg;
JPanel jf = new JPanel();
JPanel jf1;
LineGraph lg, lg1;
JPanel jp1, jp2;
JLabel jl;
public GBMainFrame()
super("File: " + GBFileProp.fileName + " " + GBFileProp.repeatFile + " " + GBFileProp.snpFile + " " + GBFileProp.geneFile);
Container cp = this.getContentPane();
cp.setLayout(new BorderLayout());
cp.setSize(1024,600);
Color c1=new Color(255,100,100);
jf = new JPanel(new GridLayout(1,15));
cp.add(jf, BorderLayout.NORTH);
pg = new PlotGraph();
pg.setBackground(Color.white);
cp.add(pg, BorderLayout.CENTER);
GBFileProp.jsb.setUnitIncrement(5);
cp.add(GBFileProp.jsb, BorderLayout.SOUTH);
lg1 = new LineGraph();
lg1.setBackground(Color.white);
lg1.setSize(50, 1000);
cp.add(lg1, BorderLayout.EAST);
lg = new LineGraph();
lg.setBackground(Color.white);
cp.add(lg, BorderLayout.WEST);
gb = new GBMainMenu();
jf.add(gb);
setVisible(true);
repaint();
//PlotGraph File
package igib.genebrowser.plot;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.util.*;
import java.awt.image.*;
import java.io.*;
//import Acme.JPM.Encoders.*;
//import Acme.*;
import java.awt.print.*;
import java.awt.Component;
import java.awt.print.PrinterJob;
import igib.genebrowser.menu.*;
import igib.genebrowser.util.*;
import igib.genebrowser.*;
public class PlotGraph extends JPanel implements MouseListener,MouseMotionListener
int xcoordinate;
JScrollBar scrollBar;
int mouseX;
int mouseY;
String st1 = " ";
JScrollPane jsp;
int check;
int n;
double base;
int value;
String repeatSymbol = "!";
int position[] = new int[1500];
public PlotGraph(String st)
check = 0;
GBFileProp.check = false;
setVisible(true);
ToolTipManager.sharedInstance().setInitialDelay(0);
addMouseListener(this);
addMouseMotionListener(this);
public PlotGraph()
check = 0;
//System.out.println(GBFileProp.gcmax + "max y");
if(GBFileProp.genescore>5)
GBFileProp.filesize = GBFileProp.readGeneEnd[GBFileProp.genescore - 6];
//System.out.println(GBFileProp.seqscore + " GBFileProp.seqscore");
if(GBFileProp.filesize < GBFileProp.seqscore)
GBFileProp.filesize = GBFileProp.seqscore;
if(GBFileProp.snpscore>5)
if(GBFileProp.filesize < GBFileProp.readSNPPosition[GBFileProp.snpscore-6])
GBFileProp.filesize = GBFileProp.readSNPPosition[GBFileProp.snpscore-6];
if(GBFileProp.repeatscore>2)
if(GBFileProp.filesize < GBFileProp.endRepeatPosition[GBFileProp.repeatscore-2])
GBFileProp.filesize = GBFileProp.endRepeatPosition[GBFileProp.repeatscore-2];
GBFileProp.scrollsize = (int)GBFileProp.filesize/285;
GBFileProp.check = true;
setVisible(true);
addMouseListener(this);
addMouseMotionListener(this);
try
AdjustmentListener lst = new AdjustmentListener()
public void adjustmentValueChanged(AdjustmentEvent e)
int i = e.getValue();
value = i;
GBFileProp.defaultStartCoordinate = (int)(e.getValue()*10*base);
GBFileProp.defaultEndCoordinate = GBFileProp.defaultStartCoordinate + (int)(10000*base);
repaint();
GBFileProp.jsb.addAdjustmentListener(lst);
catch(Exception e)
System.out.println("error here" + e);
//******************** For Painting all the graph**********************************//
public void paintComponent(final Graphics g)
super.paintComponent(g);
Font f = new Font("Times-Roman", Font.PLAIN, 16);
g.setFont(f);
GBFileProp.scrollsize = (int)GBFileProp.filesize/285;
base = (double)(100.0/GBFileProp.zoomSize);
n = (int)(GBFileProp.filesize/base);
GBFileProp.jsb.setMaximum(n/10);
if(GBFileProp.checkSave)
GBFileProp.checkSave = false;
Image img = this.createImage(1200,800);
Graphics gph = img.getGraphics();
this.paint(gph);
try
OutputStream os = new FileOutputStream(GBFileProp.save);
GifEncoderTest ge = new GifEncoderTest(img,os);
ge.encode();
os.close();
catch(Exception e){}
if(GBFileProp.checkPrint)
try
GBFileProp.checkPrint = false;
RepaintManager.currentManager(this).setDoubleBufferingEnabled(false);
PrinterJob pj=PrinterJob.getPrinterJob();
pj.printDialog();
pj.print();
catch (Exception PrintException)
System.out.println("print error" + PrintException);
GBFileProp.checkPrint = false;
if(SetVisibleClass.isMerge)
GBFileProp.snpposition = 500;
GBFileProp.geneposition = 500;
GBFileProp.repeatposition = 500;
GBFileProp.userdefinedpoint = 500;
else
GBFileProp.snpposition = 450;
GBFileProp.geneposition = 400;
GBFileProp.repeatposition = 150;
GBFileProp.userdefinedpoint = 500;
if(GBFileProp.check)
try
if(SetVisibleClass.isSNP)
drawSNPPage(g);
catch(Exception e)
System.out.println("Error in snp plotting");
try
drawGenePage(g);
catch(Exception e)
System.out.println("Error in gene plotting");
try
if(SetVisibleClass.isGC)
drawGCPage(g);
catch(Exception e)
//System.out.println("Error in GC plotting");
try
drawUserDefinedPage(g);
catch(Exception e)
System.out.println("Error in User Defined plotting");
try
if(SetVisibleClass.isRepeat)
drawRepeatPage(g);
catch(Exception e)
System.out.println("Error in Repeat plotting");
//******************** For Painting all the graph**********************************//
//***************************** For Painting Gene**********************************//
public void drawGenePage(Graphics g1)
Graphics2D g = (Graphics2D)g1;
g1.setColor(Color.darkGray);
g.drawLine(0,650,(int)10000,650);
//g1.setColor(Color.b);
BasicStroke pen = new BasicStroke(3.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND);
g.setStroke(pen);
//****************************** X coordinate *************************************//
for(int i = 0; i < 10000; )
int xcor = (GBFileProp.defaultStartCoordinate + (int)(i*base));
String xCoordinate = "" + xcor;
g.drawLine((int)(i/10),645,(int)(i/10),655);
g.drawString(xCoordinate,(int)(i/10),665);
i = i + 1000; //+ (int)(1000/base);
//****************************** X coordinate *************************************//
if(SetVisibleClass.isGene)
g1.setColor(Color.darkGray);
g1.drawString("Gene:", 10, (GBFileProp.geneposition - 25));
g1.setColor(GBColorSymbol.cGene);
for (int i = 0; i < GBFileProp.genescore ; i++) // - 5 to b subtracted from genescore
int basestart = (int)((GBFileProp.readGeneStart[i] - (int)(GBFileProp.defaultStartCoordinate))/base); ///10;
int baseend = (int)((GBFileProp.readGeneEnd[i] - (int)(GBFileProp.defaultStartCoordinate))/base);
if(basestart >=0 && baseend <=(int)(10000))
checkGenePosition(i);
g.drawLine((int)((basestart/10)),GBFileProp.geneposition,(int)((baseend/10)),GBFileProp.geneposition);
arrow(true,true,i, g, basestart, baseend);
if(basestart >=0 && baseend > (int)(10000))
checkGenePosition(i);
g.drawLine(basestart/10,GBFileProp.geneposition,1000,GBFileProp.geneposition);
arrow(true,false,i, g, basestart, 10000);
if(basestart < 0 && baseend <= (int)(10000))
checkGenePosition(i);
g.drawLine(0,GBFileProp.geneposition,baseend/10,GBFileProp.geneposition);
arrow(false,true,i, g, 0, baseend);
if(basestart < 0 && baseend > (int)(10000))
checkGenePosition(i);
g.drawLine(0,GBFileProp.geneposition,1000,GBFileProp.geneposition);
//System.out.println("GeneSt: " + GBFileProp.readGeneStart[i] + " GeneEd: " + GBFileProp.readGeneEnd[i] + " No " + i + "GeneScore " + GBFileProp.genescore);
//*****************************End For Painting Gene**********************************//
//*****************************Start For Painting snp**********************************//
public void drawSNPPage(Graphics g1)
//System.out.println(GBFileProp.snpscore + "for snp");
Graphics2D g = (Graphics2D) g1;
BasicStroke pen = new BasicStroke();
g.setStroke(pen);
//g.setColor(Color.Red);
g.drawString("SNP", 20, GBFileProp.snpposition);
g.setColor(GBColorSymbol.cSnp);
for(int i = 0; i < GBFileProp.snpscore; i++)
int basePosition = (int)((GBFileProp.readSNPPosition[i] - GBFileProp.defaultStartCoordinate)/base);
//System.out.println(" position " + (basePosition/10));
//g.drawString("|",(basePosition/10),GBFileProp.snpposition);
g.drawString(GBColorSymbol.snpSymValues[GBColorSymbol.snpSym],(basePosition/10),GBFileProp.snpposition);
//Line SNP score
//System.out.println(GBFileProp.snplinescore);
for(int i = 0; i < GBFileProp.snplinescore-1; i++)
int basePosition = (int)((GBFileProp.readSNPStartPosition[i] - GBFileProp.defaultStartCoordinate)/base);
//g.drawString("|",(basePosition/10),GBFileProp.snpposition);
g.drawString(GBColorSymbol.snpSymValues[GBColorSymbol.snpSym],(basePosition/10),GBFileProp.snpposition);
for(int i = 0; i < GBFileProp.snplinescore-1; i++)
int basestart = (int)((GBFileProp.readSNPStartPosition[i] - (int)(GBFileProp.defaultStartCoordinate))/base); ///10;
int baseend = (int)((GBFileProp.readSNPEndPosition[i] - (int)(GBFileProp.defaultEndCoordinate))/base);
System.out.println(basestart + " " + baseend);
if(basestart >=0 && baseend <=(int)(10000))
g.drawLine((int)((basestart/10)),GBFileProp.snpposition,(int)((baseend/10)),GBFileProp.snpposition);
if(basestart >=0 && baseend >(int)(10000))
g.drawLine((int)((basestart/10)),GBFileProp.snpposition,(int)((1000)),GBFileProp.snpposition);
if(basestart < 0 && baseend <=(int)(10000))
g.drawLine((int)((0)),GBFileProp.snpposition,(int)((baseend/10)),GBFileProp.snpposition);
if(basestart < 0 && baseend > (int)(10000))
g.drawLine((int)((0)),GBFileProp.snpposition,(int)((1000)),GBFileProp.snpposition);
//*****************************Start For Painting GCPlotting**********************************//
public void drawGCPage(Graphics g1)
Graphics2D g = (Graphics2D) g1;
g1.setColor(Color.darkGray);
g.drawString("GC Percentage", 20, 20);
BasicStroke pen = new BasicStroke();
g.setStroke(pen);
g1.setColor(Color.black);
//System.out.println(GBFileProp.seqscore + " score");
for(int i = 0; i < (int)((10000)*base); )
//System.out.println(GBFileProp.defaultEndCoordinate + " " i" " + GBFileProp.defaultStartCoordinate);
//System.out.println(GBFileProp.gcposition);
int firstPosition = (int)GBFileProp.GCPercentage[(int)((((int)(i) + GBFileProp.defaultStartCoordinate)/GBFileProp.shiftsize))] * (3*100)/GBFileProp.gcmax;
int secondPosition = (int)GBFileProp.GCPercentage[(int)((((int)((i+GBFileProp.shiftsize)) + GBFileProp.defaultStartCoordinate)/GBFileProp.shiftsize))] * (3*100)/(GBFileProp.gcmax);
g.drawLine((int)((i/10)/base), GBFileProp.gcposition - firstPosition, (int)(((i+GBFileProp.shiftsize)/10)/base), GBFileProp.gcposition - secondPosition);
i = i + GBFileProp.shiftsize;
for(int i = 0; i < GBFileProp.seqscore -1; i++)
int firstPosition = (int)Integer.parseInt(GBFileProp.GCPoint.elementAt(i).toString()) * 3;
int secondPosition = (int)Integer.parseInt(GBFileProp.GCPoint.elementAt(i+50).toString()) * 3;
//int secondPosition = (int)GBFileProp.GCPercentage[i+50] * 3;
//g.drawString("|",basePosition,300);
g.drawLine((int)(i/10), 300 - firstPosition, (int)(i+50)/10, 300 - secondPosition);
i = i + 49;
//*****************************End For Painting GCPlotting**********************************//
//*****************************Start For Painting Repeat File**********************************//
public void drawRepeatPage(Graphics g1)
int check = 0;
Graphics2D g = (Graphics2D) g1;
g.setColor(Color.darkGray);
g.drawString("Repeat", 10, 480);
for (int i = 0; i < GBFileProp.repeatscore ; i++)//- 1 to b subtracted from repeatscore
int basestart = (int)((GBFileProp.startRepeatPosition[i] - (int)(GBFileProp.defaultStartCoordinate))/base); ///10;
int baseend = (int)((GBFileProp.startRepeatPosition[i] - (int)(GBFileProp.defaultStartCoordinate))/base);
if(basestart > 0 && basestart < 10000)
try
if(GBFileProp.repeatFamily.equals("LINE"))
System.out.println(" Line" );
GBFileProp.repeatposition = 575;
repeatSymbol = GBColorSymbol.repeatSymValues[GBColorSymbol.lineSym];
if(GBFileProp.repeatName[i].length() >= 2)
if(GBFileProp.repeatName[i].substring(0,2).equals("L1"))
g.setColor(GBColorSymbol.cL1);
g.drawString(repeatSymbol, (int)(basestart/10), GBFileProp.repeatposition);
else if(GBFileProp.repeatName[i].substring(0,2).equals("L2"))
g.setColor(GBColorSymbol.cL2);
g.drawString(repeatSymbol, (int)(basestart/10), GBFileProp.repeatposition);
else if(GBFileProp.repeatName[i].substring(0,2).equals("L3"))
g.setColor(GBColorSymbol.cL3);
g.drawString(repeatSymbol, (int)(basestart/10), GBFileProp.repeatposition);
Maybe you are looking for
-
Error when trying to create tables using "asant create-db_common"
Hi, I'm attempting to run asant create-db_common to use a .sql file to create a table in Pointbase. However I keep getting this error: Buildfile: build.xml init: create-db_common: [java] java.lang.NoClassDefFoundError: com/pointbase/tools/toolsC
-
Upgrade 1st Generation iPod Touch 32GB
Can I download ios5 to my 1st gen ipod touch or can i upgrade my software version 3.1.3 to 4.0 or 3.2?
-
Questions about Braille & keyboard
I am thinking of buying a new Macbook. I have two questions 1. If you have a word processing going and you hold down the sdfjkl keys at the same time do you get all six letter printed in different order/same order or do you get different amounts of l
-
How to roll back to Acrobat Standard XI from Acrobat Standard DC Cloud
Hi, How do we roll back/install Acrobat Standard XI from Acrobat Standard DC using the cloud? as we need to use Acrobat Standard XI? Thanks, Mike
-
Hello. I'm trying to write the following String containing an XML document, in a MySql database: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ReporteHoras SYSTEM "ReporteHoras.dtd"> <ReporteHoras> <Persona nombre="Daniel"> <Fecha dia="1/11/2004"