Michel Legris

Greenhorn
+ Follow
since Feb 21, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michel Legris

Its a very particular use.... i'm creating an automated testing tool...In my application the user can override the title of the window like "Notepad - {*}" or "Modify Client #{*} - {*} blablabla" This way the user can adapt the control recognition by text for their needs. Plain java solution cannot be used and it's the only part I need to use regular expression.

BTW I'm not a newbee in regular expression, I already work 10 years in perl mostly to do things based on regular expression. But this was a long time ago and forgot almost everything since that time.

Good new is that everything works perfectly now!
10 years ago
Thanks again Henry for the precision.

>How do you expect the regex engine to magically know which ones are supposed to be interpreted and which ones are suppsed to be ignored?

This is the the only thing needed to make me realise my mistake in my previous attempts to use quote(). This really make sense but it never come into my mind to split the expression in 3 parts to apply quote only on the non regular expression part.
10 years ago
It finally works!!!

I have already tried Pattern.quote but the problem was the quote was done to the entire expression ....duh...(make no sense)

The solution is :
String expression=Pattern.quote(FirstPart)+".*" +Pattern.quote(SecondPart);

The first and the second part was done by splitting on our homebrew wildcard {*} and by substring each part to extract the text before and after the wildcards.

So Pattern.quote() was what i was looking for!

A big big thanks to Henry Wong
10 years ago
heu...

The main problem is dealing with reserved regex word in my search expression. Is escaping all possibles "special" characters is the only option? There are tons of thoses characters and this approach make no sense. The string is also provided by the user in my applciation and can be anything (abc , def and xxxx can be anything)

So nobody can explain how this could be done? I have already spent several hours trying diffrent things and analyzing the doc. Nobody know what the expression should be or how to manipulate the string in order to prevent problem with special characters or how to make my 3 examples working?
10 years ago
1-
String Str= "abc xxxx def";
String Rgx="abc .*? def";
System.out.println("Result="+Str.matches(Rgx));
--> This return true...this is exactly what I want but it's NOT woking all the time

2-
String Str= "[abc] xxxx def"; //the original string contain [ ]
String Rgx="[abc] .*? def";
System.out.println("Result="+Str.matches(Rgx));
--> *** THIS RETURN FALSE INSTEAD OF TRUE AS EXPECPED ***

3-
String Str= "{abc xxxx def"; //the original string contain a { character
String Rgx="{abc .*? def";
System.out.println("Result="+Str.matches(Rgx));
--> *** THIS RETURN AN EXCEPTION *** : java.util.regex.PatternSyntaxException: Illegal repetition

I need to find a way to put some Wildcard inside a string and getting correct result without having incorrect result or exception.
(The string can be **anything**, the expression to search is the same but with some part(s) replaced with on or MORE wildcards like in my example)
Is anybody know the proper way to do this kind of text search with regular expression???

HELP!!!
10 years ago
The real term in swing is more Look and feel component.

By skin I mean any child components ONLY used for skinning and available with Container.GetComponent(). There are "skin components" for all possible components (e.g: JScrollBar, JScrollPane, JComboBox,JSlider, ...)

theses skin can be one of the standards look and feel (metal, Nimbus, ..) or any 1000 other possibles look and feel downloaded from the internet.

How can I distinguish a ScrollBarButton from a JButton since the scrollBarButton inherits from JButton
10 years ago
I'm working on a kind of swing explorer (spy++ for java)

Container container = (Container) jScrollBar1; //previously created
for (int i = 0; i < container.getComponentCount(); i++)
{
JOptionPane.showMessageDialog(null, container.getComponent(i).getClass().getName());
}

The previous code show two childs for a JScrollBar... the children are com.sun.java.swing.plaf.*.*ScrollBarButton (the two buttons of the scrollbar)

My goal is to detect skin component when doing Getcomponent in order to ignore them.

Maybe you can answer to one of these questions :
1- Is there any what to tell that this Specific component (ex: container.getComponent(1)) is a **SKIN** component?
2- Is there any equivalent to javafx GetSkin() to return all the skinning part of a "control" ???
3- Is there any relation between JScrollBar1.GetUI() and the skin components returned as children of the scrollbar ?
4- Is ther any alternative to GetComponent()....a kind of GetComponentWithoutInternalSkin() who return only the highlevel control without all the skin ?

I really need help...thanks!
10 years ago
I already post this question on another forum...but again nobody know anything about this...

Is there any API method to get the control(s)/nodes(s) from mouse screen coordinates ?

Thanks
10 years ago
The same method used by the jemmy project from http://java.net/projects/jemmy

Just check how they manage to get access to the top level ROOT element in their AgentMain() implementation.
10 years ago
It work!!! thanks for trying to help
10 years ago
Is it possible to use a classTransformer in my agent and somehow get access to the Stage object? It it possible to "hook" the start method with ASM bytecode manupulation in order to get the top level UI element? Is this make any sense?

Thanks...
10 years ago
Exactly!!

for swing/AWT i'm simply using an agent with window.GetWindows(), then loop though child components.

In JavaFX there is no way to access the root stage (from my agent or external class)
10 years ago
Yes I DONT have any acces to the javaFX application

I'm using an agent to inject my code into the JavaFX application (not my application, code cannot be modified so start method is unavailable)

It's not for performance monitoring, Im working on a kind of spy++/snoop for java so i need to get the UI structure, component size and position to "highlight" them from another process (My agent) I also need to get component properties

For doing all this I need a top level object to parse the entire UI structure and get what I want...

The javafx applications cannot be modified since they are not my own application (any javafx application)
10 years ago
There is no start method in an Agent class...

There is no way to create or use a static variable or modify the application since it's NOT my own application (the one with the start() method) and it's only at run-time (no code can be modified in the application)

I'm using an agent because "injecting" some code in the application process...The problem is that in a JavaFX context you CANT talk with the UI at all because you dont have an access to the stage object
10 years ago
I'm still trying to figure out how to use my agent in a javafx context in order to get a reference to the UI....

I just need to get access to the root top level UI element of the application...Nobody can help on this?
10 years ago