0

How to avoid "Not Unique in ID space" error when button is clicked twice

asked 2009-09-08 21:21:20 +0800

wooyi gravatar image wooyi
6

Sometimes users click on a button more than once (either accidentally or they like double clicking), and I get the "Not Unique in ID space" error. Worse is that the window is partially embedded on the parent page, half created and a refresh is needed to get rid of it. This really kills the user experience in my app.

I use the window ID for data binding, so the ID is hard coded in the ZUL file. There are a lot of posts about dynamically generating the ID, but I don't know how that would work with data binding annotations. Please let me know if you do.

Or should I just use the event handler to manually keep track of any open windows and ignore subsequent clicks if a window is already opened?

Suggestions welcome. Thank you. ZK rocks!

Code fragments:

Most of my sub windows (overalapped) are created like this:

Window winEdit = (Window) Executions.createComponents(
"/plan/list_open.zul",
null,
params);
winEdit.doOverlapped();

In the ZUL file, the id is hardcoded, and I also use the id for databindings.

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="openList"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window title="View Patient List" id="openList" border="normal"
use="org.carepathfoundation.ui.plan.ListOpenViewController"
contentStyle="overflow:auto" height="600px">

<!-- Plan panel -->
<panel title="List Details" collapsible="true">
<!-- Toolbar -->
<toolbar id="listOpenToolBar">
<toolbarbutton id="listEditBtn" image="/img/edit.png" label="Edit Registry" />
<space />
<toolbarbutton id="planOpenBtn" image="/img/open.png" label="Open Plan" />
<space />
<toolbarbutton id="planEditBtn" image="/img/edit.png" label="Edit Plan" />
</toolbar>
<panelchildren>
<grid id="plan">
<columns>
<column width="200px"/>
<column />
</columns>
<rows>
<row>
Title
<label value="@{openList.list.title}" width="500px"/>
</row>
<row>
Description
<label value="@{openList.list.description}" width="500px"/>
</row>
<row>
Date Modified
<label value="@{openList.list.modifiedDate}" width="500px"/>
</row>
<row>
Rules
<listbox id="listRulesBox" model="@{openList.listRulesModel}">
<listitem self="@{each=rule}">
<listcell><label value="@{rule.title}"/></listcell>
</listitem>
</listbox>
</row>

....etc

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2009-09-09 05:45:28 +0800

jj gravatar image jj
638 3

Maybe you can check to see if the component already exists (using Path) before you create the component?

link publish delete flag offensive edit

answered 2009-09-09 06:11:18 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

Your issue arise, when you create the same window more than once. Hence, try to avoid creating a window multiple times.

You can create the window once and make use of setVisible method to hide or show it at later time. Otherwise close the opened window, before creating it again.

link publish delete flag offensive edit

answered 2009-09-09 15:24:59 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

what happens if you change

<label value="@{openList.list.title}" width="500px"/>

to:

<label value="@{self.root.list.title}" width="500px"/>

I haven't tried it myself; perhaps that will cause a lookup of the window and invoke getList() on your use="..." class...can't remember off the top if the window or the page will be returned by ...self.root...

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-09-08 21:21:20 +0800

Seen: 402 times

Last updated: Sep 09 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More