Re: forms6i built-in package TEXT_IO on forms server
Date: 10 Dec 2002 07:22:17 -0800
Message-ID: <c5df9e15.0212100722.e6cd785_at_posting.google.com>
<rx_at_wo.cz> wrote in message news:<at2vt0$vnlgt$1_at_ID-123390.news.dfncis.de>...
> When I use my forms on clients side I can save and write file on my client
> directory.
>
> But I don't know how can I use TEXT_IO for save some file on my client side
> when I run my forms as java applet from forms server on client browser.
>
> Or some another ways?
When running Forms as Java-applet TEXT_IO just writes on Application-Server, but not on client-machine. If you like to write to client you should use a Pluggable Java Component.
- CUT HERE
import oracle.forms.ui.*; import oracle.forms.properties.ID; import oracle.ewt.lwAWT.lwText.*;
import java.awt.*;
import java.io.*;
public class TextPJC extends VTextArea {
private static final ID READFILE =
ID.registerProperty("readfile");
private static final ID WRITEFILE = ID.registerProperty("writefile");
private String filename=null;
public TextPJC() { super(); } public boolean setProperty(ID pid, Object value) { if(pid ==READFILE) { try { File inputFile = new File((String)value); FileReader in = new FileReader(inputFile); char c[] = new char[(int)inputFile.length()]; char c1[]= new char[(int)inputFile.length()]; in.read(c); int j=0; for (int i=0;i<inputFile.length();i++) {if((int)c[i]==13); else c1[j++]=c[i]; } String str = String.copyValueOf(c1,0,j); ((LWTextArea)getContent()).setText(str); in.close(); } catch(Exception e){System.out.println("Error in PJC " ); e.printStackTrace();} return true; } else if(pid==WRITEFILE) { try { File inputFile = new File((String)value); FileWriter in = new FileWriter(inputFile); LWTextArea lw = (LWTextArea)(this.getContent()); String text1 = lw.getText(); int length1 = text1.length(); char c[] = new char[(int)length1]; char c1[]= new char[(int)length1*2]; text1.getChars(0,length1,c,0); int j=0; String s1= System.getPropert("line.separator"); for(int i=0;i<length1;i++) { if ((int)c[i]==10) { s1.getChars(0,s1.length(),c1,j); j=j+s1.length(); } else c1[j++]=c[i]; } in.write(c1,0,j); in.flush(); in.close(); } catch(Exception e) {System.out.println("Error " ); e.printStackTrace();} return true; } else return super.setProperty(pid,value); }
}
- CUT HERE ---------------------------
Sorry for bad format, I've copied from Metalink. I hope it will help you a little bit.
Bye,
Crypti
Received on Tue Dec 10 2002 - 16:22:17 CET