Hi Holger,
We finally found the issue. The trigger for this issue is that hiding a
window in ULC 6.0 always means to dispose it. Disposing a window might
trigger some special actions in the underlying operation system. In case
of Windows it generates some additional mouse events which in your case
results in a new (and unexpected) table selection. I have opened the
issue UBA-7060 "ULC disposes windows instead of just hiding them" in
Jira for this issue. You can find a workaround for this issue at the end
of my mail.
Please note that ULC 6.1.1 is not affected because of UBA-6799 "Provide
ULCWindow.dispose() API".
Regards Dany
import com.ulcjava.base.application.AbstractAction;
import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCBoxPane;
import com.ulcjava.base.application.ULCButton;
import com.ulcjava.base.application.ULCComponent;
import com.ulcjava.base.application.ULCDialog;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCScrollPane;
import com.ulcjava.base.application.ULCTable;
import com.ulcjava.base.application.ULCWindow;
import com.ulcjava.base.application.UlcUtilities;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.event.IActionListener;
import com.ulcjava.base.application.table.AbstractTableModel;
import com.ulcjava.base.client.UIDialog;
import com.ulcjava.base.development.DevelopmentRunner;
public class PR7060 extends AbstractApplication {
public void start() {
ULCTable table = new ULCTable(new SnippetTableModel());
table.setName("frame table");
ULCBoxPane content = new ULCBoxPane(1, 0);
content.add(ULCBoxPane.BOX_EXPAND_EXPAND, new ULCScrollPane(table));
content.add(new ULCButton(new OpenDialogAction()));
ULCFrame frame = new ULCFrame("Snippet");
frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
frame.getContentPane().add(content);
frame.setVisible(true);
}
public static class OpenDialogAction extends AbstractAction {
public OpenDialogAction() {
putValue(NAME, "Open Dialog");
}
public void actionPerformed(ActionEvent event) {
ULCTable table = new ULCTable(new SnippetTableModel());
table.setName("dialog table");
table.addActionListener(new CloseWindowAction());
ULCWindow owner =
UlcUtilities.getWindowAncestor((ULCComponent) event.getSource());
ULCSnippetDialog dialog = new ULCSnippetDialog((ULCFrame)
owner);
dialog.getContentPane().add(new ULCScrollPane(table));
dialog.setVisible(true);
}
}
public static class CloseWindowAction implements IActionListener {
public void actionPerformed(ActionEvent event) {
ULCWindow window =
UlcUtilities.getWindowAncestor((ULCComponent) event.getSource());
window.setVisible(false);
}
}
public static class SnippetTableModel extends AbstractTableModel {
public int getColumnCount() {
return 1;
}
public int getRowCount() {
return 20;
}
public Object getValueAt(int row, int column) {
return row + ":" + column;
}
}
public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(PR7060.class);
DevelopmentRunner.run();
}
public static class ULCSnippetDialog extends ULCDialog {
public ULCSnippetDialog(ULCFrame frame) {
super(frame);
}
protected String typeString() {
return UISnippetDialog.class.getName();
}
}
public static class UISnippetDialog extends UIDialog {
protected void hide() {
// just hide instead of dispose!
// getBasicWindow().dispose();
getBasicWindow().setVisible(false);
}
}
}
Zywietz, Holger wrote:
Hi Sibylle,
I've attached a little example to reproduce my problem.
I'm using following versions:
ULC Version: 6.0.4
Java Version 1.4.2_11
Thanks
Holger
------------------------------------------------------------------------
*Von:* [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] *Im Auftrag von *Sibylle
Peter
*Gesendet:* Montag, 18. September 2006 16:18
*An:* [email protected]
*Betreff:* RE: [ULC-developer] ActionEvent appears on Dialog and Frame
Hi Holger
to investigate your issue it would be great if you can send us the
code snippet together with the version information of ULC and JRE.
Best regards
Sibylle
-----Original Message-----
*From:* [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
*Zywietz, Holger
*Sent:* Freitag, 15. September 2006 14:38
*To:* [email protected]
*Subject:* [ULC-developer] ActionEvent appears on Dialog and Frame
Hi all,
I have a ULCDialog containing a none editable ULCTable. When a
cell is doubleclicked, the ActionListener of the Table sets the
dialog to visible(false).
Now the strange behaviour:
Is the Dialog laying upon a ULCFrame containing a ULCTable, the
Table of the Frame is selected too.
Does anybody know why the ActionEvent appears on the ULCFrame, too?
Thanks and regards
Holger
before:
after doublieclicking:
Würth Phoenix GmbH
Holger Zywietz
ITConsultant Business Integration
Drillberg 6 / Geb. 2
97980 Bad Mergentheim
Direct: +49 07931 91 6278
E-Mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
Website: www.wuerth-phoenix.com <http://www.wuerth-phoenix.com/>
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer