Dynamic User Tracking
I would like to get the real time updates on end hosts on my switches. From reading other posts it sounds like I need to do the following:
1. Configure DHCP snooping on the switches.
2. Enable the mac notification traps on the switches and verify they are being sent to LMS.
I have catalyst 4000 and 4500 access switches. I've read that I may have problems with how LMS will handle the traps from the 4500 switches in this post: http://forums.cisco.com/eforum/servlet/NetProf?page=netprof&forum=Network%20Infrastructure&topic=Network%20Management&topicID=.ee71a02&fromOutline=&CommCmd=MB%3Fcmd%3Ddisplay_location%26location%3D.2cd34898
Has anyone had much luck in getting dynamic user tracking to work with the Catalyst 4500?
Not really. You'd have to run major acquisitions back to back to back, and that will just put too much strain on the server (and network).
Similar Messages
-
Dynamic User Tracking Ignoring Traps
LMS3.2
Campus Manager 5.2.0
Set up a switch per instructions and moved a PC from port to port. The Results:
S0068SWT0CW#sh mac ad not change
MAC Notification Feature is Enabled on the switch
Interval between Notification Traps : 1 secs
Number of MAC Addresses Added : 5
Number of MAC Addresses Removed : 4
Number of Notifications sent to NMS : 9
Maximum Number of entries configured in History Table : 1
Current History Table Length : 1
MAC Notification Traps are Enabled
History Table contents
History Index 1, Entry Timestamp 954048629, Despatch Timestamp 954048629
MAC Changed Message :
Operation: Added Vlan: 5 MAC Addr: 0024.e8f4.52fe Dot1dBasePort: 4
S0068SWT0CW#
Wireshark on the server shows the SNMP traps arrived at the server, but nothing is logged in the MACUHIC log (all items set for debugging and debugging is enabled) and nothing shows up in the end host report.
Trap listener configuration Listen traps from device is checked.
Dynamic User Tracking Configuration validate trap source by IP address is checked. The source address in validate trap source matches the source shown by wire shark.
What am I missing? How can I further troubleshoot this? ThanksTrap listener Configuration
Listen traps from device is selected
Listen traps from DFM/HPOV is not selected
trap listener port 1431
Dynamic User Tracking Configuration
validate SNMP Community not selected
validate trap source is selected
IP address is 10.67.139.100
It didn't work with the validate trap source not selected
I am not using DFM. The device is sending its traps to the server with campus manager. -
Dynamic User Tracking with WS-C4506-E
Hello,
I've the following problem, configured dynamic user tracking on a
WS-C4506-E with a WS-X45-SUP6L-E, System image file is a Version 12.2(53)SG2
Interface configuration:
snmp trap mac-notification change added
snmp trap mac-notification change removed
Global configuration:
snmp-server enable traps mac-notification change
snmp-server host xx.xxx.xx.xxx version 2c COMMUNITY udp-port 1431 mac-notification
mac address-table notification change interval 60
mac address-table notification change history-size 50
mac address-table notification change
#sh mac address-table notification change
MAC Notification Feature is Enabled on the switch
Interval between Notification Traps : 60 secs
Number of MAC Addresses Added : 21509
Number of MAC Addresses Removed : 21484
Number of Notifications sent to NMS : 11632
Maximum Number of entries configured in History Table : 50
Current History Table Length : 50
MAC Notification Traps are Enabled
UTU2 does not found any records for the device name or if I search for a directly connected PC to this switch.Where is this Collector Status screen? What dashboard is it on ?
>> Device Center > Troubleshooting Workflow
The fact that you have success for usertracking does not mean you server receives mac address notification traps. It only means the passive usertracking has run. The UT results from the other switch may come from this process.
>> Yes you're right.
Only via snoop or packetcapture you can be sure you receive the traps you want.
>> I set up a packetcapture on the server, the server receives the mac address notification traps on UDP port 1431.
>>Dynamic user tracking of switches from the same site works...for example I have three WS-C3750V2-48PS-S over >>there.
Also if you look at the Collection Sumary in the Inventory -> Device Status dashboard you may find that some devics fail on usertracking.
>> Both switches are not under the failed devices.
>>I'm a little bit confused now.... I can't even start a acquisition manually, LMS says device is not reacheable... but in Device Center (1st picture) "ping", "snmp" etc... is OK... -
IPM and dynamic user tracking not running properly.
Hello, I've got two problems after a reinstallation of CiscoWorks LMS 3.2.
Versions of software components:
LMS-3.2
Campus Manager-5.2.1
CiscoView-6.1.9
CiscoWorks Assistant-1.2.0
CiscoWorks Common Services-3.3.0
Device Fault Manager-3.2.0
Integration Utility-1.9.0
Internetwork Performance Monitor-4.2.0
LMS Portal-1.2.0
Resource Manager Essentials-4.3.0
First probelm I have sounds pretty much like this thread:
https://supportforums.cisco.com/message/3064784#3064784
Source device is a WS-C3560-8PC - 12.2(55)SE1 - C3560-IPSERVICESK9-M
I configured a IPM collector, if I have a look at the "Collector Management" the collector is running and I can also monitor the running collector.
But if I have a look at the running config of the switch, there is no ip sla collector configuration but I can see the ip sla statistics via the show command.
#sh ip sla configuration 135123
IP SLAs, Infrastructure Engine-II.
Entry number: 135123
Owner: ipm|XXXS1077
Tag: QA-Site1-Site2
Type of operation to perform: udp-jitter
Target address/Source address: target ip address/source ip address
Target port/Source port: 2000/0
Type Of Service parameter: 0xB8
Operation timeout (milliseconds): 5000
Codec Type: g729a
Codec Number Of Packets: 1000
Codec Packet Size: 32
Codec Interval (milliseconds): 20
Advantage Factor: 12
Verify data: No
Vrf Name:
Control Packets: enabled
Schedule:
Operation frequency (seconds): 60
Next Scheduled Start Time: Start Time already passed
Group Scheduled : FALSE
Randomly Scheduled : FALSE
Life (seconds): Forever
Entry Ageout (seconds): 3600
Recurring (Starting Everyday): FALSE
Status of entry (SNMP RowStatus): Active
Threshold (milliseconds): 5000
Distribution Statistics:
Number of statistic hours kept: 2
Number of statistic distribution buckets kept: 1
Statistic distribution interval (milliseconds): 20
Enhanced History:
#sh ip sla statistics
Round Trip Time (RTT) for Index 135123
Type of operation: jitter
Latest RTT: 45 ms
Latest operation start time: 14:36:31.759 MET Wed Mar 16 2011
Latest operation return code: OK
RTT Values
Number Of RTT: 1000
RTT Min/Avg/Max: 21/45/60 ms
Latency one-way time milliseconds
Number of Latency one-way Samples: 0
Source to Destination Latency one way Min/Avg/Max: 0/0/0 ms
Destination to Source Latency one way Min/Avg/Max: 0/0/0 ms
Jitter time milliseconds
Number of SD Jitter Samples: 999
Number of DS Jitter Samples: 999
Source to Destination Jitter Min/Avg/Max: 0/3/15 ms
Destination to Source Jitter Min/Avg/Max: 0/1/9 ms
Packet Loss Values
Loss Source to Destination: 0 Loss Destination to Source: 0
Out Of Sequence: 0 Tail Drop: 0
Packet Late Arrival: 0 Packet Skipped: 0
Voice Score Values
Calculated Planning Impairment Factor (ICPIF): 11
MOS score: 4.06
Number of successes: 18
Number of failures: 0
Operation time to live: Forever
#sh run all | include 135123
Any suggestions? Am I right?
The second problem is about the dynamic user tracking like these theads https://supportforums.cisco.com/message/3135881#3135881 or
https://supportforums.cisco.com/message/3195492#3195492
Access switches are configured properly, the configuration ran without any problems with the previous installation.
No changes done at the configuration, using the default trap listener port etc.
In the macuhic.log file I get entries like in the attached txt.
When I try to run a full Campus Manager Data Collection I get the following errormessage:
Failed to start acquisition: Construction of XML data required for UT is in progress.Please try after some time
Also any suggestions? Am I right, too?By default IP SLA collectors installed by IPM do not appear in the running configuration. If you want to install the collectors into the running configuration, then set the "Copy IPSLA Configuration to running-config" property under IPM > Admin > Application Settings, then delete and recreate the collector.
Your Campus problem could be CSCtd49439 (a patch is available by contacting TAC). However, you should start a new thread for your Campus problem. -
Dynamic User Tracking Incorrect OID
macuhic.log is filled with Incorrect OID errors
class com.cisco.nm.cm.ut.uhic.mac.AsnDecoder.AsnObject: CB-Error-incorrectoid: Skt IP Address: 139.78.103.99, Incorrect OID: 1.3.6.1.6.3.1.1.5.3, location ctxt: AsnMakeMe_snmp_v2c, SNMPv2c
Decoder Stage: deviceIP : 139.78.103.99 timeStamp : 30083207 Processed : false
class com.cisco.nm.cm.ut.uhic.mac.AsnDecoder.AsnObject: CB-Error-incorrectoid: Skt IP Address: 139.78.103.99, Incorrect OID: 1.3.6.1.4.1.9.9.500.0.0.1, location ctxt: AsnMakeMe_snmp_v2c, SNMPv2c
Decoder Stage: deviceIP : 139.78.103.99 timeStamp : 30086951 Processed : false
class com.cisco.nm.cm.ut.uhic.mac.AsnDecoder.AsnObject: CB-Error-incorrectoid: Skt IP Address: 10.193.225.1, Incorrect OID: 1.3.6.1.6.3.1.1.5.5, location ctxt: AsnMakeMe_snmp_v2c, SNMPv2c
Decoder Stage: deviceIP : 10.193.225.1 timeStamp : 31619009 Processed : falseI put this configuration on 3500 switch:
conf t
mac address-table notification change
mac address-table notification change interval 15
snmp-server host aa.bb.cc.dd XXXXXX udp-port 1431 mac-notificationint range fa0/1 - 24
snmp trap mac-notification change added
snmp trap mac-notification change removed
end
Normally, only mac-notification traps would be sent to LMS.
I will take a look on received traps on LMS. -
Prime Infrastructure 2.0 and User Tracking
Hello
I'm having a look at getting wired User Tracking working on Prime 2.0. I checked that it is supported in the following link:
http://www.cisco.com/en/US/prod/collateral/netmgtsw/ps6504/ps6528/ps12239/guide_c07-729089.html
I'm having a problem getting dynamic user tracking working for wired non-802.1x clients. The switches are configured for mac-notification traps and the config works fine for LMS.
Another LMS User Tracking feature I'd link to get working in Prime 2.0 is CUCM intergartion where Prime would pull IP Phone extensions/names etc from CUCM.
Are either of these User Tracking features supported in Prime 2.0 (or at least roadmapped) or should I stick with LMS 4?
Thanks
AndyI am gettng good non-802.1x wired user tracking info. see the screenshot below (click to expand).
I don't have a CM so I can't comment on that bit.
Row 1 in the screenshot, for example, is confirmed with the following CLI output:
User_Access#sh run int fa1/0/41
Building configuration...
Current configuration : 177 bytes
interface FastEthernet1/0/41
description user access
switchport access vlan 10
switchport mode access
snmp trap mac-notification change added
spanning-tree portfast
end
User_Access#sh mac address-table | i 1/0/41
10 000f.b58e.3732 DYNAMIC Fa1/0/41
User_Access#sh inv
NAME: "1", DESCR: "WS-C3750-48P"
PID: WS-C3750-48PS-S , VID: V10 , SN: FDO1425X2M9
User_Access#sh ver | i bin
System image file is "flash:/c3750-ipservicesk9-mz.122-55.SE5.bin"
User_Access# -
LMS4 user tracking dynamic update switch configuration
So there is a tool that is supposed to configure switches to send mac notification traps:
Admin => Collection Settings => User Tracking => Device Trap Configuration
When I try this on a 3560, 3560X, 2960S or 2960X stack I receive the following message:
Command Not Found - Device trap configuration commands are not found for device(s) <ip address>
I was able to get it to run on a 3550-12G, though it didn't quite get the configuration command right.
Is this tool defunct?
Thanks,
-JeffWhat exact LMS version are you using?
As you said the configuration wasn't right and had incorrect commands on 3550-12G, what was it? Please share the commands configured on it.
You can verify which command LMS should ideally use, from this document :
List of Commands to Enable MAC Notification Traps on Devices
You can check the file MACCommands.XML from NMSROOT/campus/etc/cwsi/ from where LMS picks the MAC commands.
You can share this file and also check yourself if it has the correct commands as per the device sysObjectID.
If the device and its sysObjectID has missing entry, it may have the error coming as null.
-Thanks
Vinod -
Campus Manager User Tracking Report - dot1xEnabled = False
The Campus Manager User Tracking Report has the dot1xEnabled field that is always false.
It was my understanding that the switch will send SNMP Trap Notifications to Cisco Works regarding the status of 802.1x authentication per port.
We have configured per port:
snmp trap mac-notification added
snmp trap mac-notification removed
and globally
snmp-server host x.x.x.x abababa udp-port 1431 MAC-Notification
With no success, so we opened a TAC case, 614376387 and we were told by TAC and the Development Engineers that this "feature" does not work in LMS 3.2 and Campus Manager 5.2.1 and that this feature will be available in the next new release.
I thought I had read on this forum that some folks have this 'feature' working, where this field shows the current status of 802.1x per access port.
Has anyone been able to get this 'feature' to work? And if so, what versions are you running and what were the 'tricks' to get it working?
Much appreciated.The MAC address notification traps only alert Campus to the fact that a MAC address has been learned or removed from a given port. That starts the dynamic UT process. With no other information, you will potentially see a new record appear in UT shortly after receiving the trap. However, that record will not have IP or username data associated with it.
To get the IP data, Campus will poll the CISCO-DHCP-SNOOPING-MIB to pull IP data. To get username data, Campus will poll the IEEE8021-PAE-MIB of the switch to get dot1x information. So, your switch must be configured for dot1x, and it must support this MIB (in particular, the objects dot1xAuthSessionTime, dot1xAuthSessionUserName, and dot1xPaePortCapabilities).
Without dot1x, hope is not lost. If the end host is running Windows and the UTLite tool, then when the user logs in, UTLite should start from their logon script, and send a UDP update to Campus with the username and IP of the host. -
LMS 4.0.1 user tracking issue
Hi All,
I have an interesting problem at one of my customers. They are using LMS 4.0.1, but they have a problem with user tracking with SNMPv3. They using a very simple SNMP configuration, wich is the following:
access-list 80 permit x.x.x.x
snmp-server group SNMPV3GROUP v3 priv write SNMPV3_VIEW access 80
snmp-server view SNMPV3_VIEW iso included
snmp-server view SNMPV3_VIEW mib-2 included
snmp-server view SNMPV3_VIEW cisco included
User name: SNMPV3USER
Engine ID: 8000000903000014F2C38169
storage-type: nonvolatile active access-list: 80
Authentication Protocol: SHA
Privacy Protocol: AES128
Group-name: SNMPV3GROUP
snmp-server group SNMPV3GROUP v3 context vlan-X
Now they have UT working well for their Ctalyst 4500 switches, and the half of the 6500s (They have 2950 switches as well, but for those UT with SNMPv3 is unsupported). So the problem is the following: they have 12 6500 switches, with the same IOS version (10 pieces of WS-C6506-E + SUP720-3B IOS: 12.2(18)SXF17 (IP Services), 2 pieces of WS-C6506 + SUP720-BASE IOS: 12.2(18)SXF17 (IP Services)). They have identical SNMP configuration on both devices. Based on the logs from LMS it seems that on the problematic switches for some reason LMS identifies the switchports as routed:
==============Checking for Device==============
10.255.255.11 : INFO : The switch has been discovered by ANI Server.
IP : 10.255.255.11
Details :Cisco Internetwork Operating System Software
IOS (tm) s72033_rp Software (s72033_rp-IPSERVICESK9-M), Version 12.2(18)SXF17, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2009 by cisco Systems, Inc.
Comp
==============Checking for port Gi1/1==============
Gi1/1 : ERROR : ANI Server has discovered this port as a Routed port. Please run the UTDebug command only on ports connected to end hosts.
The config in the device as follows:
interface GigabitEthernet1/1
switchport
switchport access vlan 162
switchport mode access
no ip address
no snmp trap link-status
spanning-tree portfast
end
TOL_6506E_GT_COR_SW1#sh mac- | i Gi1/1
* 162 0050.5648.a765 dynamic Yes 0 Gi1/1
TOL_6506E_GT_COR_SW1#sh ip arp vrf ebh | i 0050.5648.a765
Internet 10.222.224.129 122 0050.5648.a765 ARPA Vlan162
TOL_6506E_GT_COR_SW1#
I didn't find any relevant bugs. Has anyone have any idea?
Thanks in advance,
ImreI'm not sure why Campus looks at that port as a routed port, but I ignore the errors in the campus ANI logs as there are too many of them even when everything works.
I always forget the OID (google knows it), but you best try to do an SNMP walk of the mac address table on the LMS server for a vlan you are interested in. Just to see if it can get it
In CSCOpx\bin you find a snmpwalk.exe
I'm not immediately sure why LMS would not be able to get that info via SNMP but it does narrow down on the root cause of your problem
Cheers,
Michel -
User tracking ip/host resolution how it works
I know usertacking using layer 3 devices to resolve host name/ ip address. on my case devices are behind the firewall and the devices not on my router arp table . the arp table is on firewall show the mac. however interestingly usertracking still resolve the name.the firewall is not even a cisco brand. that is very new to me and I im thinking may be i am not fully understand user tracking. can some one explain to me. thanks in advance
I've been meaning to write up a doc on how UT works. In the meantime, for layer 3 resolution, UT does a few things. Historically, it has always tried to acquire ARP entries from layer 3 devices in the network during its acquisition cycles. A layer 3 device need not be a router. It can be a 3560 switch, for example. Firewalls (even Cisco firewalls) are not supported for this. Using this layer 3 info, UT will perform a reverse lookup to get a hostname for the end host.
The next thing UT does to get layer 3 information is to listen for UTLite updates from Windows hosts. These updates will contain the MAC address of the client, the username logged into the client, and the IP address of the client. UT will not do a lookup of this information to get a hostname, however.
Finally, UT can query switches for DHCP snooping details to find an IP address. This is dependent on dynamic UT being enabled, and that the end host triggered a MAC notification trap to be sent. Of course, the switch to which the user connects must have DHCP snooping enabled. Again, UT will not perform a hostname lookup on this IP.
My guess based on what you describe is that you have some layer 3 devices in your network like 6500s, 3560s, 4500s, etc. that have some ARP entries populate, and UT is using these to get IPs. That assumes you're seeing hostnames. If you are only seeing IPs, then you could be using UTLite or dynamic UT with DHCP snooping. -
LMS3.2 User Tracking IP Phones Discovery Doesn't Work
I am having difficulty getting the User tracking for IP Phones to work correctly in Ciscoworks LMS 3.2.
Callmanager is version 7.1.5.10000-12. Campus manager version is 5.2.1
The Callmanager publisher and two subscribers are all showing as application servers with green icons under the topology services view.
The callmanagers show as CDP neighbours on the switches to which they are connected.
I can do an SNMP walk of the ccmPhoneTable from the Ciscoworks devicecenter and get a ton of returned data.
The IP phones are discovered as end hosts and have mac address and IP address info when checked in the User Tracking utility.
Callmanager sysObjectID = OID: CISCO-PRODUCTS-MIB::ciscoMCS7835I
Any help you could give with troubleshooting would be greatly appreciated.
Regards
RobThanks Nick,
I had seen that document and been through the processes
The mac and IP addresses of the ip phone are discovered.
The callmanagers are discovered and have green application server icons in the topolgy view
I can do an snmpwalk of the ccmPhoneTable OID and get returned data (as per this post by JClarke https://supportforums.cisco.com/message/664859#664859)
I can't do an snmpwalk of the ccmPhoneExtension as described in that document but I assume that since it applies to campus manager 3.2 and 3.3 that it is a bit dated and not relevant to later versions of callmanager.
I think that I have covered all the basic cdp/snmp and discovery issues. Any suggestions on where to go from here would be appreciated.
Regards
Rob -
Help needed, Createing Dynamic User input
Hello,
I am attempting to create some dynamic user input by "predicting" what the user requires in a text box.
For example if the user enters "Smi" I have a select list pop up which gives the user all options that begin with "Smi".
I am able to achieve the popups but the interface is quite jerky and not terribly responsive I am trying to solve this by using a thread which starts and stops when new input is received but it is still not quite right.
The program uses a Sorted TreeSet to hold the data (I thought this would give me a quick search time) and a simple interface at this stage.
Any help would be fantastic
Thanks in advance :P
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
/** This program represents part of a larger user interface for allowing the
user to select data from a file or database.
<p>
When the program starts up, it will read in data from a given file, and hold
it in some type of container allowing rapid access.
<p>
The user may then type in the first few letters of the surname of a person,
and this program should immediately present in a popup dialog the names which
match. The user will be able to click on one of the names in the popup and
that will cause all data about that person to be displayed in the JTextArea
at the bottom of the window.
<p>
This program requires the FormLayout.class, FormLayout$Placement.class, and
FormLayout$Constraint.class files in the same directory
(folder) or in its classpath. These is provided separately.
class PartMatch extends JFrame implements Runnable
/** Close down the program. */
JButton quitbtn;
/** Field for the surname. */
JTextField namefld;
/** Full details of the person(s). */
JTextArea results;
/** Popup dialog to display the names and addresses which
match the leading characters given in namefld. */
Chooser matches;
/** Default background color for a window. */
final static Color defBackground = new Color(0xD0C0C0);
/** Default foreground color for a window. */
final static Color defForeground = new Color(0x000000);
/** Default background color for a field */
final static Color fldBackground = new Color(0xFFFFFF);
/** Default background color for a button */
final static Color btnBackground = new Color(0xF0E0E0);
final static Color dkBackground = new Color(0xB0A0A0);
/** Larger font */
final static Font bold = new Font("Helvetica", Font.BOLD, 30);
TreeSet members;
String input;
String[] found;
public static void main(String arg[])
UIManager.put("TextField.background",fldBackground);
UIManager.put("TextField.foreground",defForeground);
UIManager.put("TextField.selectionBackground",btnBackground);
UIManager.put("TextArea.background",fldBackground);
UIManager.put("TextArea.foreground",defForeground);
UIManager.put("TextArea.selectionBackground",btnBackground);
UIManager.put("Panel.background",defBackground);
UIManager.put("Label.background",defBackground);
UIManager.put("Label.foreground",defForeground);
UIManager.put("Button.background",btnBackground);
UIManager.put("Button.foreground",defForeground);
UIManager.put("CheckBox.background",defBackground);
UIManager.put("ScrollBar.background",defBackground);
UIManager.put("ScrollBar.thumb",btnBackground);
UIManager.put("ComboBox.background",btnBackground);
UIManager.put("ComboBox.selectionBackground",dkBackground);
PartMatch trial = new PartMatch(arg);
public PartMatch( String [] arg )
super("Part Match");
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container cpane = getContentPane();
FormLayout form = new FormLayout(cpane);
JLabel lab1 = new JLabel("Fetch details") ;
lab1.setFont( bold );
form.setTopAnchor( lab1, 4 );
form.setLeftAnchor( lab1, 4 );
JLabel lab2 = new JLabel("Surname: ") ;
form.setTopRelative( lab2, lab1, 4 );
form.setLeftAlign( lab2, lab1 );
namefld = new JTextField( 30 );
form.setBottomAlign( namefld, lab2 );
form.setLeftRelative( namefld, lab2, 4 );
namefld.addCaretListener( new CaretListener()
public void caretUpdate(CaretEvent e)
showMatches();
quitbtn = new JButton( "Quit" );
quitbtn.addActionListener( new ActionListener()
public void actionPerformed(ActionEvent e)
quitProcessing();
form.setBottomAlign( quitbtn, namefld );
form.setLeftRelative( quitbtn, namefld, 15 );
results = new JTextArea( 10,50 );
results.setEditable(false);
JScrollPane jsp = new JScrollPane( results,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
form.setTopRelative( jsp, lab2, 6 );
form.setLeftAlign( jsp, lab2 );
form.setBottomAnchor( jsp, 5 );
form.setRightAnchor( jsp, 5 );
form.setRightAnchor( quitbtn, 5 );
matches = new Chooser( this );
//matches.setUndecorated(true);
pack();
setVisible(true);
namefld.requestFocus();
if (arg.length > 0) init(arg[0]);
else init("triathlon.txt"); //<<<<<<<<<<<<<<<< Place the default filename here
/** Called once only, at the end of the constructor, to read the data
* from the membership file.
public void init( String fname )
members = new TreeSet();
try {
FileReader fr = new FileReader(new File (fname));
Scanner scan = new Scanner(fr);
trimember cmem;
String cLine, eTag, memberNo, first, last, gender, yob, tel ,addr,
club;
while(scan.hasNextLine())
cLine = scan.nextLine();
Scanner scan2 = new Scanner(cLine);
scan2.useDelimiter(";");
eTag = scan2.next().trim();
memberNo = scan2.next().trim();
first = scan2.next().trim();
last = scan2.next().trim();
gender = scan2.next().trim();
yob = scan2.next().trim();
tel = scan2.next().trim();
addr = scan2.next().trim();
club = scan2.next().trim();
cmem = new trimember(eTag, memberNo, first, last, gender, yob,
tel, addr, club);
members.add(cmem);
catch (FileNotFoundException ex)
results.append("Sorry can't find the input file\n");
results.append("Please check file name and location and try again");
ex.printStackTrace();
/** Called every time there is a change in the contents of the text field
* namefld. It will first clear the text area. It then needs to search
* through the container of data to find all records where the surname
* starts with the characters that have been typed. The names and
* addresses need to be set up as strings and placed in
* an array of Strings. This can be placed in the "matches" window and
* displayed for the user, inviting one to be selected.
* <p>
* The performance of this is very important. If necessary, it may be
* necessary to run as a separate thread so that the user interface is
* not delayed. It is essential that the user be able to type letters at a
* reasonable speed and not have the keystroke processing held up by
* previous text.
public void showMatches( )
run();
// First clear the text area
//results.setText("");
// Determine the leading characters of the surname that is wanted
input = namefld.getText();
// Locate the data for this name, and display each matching item
// in the JTextArea ...
// Example of how to set the data in the popup dialog
matches.list.setListData(found);
matches.pack(); // resize the popup
// set the location of the popup if it is not currently visible
if ( ! matches.isVisible())
Dimension sz = matches.getSize();
Point mouse = getMousePosition();
Point framepos = getLocation();
int x=0, y=0;
if (mouse == null)
Point pt = results.getLocation();
x = pt.x + 20 + framepos.x;
y = pt.y + 20 + framepos.y;
else
x = mouse.x - 2 + framepos.x;
y = mouse.y - 2 + framepos.y;
matches.setLocation(x,y);
matches.setVisible(true);
namefld.requestFocus();
/** Perform any final processing before closing down.
public void quitProcessing( )
// Any closing work. Then
System.exit(0);
public void run()
ArrayList<String> foundit = new ArrayList<String>();
System.out.println(input);
if(input != null)
Iterator it = members.iterator();
while(it.hasNext())
trimember test = (trimember) it.next();
if (test.last.startsWith(input))
foundit.add(test.last +", "+ test.first);
found = new String[foundit.size()];
for(int i=0; i<foundit.size();i++)
found[i] = foundit.get(i);
/** A window for displaying names and addresses from the data set which
match the leading characters in namefld.
<p>
This will automatically pop down if the user moves the mouse out of the
window.
<p>
It needs code added to it to respond to the user clicking on an item in
the displayed list. */
class Chooser extends JWindow
/** To display a set of names and addresses that match the leading
characters of the namefld text field. */
public JList list = new JList();
Chooser( JFrame parent )
super( parent );
Container cpane = getContentPane();
cpane.addMouseListener( new MouseAdapter()
public void mouseExited(MouseEvent e)
Chooser.this.setVisible(false);
cpane.add("Center",list);
list.addListSelectionListener( new ListSelectionListener()
public void valueChanged(ListSelectionEvent e)
Chooser.this.setVisible(false);
System.out.println("ValueChanged");
// First clear the text area
results.setText("");
String in = (String) list.getSelectedValue();
System.out.println("Selected Value was : "+in);
String[] inlf = in.split(", ");
System.out.println("inlf[0]:"+inlf[0]+" inlf[1]:"+inlf[1]);
results.append("Surname \tFirst \teTag \tMemberNo \tSex \tYOB " +
"\tTel \tAddress \t\t\tClub\n");
Iterator it = members.iterator();
while(it.hasNext())
trimember test = (trimember) it.next();
if (test.last.equals(inlf[0])&&test.first.equals(inlf[1]))
results.append(test.toString()+"\n");
namefld.requestFocus();
public class trimember implements Comparable
String eTag;
public String memberNo;
public String first;
public String last;
String gender;
String yob;
String tel;
String addr;
String club;
public trimember(String eT, String me, String fi, String la,
String ge, String yo, String te, String ad, String cl)
eTag = eT;
memberNo = me;
first = fi;
last = la;
gender = ge;
yob = yo;
tel = te;
addr = ad;
club = cl;
//To String method to output string of details
public String toString()
return last + "\t" + first + "\t" + eTag + "\t" +
memberNo + "\t" + gender + "\t" + yob + "\t"+ tel + "\t" +
addr + "\t" + club;
//Compare and sort on Last name
public int compareTo(Object o)
trimember com = (trimember) o;
int lastCmp = last.compareTo(com.last);
int firstCmp = first.compareTo(com.first);
int memCmp = memberNo.compareTo(com.memberNo);
if (lastCmp == 0 && firstCmp !=0)return firstCmp;
else if (lastCmp==0&&firstCmp==0)return memCmp;
else return lastCmp;
}Please don't cross-post. It is considered very rude to do that here:
http://forum.java.sun.com/thread.jspa?messageID=9953193 -
Help needed, Providing Dynamic User input
Hello,
I am attempting to create some dynamic user input by "predicting" what the user requires in a text box.
For example if the user enters "Smi" I have a select list pop up which gives the user all options that begin with "Smi".
I am able to achieve the popups but the interface is quite jerky and not terribly responsive I am trying to solve this by using a thread which starts and stops when new input is received but it is still not quite right.
The program uses a Sorted TreeSet to hold the data (I thought this would give me a quick search time) and a simple interface at this stage.
Any help would be fantastic
Thanks in advance :P
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
/** This program represents part of a larger user interface for allowing the
user to select data from a file or database.
<p>
When the program starts up, it will read in data from a given file, and hold
it in some type of container allowing rapid access.
<p>
The user may then type in the first few letters of the surname of a person,
and this program should immediately present in a popup dialog the names which
match. The user will be able to click on one of the names in the popup and
that will cause all data about that person to be displayed in the JTextArea
at the bottom of the window.
<p>
This program requires the FormLayout.class, FormLayout$Placement.class, and
FormLayout$Constraint.class files in the same directory
(folder) or in its classpath. These is provided separately.
class PartMatch extends JFrame implements Runnable
/** Close down the program. */
JButton quitbtn;
/** Field for the surname. */
JTextField namefld;
/** Full details of the person(s). */
JTextArea results;
/** Popup dialog to display the names and addresses which
match the leading characters given in namefld. */
Chooser matches;
/** Default background color for a window. */
final static Color defBackground = new Color(0xD0C0C0);
/** Default foreground color for a window. */
final static Color defForeground = new Color(0x000000);
/** Default background color for a field */
final static Color fldBackground = new Color(0xFFFFFF);
/** Default background color for a button */
final static Color btnBackground = new Color(0xF0E0E0);
final static Color dkBackground = new Color(0xB0A0A0);
/** Larger font */
final static Font bold = new Font("Helvetica", Font.BOLD, 30);
TreeSet members;
String input;
String[] found;
public static void main(String arg[])
UIManager.put("TextField.background",fldBackground);
UIManager.put("TextField.foreground",defForeground);
UIManager.put("TextField.selectionBackground",btnBackground);
UIManager.put("TextArea.background",fldBackground);
UIManager.put("TextArea.foreground",defForeground);
UIManager.put("TextArea.selectionBackground",btnBackground);
UIManager.put("Panel.background",defBackground);
UIManager.put("Label.background",defBackground);
UIManager.put("Label.foreground",defForeground);
UIManager.put("Button.background",btnBackground);
UIManager.put("Button.foreground",defForeground);
UIManager.put("CheckBox.background",defBackground);
UIManager.put("ScrollBar.background",defBackground);
UIManager.put("ScrollBar.thumb",btnBackground);
UIManager.put("ComboBox.background",btnBackground);
UIManager.put("ComboBox.selectionBackground",dkBackground);
PartMatch trial = new PartMatch(arg);
public PartMatch( String [] arg )
super("Part Match");
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container cpane = getContentPane();
FormLayout form = new FormLayout(cpane);
JLabel lab1 = new JLabel("Fetch details") ;
lab1.setFont( bold );
form.setTopAnchor( lab1, 4 );
form.setLeftAnchor( lab1, 4 );
JLabel lab2 = new JLabel("Surname: ") ;
form.setTopRelative( lab2, lab1, 4 );
form.setLeftAlign( lab2, lab1 );
namefld = new JTextField( 30 );
form.setBottomAlign( namefld, lab2 );
form.setLeftRelative( namefld, lab2, 4 );
namefld.addCaretListener( new CaretListener()
public void caretUpdate(CaretEvent e)
showMatches();
quitbtn = new JButton( "Quit" );
quitbtn.addActionListener( new ActionListener()
public void actionPerformed(ActionEvent e)
quitProcessing();
form.setBottomAlign( quitbtn, namefld );
form.setLeftRelative( quitbtn, namefld, 15 );
results = new JTextArea( 10,50 );
results.setEditable(false);
JScrollPane jsp = new JScrollPane( results,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
form.setTopRelative( jsp, lab2, 6 );
form.setLeftAlign( jsp, lab2 );
form.setBottomAnchor( jsp, 5 );
form.setRightAnchor( jsp, 5 );
form.setRightAnchor( quitbtn, 5 );
matches = new Chooser( this );
//matches.setUndecorated(true);
pack();
setVisible(true);
namefld.requestFocus();
if (arg.length > 0) init(arg[0]);
else init("triathlon.txt"); //<<<<<<<<<<<<<<<< Place the default filename here
/** Called once only, at the end of the constructor, to read the data
* from the membership file.
public void init( String fname )
members = new TreeSet();
try {
FileReader fr = new FileReader(new File (fname));
Scanner scan = new Scanner(fr);
trimember cmem;
String cLine, eTag, memberNo, first, last, gender, yob, tel ,addr,
club;
while(scan.hasNextLine())
cLine = scan.nextLine();
Scanner scan2 = new Scanner(cLine);
scan2.useDelimiter(";");
eTag = scan2.next().trim();
memberNo = scan2.next().trim();
first = scan2.next().trim();
last = scan2.next().trim();
gender = scan2.next().trim();
yob = scan2.next().trim();
tel = scan2.next().trim();
addr = scan2.next().trim();
club = scan2.next().trim();
cmem = new trimember(eTag, memberNo, first, last, gender, yob,
tel, addr, club);
members.add(cmem);
catch (FileNotFoundException ex)
results.append("Sorry can't find the input file\n");
results.append("Please check file name and location and try again");
ex.printStackTrace();
/** Called every time there is a change in the contents of the text field
* namefld. It will first clear the text area. It then needs to search
* through the container of data to find all records where the surname
* starts with the characters that have been typed. The names and
* addresses need to be set up as strings and placed in
* an array of Strings. This can be placed in the "matches" window and
* displayed for the user, inviting one to be selected.
* <p>
* The performance of this is very important. If necessary, it may be
* necessary to run as a separate thread so that the user interface is
* not delayed. It is essential that the user be able to type letters at a
* reasonable speed and not have the keystroke processing held up by
* previous text.
public void showMatches( )
run();
// First clear the text area
//results.setText("");
// Determine the leading characters of the surname that is wanted
input = namefld.getText();
// Locate the data for this name, and display each matching item
// in the JTextArea ...
// Example of how to set the data in the popup dialog
matches.list.setListData(found);
matches.pack(); // resize the popup
// set the location of the popup if it is not currently visible
if ( ! matches.isVisible())
Dimension sz = matches.getSize();
Point mouse = getMousePosition();
Point framepos = getLocation();
int x=0, y=0;
if (mouse == null)
Point pt = results.getLocation();
x = pt.x + 20 + framepos.x;
y = pt.y + 20 + framepos.y;
else
x = mouse.x - 2 + framepos.x;
y = mouse.y - 2 + framepos.y;
matches.setLocation(x,y);
matches.setVisible(true);
namefld.requestFocus();
/** Perform any final processing before closing down.
public void quitProcessing( )
// Any closing work. Then
System.exit(0);
public void run()
ArrayList<String> foundit = new ArrayList<String>();
System.out.println(input);
if(input != null)
Iterator it = members.iterator();
while(it.hasNext())
trimember test = (trimember) it.next();
if (test.last.startsWith(input))
foundit.add(test.last +", "+ test.first);
found = new String[foundit.size()];
for(int i=0; i<foundit.size();i++)
found[i] = foundit.get(i);
/** A window for displaying names and addresses from the data set which
match the leading characters in namefld.
<p>
This will automatically pop down if the user moves the mouse out of the
window.
<p>
It needs code added to it to respond to the user clicking on an item in
the displayed list. */
class Chooser extends JWindow
/** To display a set of names and addresses that match the leading
characters of the namefld text field. */
public JList list = new JList();
Chooser( JFrame parent )
super( parent );
Container cpane = getContentPane();
cpane.addMouseListener( new MouseAdapter()
public void mouseExited(MouseEvent e)
Chooser.this.setVisible(false);
cpane.add("Center",list);
list.addListSelectionListener( new ListSelectionListener()
public void valueChanged(ListSelectionEvent e)
Chooser.this.setVisible(false);
System.out.println("ValueChanged");
// First clear the text area
results.setText("");
String in = (String) list.getSelectedValue();
System.out.println("Selected Value was : "+in);
String[] inlf = in.split(", ");
System.out.println("inlf[0]:"+inlf[0]+" inlf[1]:"+inlf[1]);
results.append("Surname \tFirst \teTag \tMemberNo \tSex \tYOB " +
"\tTel \tAddress \t\t\tClub\n");
Iterator it = members.iterator();
while(it.hasNext())
trimember test = (trimember) it.next();
if (test.last.equals(inlf[0])&&test.first.equals(inlf[1]))
results.append(test.toString()+"\n");
namefld.requestFocus();
public class trimember implements Comparable
String eTag;
public String memberNo;
public String first;
public String last;
String gender;
String yob;
String tel;
String addr;
String club;
public trimember(String eT, String me, String fi, String la,
String ge, String yo, String te, String ad, String cl)
eTag = eT;
memberNo = me;
first = fi;
last = la;
gender = ge;
yob = yo;
tel = te;
addr = ad;
club = cl;
//To String method to output string of details
public String toString()
return last + "\t" + first + "\t" + eTag + "\t" +
memberNo + "\t" + gender + "\t" + yob + "\t"+ tel + "\t" +
addr + "\t" + club;
//Compare and sort on Last name
public int compareTo(Object o)
trimember com = (trimember) o;
int lastCmp = last.compareTo(com.last);
int firstCmp = first.compareTo(com.first);
int memCmp = memberNo.compareTo(com.memberNo);
if (lastCmp == 0 && firstCmp !=0)return firstCmp;
else if (lastCmp==0&&firstCmp==0)return memCmp;
else return lastCmp;
}Edited by: Roger on Nov 3, 2007 11:50 AMPlease don't cross-post. It is considered very rude to do that here:
http://forum.java.sun.com/thread.jspa?threadID=5233033&messageID=9953169#9953169 -
I configure a RFC Receiver adapter to communicate with R/3. In my client application (via Webdynpro) I send the message that use this communication, but I need to call the RFC using a dynamic user/password, that is, the user credentials that is logged. Is it possible? How I do it?
thanks.Hi Elton,
I don't think so, it is possible to have dynamic user ID and password for the RFC adapter. As of now...
Because you need to enter the user id and password while configuring adapter itself.
But if you want , you can call different RFCs based on the Condition etc.
Hope this helps,
Regards,
Moorthy -
Hello,
here's a little teaser for user interface experts out there:
I wonder what kind of techniques ABAP offers for creating dynamic user interfaces.
When talking of 'dynamic' I imagine something like an arbitrary number of 'containers' where other programs (classes f.ex.) can draw their own user interface into.
In Java this could be realized with the container concept in swing.
I have done some research on this topic and the results are so far:
a plain dynpro: seems to have no dynamic at all -> not an option
a plain dynpro with a tabstrip: in case the number of tabs CAN be set at runtime AND the subscreens CAN be drawn from inside separate classes -> a definite option otherwise not an option
any kind of web-frontend (BSP, JSP etc.): web-frontends are not allowed by company restrictions -> not an option
dynamic documents: I could not find many information on these yet (also not on sdn). In case that an arbitrary number of parts of the dynamic document can be created from inside separate classes -> an option otherwise not an option
I will be happy about any further information on this topic.
Best regards,
Patrick BaerI spent some time today doing research on BSP's and built a "BSP-Viewer" embedded into the SAP-GUI. Though I like the concept of BSP's a lot (like I did already with JSP's) but company restricitions are too strict. So BSP's are out of the play.
After the discussion I started to play around with the different containers and basically I'm quite pleased with them and the "cl_gui_container_bar" allows an arbirtary number of "subscreens" which matches my requirements.
But as usual there's still a downside:
I found no option to built text labels and text fields into a container. Unless this is possible I can't give this approach a chance. I already found some postings which seemed to confirm that this is in fact not possible but I can't really believe it. At least from what it looks like it seems to me that the object navigator utilizes both: splitters, containers and all the stuff AS WELL AS the "classical" elements like text boxes, labels and so on.
Any ideas on how to combine the container concept with text fields, labels maybe whole dynpros or subscreens ?
Best regards,
Patrick Baer
Maybe you are looking for
-
I have had an iTunes account for years but now find it extreemly complicated to understand. I don't even know how to get into my account!!! My questions are:- 1. I have always lived in the UK but on iTunes I am now listed as living in the US!!! a
-
How to retrieve records from taxonomy table
Hi, I have a main table which has taxonomy field,for ex: category. Main table: Products which has ProductName(text),ProductNo(text),Category fields(Lookup[taxnomoy]) Could anyone please tell me how to retrieve the records and attributes from a taxono
-
Designing table for client/server situation ....
I am designing table that will be accessed by concurrent users. It's structure is given below: AccountID number(30) Primary Key AccountName text(50) I have a sequence named: "seqAccID" which increments AccountID and stores new ID. I want to know what
-
Designer and SDO_GEOMETRY object type
I want to have tables with columns of object type MDSYS.SDO_GEOMETRY (Oracle Spatial's type) in Designer 9i and then generate these tables. So I created in Oracle Object Types branch object type called MDSYS.SDO_GEOMETRY without attributes, methods o
-
Installing Microsoft Project Professional on MAC
Hello, I am taking a Project Management class online and I need the Microsoft Project Proffessional computer program. I have the CD, came with the book, but it will not load on my MAC. Anyone have any suggestions? Thanks!