Applet/Swing user inactivity detection
Hello,
I need some advise on the issue, of detecting user inactivity on my applet.
My current scenario is, my applet is hosted from a jsp page on the client machine, the applet contains a lot swing components (many jframes).
I want to somehow detect the user inactivity on that page hosting the applet.
Say for example if the user doesnt perform any action (like a mouse click) on the main applet or any of the child jframes spawned from it, for say 15 mins. I want to close the applet and the jframe saying Session Timeout.
Or other than this is there any way for applet to deal with session parameters to perform the timeouts, when no user activity takes place, on the JSP holding the applet.
Hope i am clear enough in my scenario.
Please advise.
Thanks,
>
I need some advise on the issue, of detecting user inactivity on my applet. >Why are you deploying an applet, rather than a webstart based application? I ask this especially since...
>
My current scenario is, my applet is hosted from a jsp page on the client machine, the applet contains a lot swing components (many jframes). >The entire app. sounds as though it is more based around free floating JFrames anyway.
I want to somehow detect the user inactivity on that page hosting the applet. Forget 'the page', since this can all be done within the applet or 'main GUI component' (should you decide to convert it to a JFrame).
The basic way outlined by the other tqwo responders would be the way to approach it. You app. needs to
a) Detect activity, and note the time.
b) Keep a timer running to check if the lastActivityTime has reached the limit, then..
c) Here we come to a bit of a tricky part... It is easy to detect 'activity' on a button or menu item that causes an event. You might put the code to handle the update of the timer into the event handler, but consider a JTextArea. An app. has a slew of buttons anf menu items, plus a number of JTextArea's for entering 'details'. Normally a JTextArea would not have an actionlistener, and would often not have any special handling on the KeyListener, so to avoid having to put a listener on every conceivable component that might hava 'activity', I suggest that at the end of the '15 minutes' you pop a modal JDialog itself with a 15 second 'you are about to be logged out' warning - and force the user to dismiss it in order not to be logged out.
d) When the user is logged out, you might indicate that by either removing all the components and replacing them with a message, or simply disabling all controls but the 'x' button (or something along those lines).
For the 'timer', there are a number of classes which might be used, from creating your own class that implements Runnable, through using a Swing based Timer to run the separate 'logout check' thread.
Similar Messages
-
[SOLVED] detect X11 user inactivity
Hi there,
I want to write a script that shuts down the computer if I don't use X11 keyboard and mouse and no video player is running after 12PM. I hate waking up in the morning with the computer running after falling asleep during a movie.
How can I detect if I'm using X11? Is there any way to check if dpms kicked in or the mouse and keyboard aren't used for some time? Or some screensaver can tell over dbus if it's active or not? (right now i don't use any screensaver, only X11 dpms).
Pidgin has a way of detecting user inactivity based on keyboard and mouse usage, so probably there is a way to do this. Any ideas?
Thanks a lot!
Last edited by silvik (2011-07-04 09:06:19)18 lines of C...
/* gcc -o getIdleTime getIdleTime.c -lXss */
#include <X11/extensions/scrnsaver.h>
#include <stdio.h>
int main(void) {
Display *dpy = XOpenDisplay(NULL);
if (!dpy) {
return(1);
XScreenSaverInfo *info = XScreenSaverAllocInfo();
XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), info);
printf("%u", info->idle);
return(0);
Last edited by falconindy (2011-07-03 14:09:11) -
How to program shift register to read only when a new user is detected from user?
Hi,
I'm currently developing a program for position control in labview. The program is quite simple, whereby user will input the distance that he wants the table to be in the labview program, and labview will send signal to move a motor that will turn a ball screw to move a table horizontally to the targetted position. The criteria is that the profile of the motor depends on the distance it needs to move, whether a two-phase (acceleration and deceleration) or three-phase (acceleration, constant velocity, deceleration) to reach the target position.
The problem occurs when the user wants to enter a new position (second input) for the table, as the input by user is position the table needs to be but the input required to determine which profile the motor follows depends on the distance that the table will move to get to the targetted position. Therefore, I would need a function to store the input by user temporarily, and recall it only when a new input from user is detected. By this, I would be able to use the difference of the input (input [n+1] - input[n]) and feed it to determine which profile the motor follows and the input by user can be kept as the position he wants the table to travel to (to compare with encoder).
I thought of using shift registers to do this, but I am not able to make it to perform the deduction ([n+1] - [n]) only when it detects a new input. When i try using shift register, it travels to the targetted position, and one it reaches it will travel back to the original position. For example, when a user input 90, it means the table needs to move to point 90. As the shift register is initialized to 0, it will move to point 90 (90-0 = 90) but upon reaching 90, the shift register sends a signal of 90 (90-90 = 0) and the table returns to it's initial position.
Is there any way that I can delay the reading of shift register only when a new input is detected or is there another way for me to achieve what i want?
I've tried searching the discussion forum and ni website but couldn't find similar problems. Thanks for your help in advance.
Solved!
Go to Solution.Hi,
I've managed to get what I needed by using a shift register + event structure as suggested by Adnan. However, I face another problem after implementing SR+event. I've attached two files, first the original program and second the updated program using SR + event. (it's only the jpg file as I've forgotten to save the labview program, will upload the program by tomorrow.
In the original program, I have an elapsed time that is able to run continuously when I run the program. In the updated program, my elapsed time don't seem to run continuously when I run the program (as shown by elapsed time indicator). I need the elapsed time to run continuously as a input to calculate my motor profile.
I suppose this is caused by the introduction of the event structure, will adding a case structure to wrap the event structure solve the problem or is there another way to get pass this. Appreciate if someone could drop me a pointer or two.
Thanks
Attachments:
Mar 16 - continuous elapsed time.png 12 KB
Mar 16 - elapsed time not continuous after introducing shift register + event structure.png 17 KB -
How to make an applet load user-defined package?
How to have an applet load user-defined package?
I have packages in their own directories, and the applet compiles and links with them, by use of CLASSPATH env variable. But when it comes time to run, it ignores that and does not know where the classes (in the packages) are.
If I don't use packages and put all code in one directory, runs fine. If I use an application, I can link with and load my packages.
I know applets can't use things like CLASSPATH for security reasons, but still, they should be able to be compiled out of several packages, why do I have to put all code together??OK, for reference for future newbies, here's the answer:
use CODEBASE attribute in your html file (if on Windows server, don't use drive letter but relative path to .html file, Unix style, and put all your .class files beneath that, for example, in your .html file
<applet
CODEBASE="..\class
and then have package bar Bar.class file, in ..\class\bar -
Hello Guru's,
Good morning. We are performing license measurement twice a year and perform user inactivity every quarter. To save time on user inactivity and to achieve accuracy, planning to have a new custom program developed. However, not sure if SAP has any plans to develop such a funactionality. We have CUA implemented in Solution manager (SAP EHP 1 for SAP Solution Manager 7.0, SAP basis component SAPKB70104).
As part of user inactivity, we filter the inactive users from all servers and set thier valid to date to last login date and lock them. Due to recent support package implementation we have additional functionality in report "RSUSR200" in CUA master. Which ideally gives the inactive users from all systems. However, we need to evaluate the user's again on individual basis since it is not complete. That means if user is part of 5 systems and inactive in 1 system, the user is shown in the report as inactive.
We have recently implemented another new functionality in CUA "RSUSR_SYSINFO_LICENSE". This report provides no of users based on the license category from selected systems.
Now the question is, do you know if any new support packages has the functionality Or ever heard from SAP
for performing user inactivity. That means, simply lock the user, set validity date to past or last login date if the user is inactive in all systems.
It will also be good if you share on how are you performing this activity?
Regards,
Gowrinadh
Edited by: Gowrinadh Challagundla on Apr 27, 2010 9:47 AMHi Bernhard,
Thanks for the reply. Let me explain in details about that.
USER A is now a CRM user and before worked in ECC. The user is not using ECC any more, and only active in CRM. When I run this report, USER A is reported inactive in ECC. Which is right. However, I can't lock this user globally and set valid to date in past because the same user is active in CRM.
Since I know User A is a CRM user, I can avoid locking this user. The same way I need to determine all the user's reported here. The functionaity I am looking here is "report should check in all systems and say whether user is inactive and all respective systems". If the user is active in any one of the system, it should not be shown.
Hope it clarifies.
Regards,
Gowrinadh -
Can a sprite become visible after a certain amount of user inactivity?
Can a sprite become visible after a certain amount of user inactivity? like a timer triggering an event?
Hi Kevin,
You can look at the on timeOut event. (This is not to be confused with timeOut objects)
There are a number of related properties, which date back from the early days of Director, and which seem to have been omitted from recent versions of the documentation, even though they still function. I give them here with their original names (prior to Director 10):
the timeOutKeyDown
the timeOutLapsed
the timeOutLength
the timeOutMouse
the timeOutPlay
the timeOutScript
the lastClick
the lastEvent
the lastKey
the lastRoll
(You can also use the more recent DOM style for these last four properties: _player.lastXXX)
Here's a very simple script which will make sprite 1 disappear when the movie starts, and reappear if the user does nothing for 5 seconds:
on startMovie()
sprite(1).visible = FALSE
the timeOutLength = 300 -- = 5 seconds * 60 ticks / second
end startMovie
on timeOut()
sprite(1).visible = TRUE
end timeOut
If you click the mouse at intervals of less than 5 seconds after starting the movie, then the sprite will remain invisible.
NOTE: Using sprite(x).visible = FALSE will make the entire sprite channel invisible everywhere in the Score. It's better to use sprite(x).blend = 0, unless the sprite must not react to the mouse while it is invisble, in which case it is better to move it off-stage.
Is this what you are looking for?
James -
Can we use applets as user interfaces with sockets, RMI and J2EE
Dear Sir or Madam,
Since I am a TA for software architecture class, some one ask me the following question: I think the answer is "No" based on the document on http://java.sun.com/sfaq/
How I answer the quesions? Looking forward your help!!!
1.You may have 2 applets and 2 html files. One applet with one html file may stay at a client PC and run on this PC, and the other applet with the other html file may stay at a server PC and run on this PC. In this case, all the applets are run locally.
2.Could applets works with sockets, RMI and J2EE?
3.Can we use applets as user interfaces with sockets, RMI and J2EE?
Thank you very much!
Best regards,
JingThe scenario you paint doesn't quite make sense. The "server PC" wouldn't be running an applet, normally, since applets are by definition in a web browser page, and most likely involve user interaction, and "server processes" generally are done without user interaction.
The security rules around applets are that -- by default -- applets can connect with sockets ONLY to the server from whence the applet was loaded. RMI uses sockets (J2EE is too broad a spec) and hence RMI calls would also be limited to the server from whence the applet was loaded. Within that limitation, an applet could open all the sockets it wants, so long as they are all on the server from whence the applet was loaded.
If you want two applets on two different systems to communicate with each other, the simplest way is to have them rendevous through a server process on the server(s) from whence each applet was loaded. Maybe it's PC-a <-> server-a <-> server-b <-> PC-b ...? Or maybe PC-a and PC-b both are talking to the same server.
The limitation is rooted in the security subsystem. You can specify a policy file and override anything in the security subsystem. That does mean signing the applet and then cajoling the user into agreeing to grant greater levels of security than the default. In such a case you can open sockets more broadly and then PC-a could talk directly to PC-b without going through any servers.
- David -
Discoverer Plus and the SSO GUIT (Global User Inactivity Timeout)
Does Discoverer Plus obey the Global User Inactivity Timeout?
We've enabled SSO for Discoverer Plus and Viewer (v. 9.0.4.45.02), and we've
configured the Global User Inactivity Timeout. For testing, we set GUIT to 5 minutes.
When we re-activate a Viewer session after more than 5 minutes of no activity,
we're prompted for our SSO username/password, as expected.
If we leave a Plus session inactive for more than 5 minutes, we are not prompted for our SSO username/password.
If we leave a Plus session inactive for 30 minutes, a pop-up appears warning us
that Plus will exit if we don't take some action. This pop-up is driven by the fact that we set Timeout to 30 minutes in the pref.txt file. Plus behaved this way before we enabled it for SSO.
We thought that Plus and Viewer are both governed by GUIT in the SSO environment. Are we wrong about that?Yes, i am having the same problem with the Timeout. No matter what i have the timeout set to, the portal never redirects to the login, the users stay logged in indefinitely. We are running 10gAS (10.1.2). I have a feeling it has something to do with the cookie not being properly set. If ANYONE has any experience with this please reply. thanks so much
Steve -
Applet / Swing - I'm new in applets
Hi,
I need to program applet project, but I know only swing.
Am I have to lern about applet before, or start to create a swing program and then to change to a applet ?
what is the difference between Applet / Swing?
What I have to change in the my swing program to be Applet?
the connecting is same to the database? (JDBC)
Thanks.Jar file is made when you are creating a desktop application.
it is like setup file which extract the more than one class file
but in webapplication u need to store class files in webserver and have to create html file
<applet code="file.class" width=300 height=300>
</applet>
no need to create jar file for web application and applet is used to create webapplicaton -
Portal to timeout on User inactivity
Dear All,
I have already read many posts on portal timeouts to occur based on user inactivity. (that is for the portal to log off automatically when there is no mouse movement or KB activity say in 10 minutes.)
Can you please give a step by step guide as to how to achive this? Earlier posts do not clearly specify how to achieve this properly.
I am using SAP 2004S SP07.
Any assistance is highly appreciated,
Antony.Even I am on the same page and trying to figure out a way to logoff for user inactivity. we are using kiosks for ESS. so it is really needed.....
I am following through the link <a href="http://help.sap.com/saphelp_nw04/helpdata/en/bd/6ca740aa053a13e10000000a155106/frameset.htm">Specifying HTTP Session Timeout</a>. This would work for me. But I can not locate the file web.xml on the server. Please advise if you had used this.
Thanks in advance -
It's been a couple of years since I wrote any code in Java and I've hit a snag that I can't seem to solve.
The application will be an applet with a swing GUI. I need to pop up a modal log in dialog before the user can do anything. The problem is I can't seem to find a way to have a legal parent argument for the JDialog constructor. My choices seem to be a Frame, Dialog or Window objects which seem to map directly to JFrame, JDialog and JWindow. The problem is my applet doesn't have any of those and I seem to be having some issues adding any of them to the applet. Am I missing something or what?The application will be an applet with a swing GUI.I hope that's a JApplet.
The problem is I can't seem to find a way to have a legal parent argument for the JDialog constructor.I don't do applets, but have you tried with a null argument? You'll need to cast the null to any of Dialog, Frame or window to disambiguation.
luck, db -
Are there any Applet/Swing Case Studies
We're trying to decide whether to change our company's OLTP product's UI from being HTML/JavaScript to Swing (applet or use Web Start for web based app). Is there anyone that uses Swing for their entire front end for a product that is accessed over the internet (not an intranet).
Is development slower for Swing than HTML/JS; is app start-up and jar download too slow; are there proxy issues that are difficult to overcome? I'd appreciate any input that would help in this decision.
Thanks,
JohnWe can incorporate Swings in Web Applications using Applets i.e Servlets /JSP.
The pros are the Applets which are swing based download for the first time to the client side. If the user made any changes to these changes only those pages which are changed will be download which are cached.
Concerns:
If the cache is not updating properly once the applets are stored then the updations will not reflect in the web-page.
Sufficient memory should be allocated for the Java - Cache memory.
To overcome this drawbacks we can use JSF which is serve side component level scripting.
-- Swaroop -
Problem with applet , Not able to detect class file
Hello friends,
I have a swing/applet class file, and i am trying to integrate it with Tomcat webapps
My HTMl code goes like this...........
<APPLET ALIGN="CENTER"
CODEBASE="/../../classes/org/jgraph/"
CODE="SimpleGraph.class"
WIDTH="800" HEIGHT="500">
</APPLET>
My classes are found inside the code base URL............
CODEBASE="/../../classes/org/jgraph/"
My folder structure is like below.....in which "SimpleGraph.class" is found
D:\June5WF\Archicentro\web\WEB-INF\classes\org\jgraph\SimpleGraph.class
My HTML resides in the following directory structure...
D:\June5WF\Archicentro\web\WEB-INF\jsp\secure\admin\ramesh.jsp
But When I run the JSP page .... I am Getting Class not found exception..........
Please can anyone tell me how to solve this problem....
I have spent 4 hrs in this......PLZ help me out.....Hi,
I did not mean file object. I meant workbook object. The problem is that I can not see from your code how do you get that OLE object reference. It should be something like this
GET PROPERTY OF h_excel 'ActiveWorkbook' = h_workbook.
CALL METHOD OF h_workbook 'SAVEAS' EXPORTING #1 = l_file
Regards -
Users Inactive V$session
hello to all.
i have a strange problem i have users which is currently working and they are active users so when i query and check the status
so its showing me Inactive.
here is an example:
STATUS USERNAME LAST_CALL_ET
INACTIVE SYSMAN 9
ACTIVE APPL_INS 0
INACTIVE SYSMAN 273
INACTIVE SYSMAN 126
INACTIVE DBSNMP 20
INACTIVE SYSMAN 2
INACTIVE DBSNMP 325519
ACTIVE DBSNMP 0
INACTIVE SYSMAN 10
ACTIVE SYSMAN 24and also i check the following thread but did not find the solution is this a bug?
any help would be greatly appreciated.
status inactive in v$session
M.As soon as a session doesn't execute a SQL statement the status will become 'INACTIVE'.
That's everything that needs to be said about that.
As Oracle can't tell what a client is doing.
And, please: this is NOT a bug. Not even a feature. Just working as designed. PERIOD.
Sybrand Bakker
Senior Oracle DBA -
Applet forcing users to re-authenticate
I have an applet that accesses a secure servlet using the URL object. The applet is inside a secure web application deployed in JBoss. When I load any pages without applets, everything works fine (if it is my first load, I will be forced to authenticate myself as expected).
The problem is when I try to access an html page that renders an applet via the object tag (using plug-in version 1.4). A new dialog box pops up with a picture of Duke on it and titled "Enter Network Password". It forces the user to re-authenticate themselves.
Is there any way I can suppress this dialog in my applet? Obviously the user shouldn't have to login twice. I have seen similar people posting a similar complaint in other forums (excuse the long link): http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2Bapplet+%2B%22enter+network+password%22&col=java&col=jdc&col=wireless&col=javaforums&col=javabugs&col=industry&col=solmark&col=codedrop&x=17&y=6
but the only response I saw of any help was that it was a bug, but was fixed in version 1.3.1 of the plugin. Well I'm using 1.4 version and it still doesn't work for me.
Any suggestions?
AndrewSuggest investigating whether the proposed workaround involving enablement of Anonymous access/authentication defeats authentication before implementing it. My tests in a similar environment have shown that the workaround appears to defeat authentication. Makes sense as there is a reason Sun is addressing the issue (jdc bug #s 4518282, 4656979).
These tests can be tricky...Eg. IE likes to remember u/ps, etc. & you may need to close all IE sessions & "delete temp files / delete all offline content" between client tests.
Prior to this test we had only Basic Auth enabled for both external/SSL access & separately internal/LAN non-ssl dirs. Since you cannot use proprietary/MS-only auth prots, only Basic Auth with req. SSL encrypts u/p.
Anyway, here's what I did in a test environ:
1) Create new user account as target user (non-guest) for Anonymous access. Assign non-blank password (tried pass sync on & off - no diff).
2) Enable anonymous access using the new user account. Leave Basic Auth enabled too (just those two enabled).
3) Roam around & try to access the app from rebooted/cache-deleted client boxes.... Found that you are never asked for the password of the anonymous user (no surprise, that's what anonymous means & is for:)
4) As this apparently defeated authentication, rolled back test environs to prior state & am awaiting "mantis" release which might fix this properly.
Didn't really need to test this but had the time... The regression bug (from 1.3.1 -> 1.4.1) of having 2nd logon for SSL-protected basic auth sites is a big disappointment, but is attributed to incorp/use of JSSE HTTPS/SSL in plug-in instead of using browser's API. Perhaps the mantis fix implements code to query/use credentials known/cached within the browser?
Good luck,
Chris
Maybe you are looking for
-
How do you make a gradient background on a button in flex 4
Hey everyone, this is driving me crazy. Below is my css for a button in file. I want a gradient background on a button in flex 4. I can not for the life of me figure out how to do this. There is no longer the backgroundColors option. chromeColor is
-
Why can't i transfer my apps from iPhone to iTunes,file transfer does not work
ive tried everything to get my apps to sync to my itunes i dont kno what im missing ive tried file trnasfer so many times.up at the top of itunes where it shows all the apps downloading the bar under that wont load i dont kno if it has something to d
-
Why is it hard almost impossible to use iPad 1in sunlight outdoors
Why is it hard almost impossible to use iPad 1in sunlight outdoors
-
What is the advantage of abstract class and method???
hi, * Why a class is declared as abstract??? * What is the use of declaring a class as abstract??? * At what situation abstract class will be used???Thanks JavaImran
-
Export Process in Rice industries
Dear All SD Guru, My client selling the rice products in domestic without excise duty and also wants to export the same product , can any one tell me the export process without excise duty step by step? Every answer would be highly appreciatied . Th