• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Weird but true

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I might sound greedy.But this is what i am looking for.
I have a Struts based web application.The Home page has a list of links say asset1,asset2,asset3 and so on.On click of each link a new window/tab opens for edit.What i want is prevent the user from opening the same asset again and again by showing a message or shifting the focus to already opened asset.Of course the window reference returned by window.open can be used to check if the window is open.But i have so many links in my home page its difficult to track each and every window reference.Also i will lose them if the user refreshes the home page.To make things worse the newly opened window also has asset links.Lets say the user opened asset1 and asset2 from the homepage.They are opened now in two separate windows.Now our fella goes to asset1 window and clicks on asset2 link resulting in a new asset2 window which i should be able to prevent by a message or focusing the already opened asset2 window.The only handle i have is the window name.I tried naming my windows after the asset.So that when the user clicks on an asset i generate the window name and see if a window with that name already exists.But this is not working.Its not possible to check for the existence of a window by window name.So guys please help me out.I tried everything.Please let me know if there is any way or any window management utilities to implement this.I will appreciate it.

Thanks in Advance
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keeping track of what's what sounds like control better handled on the server in the session.
 
Shawn Williams
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Man that was quick.....i know this place is good ...... but now i know its too good.....
So there is no way we can handle this from Java script you say.......how exactly can i handle it from server.......i mean its not a single request -response session...... the user can open n number of assets from n number of windows...... it will be too messy to flag every opened window.......this thing is driving me nuts
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Changing the approach of representation will work for the scenario.It seems that you want to implement this functionality using javascript.
A Multi-Tab view on a single page will work fine where clicking on the link will open a new Tab for that particular asset (use Ajax to fetch data from that particular page).
While using this approach, you can easily keep track of Tabs (which in turn represents an asset) and focus the Tab related to an asset if it is already open and user make attempt to click the link again.
Generating Multi-Tabs using javascript can be easily found on www (although, dynamic generation of tabs need to be worked on)

Hope this will help.

Regards,
Arpit Purohit
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear, I am not sure how the serverside session would know if a window is already open or not.



call from self

call from another pop up


Eric

 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also you title does nothing for your thread. Please read http://faq.javaranch.com/java/UseAMeaningfulSubjectLine

Eric
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps I'm missing the point, but open windows seem a side effect of visited "assets" rather than a main focus. If visited assets need to be tracked, seems to me that it'd be easier in the session rather than on the client.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Perhaps I'm missing the point, but open windows seem a side effect of visited "assets" rather than a main focus. If visited assets need to be tracked, seems to me that it'd be easier in the session rather than on the client.



Sounds like he does not want to open up another pop up window if one is open. Has nothing to do with not letting them go to the page after they went there once.

The lack of use of the enter key in the original post makes it hard to read!

Eric
 
Shawn Williams
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Arpit Purohit wrote:Changing the approach of representation will work for the scenario.It seems that you want to implement this functionality using javascript.
A Multi-Tab view on a single page will work fine where clicking on the link will open a new Tab for that particular asset (use Ajax to fetch data from that particular page).
While using this approach, you can easily keep track of Tabs (which in turn represents an asset) and focus the Tab related to an asset if it is already open and user make attempt to click the link again.
Generating Multi-Tabs using javascript can be easily found on www (although, dynamic generation of tabs need to be worked on)

Hope this will help.

Regards,
Arpit Purohit



We have already so many tabs in the page.So we cant use a tabbed approach.

Eric : That looks like a good way to tackle this problem.But it fails when the user refreshes the home page.Also the winPop is available only to the homepage.

And sorry about my senseless title and lack of line breaks.

"Sounds like he does not want to open up another pop up window if one is open. Has nothing to do with not letting them go to the page after they went there once. " - Exactly.Or let me put it this way.I don't want to open another window if its the same asset.
The same check needs to be performed in already opened asset windows as well if the user tries to click a link from the asset window.

 
Shawn Williams
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I couldn't find any java script library also that can provide me with window management facilities.The focus functionality is something which is not supported by the modern browsers due to security reasons.Especially in tabbed browsers.So that can be put as browser limitation.

Only if i could find a way to get the reference to the opened windows.More than enough for me.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can only code to a certain extent and than you have to say oh well.

When the user refreshes the browser, you can close all the windows or just let them be.

Personally I willl never use pop ups so I never have to deal with this stuff.

Eric
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic