Jay Damon

Ranch Hand
+ Follow
since Jul 31, 2001
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jay Damon

I recently discovered while testing that, when an SWT Shell is maximized, e.g. via setMaximize, the new location reported always appears to be off the display, e.g. the Point object returned will be something like Point {-5,-5}. This is true regardless of whether the location is retrieved via getLocation or getBounds. How far off the screen the location is seems to be dependent upon the screen resolution. I have seen values from Point {-4,-4} to Point {-13,-13}.

I would have expected the location (after maximize) to always be Point {0,0}. Why is it not?

I have tested this with different machines, different versions of Windows (7 & 8), and different versions of SWT. All seem to behave this way.

Can anyone offer an explanation?

8 years ago
I think I have found the problem. After performing additional testing, this appears to be a "No more handles" issue although that was NOT the exception message I received initially. Apparently SWT imposes a hard limit that only allows SWT widgets to be nested up to 50 deep. Adding an additional widget, regardless of type, triggers a "No more handles" exception.
8 years ago
I recently encountered a scenario where attempting to set the text for an SWT TableColumn widget fails with an InvocationTargetException / SWTError and the message "Cannot set text". There is nothing special about the column text, i.e. no special characters or mnemonics. It just fails. The same code works for other scenarios.

I took a look at the SWT source for the TableColumn class and found only one place where the "Cannot set text" error is thrown - see code fragment below - but I cannot see why I should have encountered a problem.

Any suggestions as to what the problem may be would be appreciated. Thanks!

8 years ago
After some additional testing, if appears that setting both "exclude" plus "setVisible" is like setting the CSS "display" attribute for an element whereas setting "setVisible" ONLY is like setting the CSS "visibility" attribute. Can anyone confirm this?
9 years ago
Apparently setting "exclude" for GridData or RowData is not enough. If I also invoke the button's setVisible method with the correct parameter (as shown in the code snippet below), showing/hiding buttons in the button area works as I would expect it to.

Would someone care to explain the difference between setting "exclude" and invoking setVisible and why you have to do both?
9 years ago

I am working on an SWT application in which I would like to allow users to customize to show only selected application buttons. I have created a Composite object (the "button area") and set a RowLayout as follows:

The "button area" contains 4 buttons, each with a unique RowData object as follows:

Everything works fine until I attempt to show or hide a button. I attempt to do so by setting the rowData.exclude flag and invoking layout on the parent button area object. A button is always shown or hidden but the button shown or hidden is not necessarily the correct one. I have noticed that if I hide the buttons IN ORDER from left to right, e.g. button 1, button 2, button 3, button 4, the buttons are hidden correctly. Conversely, if I show the buttons in order from right to left, e.g. button 4, button 3, button 2, button 1, the buttons are shown correctly.

However, If I attempt to hide a button that is not the leftmost button shown, I observe unpredictable results. For example, if I attempt to hide button 4, button 2 may be hidden even though the application status message clearly states button 4 has been hidden. Similar results are observed when attempt to show a button that is not the rightmost one not shown.

I have tried working with GridLayout and GridData but have observed similar results. I have debugged thru the code and I am certain the correct button exclude flag is being set prior to layout being invoked. I am also certain unique RowData objects are being created for each button. The SWT button object references cannot change because they are declared final.

Am I attempting to do this incorrectly? Any suggestions would be appreciated!

9 years ago

I am trying my hand at creating some custom widgets in SWT. One of my custom widgets wraps a Composite widget. If, when creating a child of the custom widget, e.g. Button, Text, etc., the child is created as child of the custom widget. I would like all child widgets to created as children of the wrapped Composite widget. In other words, no child widget should be created as a child of the custom widget; all child widgets may only be children of the Composite widget. The custom widget works fine in all other respects. As a workaround I have created a method named getWidget which I invoke to get a reference to the proper parent object when creating a Button, Text, etc. I would like to be able pass a reference to the custom widget directly to the constructors of Button, Text, etc. just like any other widget but I do not see how this might be done. Note that my custom widget does subclass Composite. Is this possible? Any suggestions would be appreciated. Thanks!
9 years ago
I am attempting to adapt the code from a web application (I wrote) to an existing SWT application. In a nutshell, the code contains a long running process that runs in the background (using Concurrency classes) on the server. The web application dialog allows the user to cancel the process (at any time) or even close the dialog and re-open the dialog later to check on the status.

FYI, the job executes a number of tasks but the number of tasks and the time to execute each task is unknown until runtime.

I created (what I thought was) similar code in the SWT application using asyncExec. Basically, the code checks the job status and, if it is not complete, the thread sleeps for 1 second. The job continues to check (and sleep) until the job status is complete. Before it sleeps, the job updates the user dialog progress bar as well as an information line with the current status – this works just fine.

The problem is that the SWT application is non-responsive to button clicks while the background job is running. For example, if I run the job using asyncExec, I see output similar to the following:

Entered checkProgress
Exited checkProgress
Executing task 1 of 10 . . .
Executing task 2 of 10 . . .
Executing task 3 of 10 . . .
Executing task 4 of 10 . . .
Executing task 5 of 10 . . .
Executing task 6 of 10 . . .
Executing task 7 of 10 . . .
Executing task 8 of 10 . . .
Executing task 9 of 10 . . .
Executing task 10 of 10 . . .
Batch job complete
Cancel button pressed (via (JFace) Dialog.buttonPressed)
Cancel button pressed (via SelectionListener)
Close button pressed (via (JFace) Dialog.buttonPressed)
Close button pressed (via SelectionListener)

The SWT application enters and exits the method checkProgress immediately (as one would expect). The “Cancel” and “Close” buttons are clicked immediately after submitting the job but, as you will note above, SWT does NOT respond to those events until after the batch job completes.

FYI, I have also attempted running the batch job using syncExec and inline. SWT is always non-responsive while the batch job is running.

I thought perhaps the problem might be with JFace as the extends the Dialog class but, as you will note above, both the JFace Dialog.buttonPress(int) method AND the selection listener (added later) are called.

The existing SWT application is actually an old Java Web Start application that talks to a web server. I though perhaps that may be the problem. However, I duplicated the user interface in its own class with a simulated batch job. SWT is still non-responsive to button clicks.

Although I am a web application developer, I have a fair knowledge of SWT and JFace. However, I fail to understand why SWT is non-responsive. FYI, my development machine is running Windows 7 and 64-bit SWT (swt-win32-windows-x86_64.jar).

Any suggestions as to why SWT is non-response or how to correct the problem would be appreciated.

9 years ago
Thanks Bear! That's exactly what I needed to do.
I have some code similar to the following. There is an onclick handler on a div element which contains an embedded anchor element. Clicking on the anchor element always seems to invoke the the div onclick handler. The desired action is to have the browser open the default email editor and return with div element onclick event invoked when a user clicks anywhere inside the div element EXCEPT for the anchor link. Is this possible? The application uses jQuery so I have access to that functionality if jQuery contains some way to achieve the desired action.

Are you saying the page cannot be rendered in Firefox or Chrome? Even if your app is for IE8, it does not have to render perfectly in order for Firefox or Chrome to tell you what you need to know - which is how the styles are applied to the page. If you are not currently using Chrome or Firefox with Firebug, you seriously need to think about doing so. Using these browsers' developer tools will save you a ton of time (and aggravation)
I recommend you look at the rendered page using Google Chrome or Firefox with Firebug installed. Both will readily show you how styles are applied to an element and you will be able to determine why your style is not.
This may be a question for the IDE forum but I thought I would post here first.

Ever since I upgraded to the Eclipse 3.7 IDE the JavaScript editor has begun showing a number of "Type mismatch" warnings in the Problems view. The following code example always seems to issue an "Type mismatch" warning on the line noted. However, I think the line where the warning is issued is is a legal assignment. Is it legal or not? Unfortunately the JavaScript editor does not seem to be consistent in the warning messages it issues. I get sporadic "Type mismatch" warning messages like:

"cannot convert from null to Boolean"
"cannot convert from HTMLElement to __element<number>"
"cannot convert from __anonymous<number to __anonymous><number>" (Note: The numbers always seem to be identical so this make absolutely no sense to me)
"cannot convert from String to __value<number>"

I thought JavaScript was a weakly typed language and that one could basically assign any value to any variable? I know I can suppress these warnings in the Eclipse IDE Preferences but, before I do so, I would like to understand why these warnings are being issued. Note that the code that these warnings flag works fine in all browsers. I would appreciate any comments or suggestions.

I recently configured an AWS EC2 server instance running Apache Tomcat 6.0.16. No other browser seems to complain but Google Chrome returns the following warning when clicking on the SSL/lock icon.

The connection had to be retried with SSL 3.0. This typically means the server is using very old software and may have other security issues.

Does this message indicate that Tomcat needs to be upgraded? Or am I missing some configuration option?

Additionally, Chrome and Opera return the warning:

The server does not support the TLS renegotiation extension.

I have noticed that many secure sites, amazon.com, for example, also have this warning when viewed in Chrome and Opera. Is this warning anything to be overly concerned about?

Thanks in advance!
11 years ago
This is strictly a Tomcat issue. The behavior is caused by mapping all URIs to the Filter. When specific URIs are mapped to the Filter, Tomcat does not exhibit the behavior. The only thing my code does is map all URIs to the Filter. In my opinion, Tomcat should be able to handle that scenario.
12 years ago