Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Looking for Tree Widget API samples (Apex 19.2)

John like many othersOct 21 2020 — edited Oct 21 2020

Hello
Before I put my questions I would like to make something clear to others not to pull out some hairs or wasting hours to find the cause:.
If you use a generated Apex tree (widget) and you want to access it by API you will get some confusing error messages and there is no help in the API itself telling you why. The way to access a generated tree is :
On Tree region level add an ID in 'Static ID' (f.e.: HIERARCHYTREE)
Access the Tree widget in Javascript by $('HIERARCHYTREE**_tree**')
The API documentation (I'm not allowed to link it here) is even misleading using the class identificator (dot notation) in the samples. So don't get confused about that.
Questions:
I would like to add and delete nodes in the generated tree. The API documentation does not provide ANY samples how to add or delete a node. I even searched here (spyglass on top) for "tree" but no result. So if you know any source on the Internet or a book providing examples I would be thankful..
I would like to react in the background if the user clicks on any treeview entry (node, child). The API doesn't support simple click events. How can I (simply) add a one-click event on any entry of the tree?
To add a node I guess I have to use the "addNode" option described in the API. It's already unclear how to get to those parameter: addNode(pParent, pIndex, pLabel_opt_, pContext_opt_, pCallback) -> f.e. HOW can I get the PARENT node into which I would like to add a child? There is function to get children but no function to get the parent of f.e. the selectedNode. pIndex: Why the heck do I have first to evaluate the amount of children of the node I would like to add another node(child) in order to get the amount of children and therefore add it at the end? As I'm using the default generated tree how can I pass the ID provided by that defaultNode?
I think with some simple code samples the questions of topic 3 will resolve themselves. So if you know any source where to find simple examples to add and/or delete nodes by API be would great.

Comments

802908
Hi

concerning the parallel port i found the following link

http://www.supportnet.de/listthread/172182

concerning other connections: do you have the possibility of using a serial (RS232) communication?

friendly greetings

BB
807580
That link was not in english, but even the google-translated version was not of much help. I already know about the comm API and how it works. Unfortunately I do not have the option of using a serial port. The device that is sending the data is a Jet Direct and only has parallel output.
Melssj5
Well, the comm API has all you need.

With the comm api you can read and send through paralel port and you can also use the comm api to get and send data through USB. Sending it just to the com port in which the usb is!
802908
I just thought the link might be useful because i had the impression that the posted code was also intended for reading data from a parallel port.
Not just for writing. Am i mistaken there?!
807580
I haven't read anywhere that the comm api can be adapted for usb communication. Is this really the case?

You should be able to read data from a parallel port, but Java has problems with XP, and since it discontinued support for windows, the issue has not been fixed.
Melssj5
of course, USB is just a serial comunication. Universal Serial Bus, you just have to send the data to the specified COM port of the usb and thats all. I dont know about any problems about java and XP!
807580
The problem with XP i was talking about is only with the comm 2.0 api... see this link

Can you give me any sort of example of how i can capture USB communication via a COM port? When i list all available com ports, i dont see any "extra" for USB, so which one would i grab?
802908
Hi

i once had a device (a flowmeter for measuring the gas flow) which was connected via USB to the PC, but this USB port has also been mapped to a COM port. In this case i could control the device via COM port. But i dont know whether this is generally like that.

Other devices which i know and which are connected via USB dont have this mapping to COM. These have their own USB drivers (but these are not written in Java as far as i know).

I guess it depends on the device, but im no expert in these issues...

regards

BB
807580
Other devices which i know and which are connected via USB dont have this mapping to COM. These have their own USB drivers (but these are not written in Java as far as i know).
The USB->COM mapping happens when device implements CDC (CommunicationDeviceClass) USB class. Both Linux and XP do have built-in driver for them which maps it to COM port. As far as I know this is the easiest (and possibly - only not involving writing windows driver or installing dedicated semi-universal driver like winusb.sys ) way to talk to USB device.

For accesing COM port you will need rxtx.org gnu.io.comm java library since javax.comm api for Windows was abadoned by Sun.

The main trouble with CDC is : "how to explain user which damn com port he/she should select when connecting to you fabulous USB device".

regards,
Tomasz Sztejka
807580
Hi,

Im trying to connect 2 computers using USB or Parallell port. On one computer I want to install a printer (regular windows printer) that prints through either USB or the Parallell port. On the other computer I want to listen on the Parallell port/USB port and receive the input and write it to a file.

Does anyone have a some sample code to do this? I've tried the following code (rxtx) but it cant find more than 2 ports (one parallel and one serial - no USBs even though I have 5 USB ports). Since I could only find the USB I tried to listen on the Parallell port. Problem is that I dont receive any data.

<---THE CODE--->

Enumeration port_list = gnu.io.CommPortIdentifier.getPortIdentifiers();
while (port_list.hasMoreElements ()) {
CommPortIdentifier port_id = (CommPortIdentifier)port_list.nextElement ();

if(port_id.getPortType () == CommPortIdentifier.PORT_PARALLEL) {
System.out.println("Found port "+port_id.getName()+ "id "+port_id);
CommPort commPort = port_id.open("",2000);

InputStream is = commPort.getInputStream();

byte buffert[]=new byte[1024];
int len;
System.out.println(">>>>>>>>len "+is.read(buffert));
while((len=is.read(buffert))==-1)
{
Thread.sleep(500);
is = commPort.getInputStream();
System.out.println(">>>>>>>>len "+len);
}

}
}
807580
USB java API for Windows:

http://javausbapi.blogspot.com/
and
https://sourceforge.net/projects/javausbapiforwi/
dcminter
Locking zombie thread.
1 - 12

Post Details

Added on Oct 21 2020
6 comments
1,620 views