urlname
.
* If the report contains external references in specified in relative urls, the urls
* are loaded using the reports parent directory as content base.
*
* @param urlname the filename from where to load the report
* @param data the datamodel for the report
*/
public void preview(String urlname, final TableModel data, String querytitle)
{
URL xmlPath1;
String xmlPath2, xmlPath3;
String queryTitle = querytitle;
xmlPath1 =
UserLogData.class.getProtectionDomain().getCodeSource().getLocation();
xmlPath2 = xmlPath1.toString();
xmlPath2 = xmlPath2.substring(5);
if (xmlPath2.substring(0, 1).equals("/")) {
//
} else {
xmlPath2 = "/" + xmlPath2;
}
xmlPath2 = xmlPath2.replaceAll("%20", " ");
System.out.println("path = "+ xmlPath2);
if (xmlPath2.toLowerCase().indexOf(".jar") > -1){
System.out.println("in the .jar section");
xmlPath2 = xmlPath2.substring(0,xmlPath2.lastIndexOf("/"));
System.out.println("modified path = "+ xmlPath2);
}
xmlPath2 = xmlPath2 + "Templates/";
//urlname = xmlPath2 + urlname;
if (urlname.toLowerCase().indexOf(".xml")== -1){
urlname = urlname + ".xml";
}
File tmpFile = new File(xmlPath2, urlname);
String tString = model.getRbString(UserLogDataRb,"Report definition file missing:","UserLogData");
tString = tString+" "+ xmlPath2 + urlname;
if (tmpFile.exists()){
System.out.println("File exists: " + xmlPath2 + urlname);
} else {
JOptionPane.showMessageDialog(
null,
tString,
model.getRbString(UserLogDataRb
,"Message","UserLogData"),
JOptionPane.ERROR_MESSAGE);
return;
}
//URL in = getClass().getResource(urlname);
URL in;
try {
in = tmpFile.toURL();
} catch (Exception ex) {in = null;
System.out.println("Error converting from File to URL:"+" "+ ex);
return;
}
if (in == null)
{
xmlPath2 = xmlPath2.substring(1);
in = getClass().getResource(xmlPath2 + urlname);
}
if (in == null)
{
JOptionPane.showMessageDialog(this,
MessageFormat.format(model.getRbString(UserLogDataRb,"report.definitionnotfound","UserLogData")+": "+ xmlPath2 + urlname,
new Object[]{urlname}),
model.getRbString(UserLogDataRb,"Error","UserLogData"), JOptionPane.ERROR_MESSAGE);
return;
}
System.out.println("Processing Report: " + in);
final ReportGenerator gen = ReportGenerator.getInstance();
try
{
final JFreeReport report1 = gen.parseReport(in, in);
if (report1 == null)
{
JOptionPane.showMessageDialog(this,
MessageFormat.format(model.getRbString(UserLogDataRb,"report definition null","UserLogData"),
new Object[]{urlname}),
model.getRbString(UserLogDataRb,"Error","UserLogData"), JOptionPane.ERROR_MESSAGE);
return;
}
report1.setData(data);
report1.setProperty("user_name",model.getCurrentUser());
report1.setProperty("query_title",queryTitle);
String rptName = "";
com.halepringle.standard.GeneralDialog gd =
new com.halepringle.standard.GeneralDialog(
null,
model.getRbString(UserLogDataRb, "Select", "UserLogData"),
"*IGNORE*",
model.getRbString(UserLogDataRb, "Cancel", "UserLogData"),
model.getRbString(
UserLogDataRb,
"The modified text you enter replaces the default value",
"UserLogData"),
"*IGNORE*",
model.getRbString(
UserLogDataRb,
"Cancel the operation",
"UserLogData"),
model.getRbString(
UserLogDataRb,
"Enter a secondary title for this report",
"UserLogData"),
model.getRbString(
UserLogDataRb,
"Use this title to describe why this report was run (e.g. 'Finished Items Report'.",
"UserLogData"),
rptName,
"A",
model.getRbString(
UserLogDataRb,
"Enter Report Description",
"UserLogData"));
gd.pack();
// gd.setLocationRelativeTo(GeneralDialog.this);
Dimension screenDim =
Toolkit.getDefaultToolkit().getScreenSize();
gd.setLocation(
(screenDim.width - 350) / 2,
(screenDim.height - 159) / 2);
gd.setVisible(true);
String outputVar;
String s = gd.getValidatedText();
if (s != null) {
outputVar = s;
// System.out.println(s);
} else {
//outputVar = "**Leave as is**";
outputVar = "**Cancel**";
}
if (outputVar.equals("**Leave as is**")) {
// do whatever it take to leave value as it was
//outputVar = query;
} else if (outputVar.equals("**Cancel**")) {
// do something
return;
} else {
// do something to change value to new value
}
System.out.println("Data output = " + outputVar);
rptName = outputVar;
report1.setProperty("report_title2",rptName);
//report1.getReportConfiguration().setStrictErrorHandling(false); // DG
final PreviewFrame frame1 = new PreviewFrame(report1);
frame1.setDefaultCloseOperation(frame1.DISPOSE_ON_CLOSE);
frame1.pack();
RefineryUtilities.positionFrameRandomly(frame1);
frame1.setVisible(true);
frame1.requestFocus();
}
catch (Exception e)
{
model.showErrorOccurred();
System.out.println("report.definitionfailure" + e);
}
}
//
/** SECTION 19- BTNSAVE - DO INSERT or CHECK THAT ROW HASN'T CHANGED DURING EDIT AND IF OKAY DO UPDATE */
//
///** SECTION 19- BTNSAVE - DO INSERT or CHECK THAT ROW HASN'T CHANGED DURING EDIT AND IF OKAY DO UPDATE */
/**
* Description - Save Button action
* If ID is zero insert a new row
* If ID is not zero, check that the row still exists
* with the same lastChangedDate as it had when this edit started.
* If the row is not there, notify the users that they must
* redo their changes (avoid overwriting - multiuser issues)
* If the row is still there with same lastChangedDate - update and
* change the lastChagned Date to now.
*/
public void btnSaveDoit(){
// if the ID is 0, we must be in insert mode
// First check if user had add or edit rights
if (rowObj.getUser_id() == 0) {
if (!addRights) {
JOptionPane.showMessageDialog(frame,
model.getRbString(UserLogDataRb,"NOTICE - Your account does not have Add rights to this screen","UserLogData"), model.getRbString(UserLogDataRb,"Rights Issue","UserLogData"),
JOptionPane.INFORMATION_MESSAGE);
return;
}
} else {
if (!editRights) {
JOptionPane.showMessageDialog(frame,
model.getRbString(UserLogDataRb,"NOTICE - Your account does not have Edit rights to this screen","UserLogData"),model.getRbString(UserLogDataRb,"Rights Issue","UserLogData"),
JOptionPane.INFORMATION_MESSAGE);
return;}
}
int changes = setDataUserLogData();
int errs = checkUserLogDataData();
//Note: if errs !=0 there would have been error messages telling what to do
if (errs == 0) {
calendar = java.util.Calendar.getInstance();
date = calendar.getTime();
String longNewDate = formatterTsStd.format(date);
String newDateOnlySave = formatterDateShort.format(date)+" ";
String newTimeOnlySave = formatterTimeMedium.format(date);
if (newTimeOnlySave.length() == 7 || newTimeOnlySave.length() == 5 || newTimeOnlySave.length() == 10){
newTimeOnlySave = "0" + newTimeOnlySave;
}
newDateOnlySave = newDateOnlySave.substring(0,10);
// System.out.println("date time right now in SQL Std fmt: "+longNewDate);
// System.out.println("date right now in save fmt: "+newDateOnlySave);
// System.out.println("time right now in save fmt: "+newTimeOnlySave);
// if the ID is greater than 0, we must be in Update mode
if (rowObj.getUser_id() > 0) {
if (changes > 0) {
newTableRow = 0; // make sure the ADD id is set to zero sinze we are doing an update
// **** NOTE This is a sample - it will vary from table to table
// **** This part of the sample tests for multiple users updating the same record
// String docid = Integer.toString(intDocid.getValue()).trim()+" ";
// docid = docid.substring(0,6);
// docid = docid.trim();
// String tmpString = "clientnumber = "+user_id.toString() +" and docid = "+docid;
String oldLastChangedBy = rowObj.getLastchangedby().trim();
String oldLastChangedDateText = rowObj.getDtLastchangeddateText().trim();
String oldLastChangedDateTime = rowObj.getTxtLastchangeddateTime().trim();
java.util.Date oldTime = null;
// GHP comment out at some point
// System.out.println("saved = !"+oldLastChangedBy.trim()+oldLastChangedDateText.trim()
// + " " + oldLastChangedDateTime+"!");
java.util.Date oldDate = null;
try {
oldDate = formatterDateShort.parse(oldLastChangedDateText);
} catch (Exception ex) {oldDate = null;};
// System.out.println("old date converted to date: " + oldDate);
try {
oldTime = formatterTimeMedium.parse(oldLastChangedDateTime);
} catch (Exception ex) {oldTime = null;};
// System.out.println("old Time converted to date/time: " + oldTime);
String oldLastDate ="";
try {
oldLastDate = formatterStd.format(oldDate); }
catch (Exception ex) {oldLastDate=" ";}
String oldLastTime = "";
try {
oldLastTime = formatterStdTimeWSecs.format(oldTime); }
catch (Exception ex) {oldLastTime="";}
// **** NOTE This is a sample - it will vary from table to table
// **** This example needs a client number and a document number to update a specific row
// **** You would need to go into Model.java and change the UpdateTable() to take four parameters
// String docid = Integer.toString(intDocid.getValue()).trim()+" ";
// docid = docid.substring(0,6);
// docid = docid.trim();
oldLastDate = oldLastDate.substring(0,10);
// System.out.println("new date: "+longNewDate);
// System.out.println("Date used in query: "+oldLastDate+" " + oldLastTime);
// utm.updateTable("user_id",Integer.toString(rowObj.getUser_id()), docid, update_UserLogData);
// System.out.println("new date: "+longNewDate);
update_UserLogData = update_UserLogData + ", lastchangeddate = {ts '"+longNewDate+"'} ";
update_UserLogData = update_UserLogData + ", lastchangedby = '"+model.getCurrentUser()+"'";
if (oldLastDate.trim().length() == 0) {
utm.updateTable( Integer.toString(rowObj.getUser_id()), update_UserLogData, "user_id", null,null);
} else {
utm.updateTable( Integer.toString(rowObj.getUser_id()), update_UserLogData, "user_id", "lastchangeddate", "{ts '" + oldLastDate+" " + oldLastTime + "'}" );
}
utm.fire();
int count = utm.getRowCount();
if (count == 0) {
System.out.println("query date/time that failed: "+ oldLastDate+" " + oldLastTime );
JOptionPane.showMessageDialog(frame,
"NOTICE - CHANGE ABORTED!! (Sorry for the inconveinience) "
+ "\n"+ "The record you were editing was changed by someone else while you were editing it. "
+ "\n"+ "To avoid losing their changes you must enter yours again.", "Change aborted ",
JOptionPane.INFORMATION_MESSAGE);
getDataUserLogDataByID(user_id.getValue(), null, null);
updateOrInsert = "Update";
return;
}
dtLastchangeddateText.setText(newDateOnlySave);
newRowObj.setDtLastchangeddateText( newDateOnlySave );
txtLastchangeddateTime.setText(newTimeOnlySave);
newRowObj.setTxtLastchangeddateTime( newTimeOnlySave );
//System.out.println("old rowObj Date/Time");
//System.out.println(rowObj.getDtLastchangeddateText());
//System.out.println(rowObj.getTxtLastchangeddateTime());
txtLastchangedby.setText(model.getCurrentUser());
newRowObj.setLastchangedby( model.getCurrentUser() );
int idx__ = 0;
try {idx__ =table.getSelectedRow();}
catch (Exception ex) {idx__ = 0;}
// idx__ = sorter.map(idx__);
if (idx__ < 0) {idx__ = 0;};
// **** NOTE reSetUserLogDataData(idx_) updates the "hld" values and an optional table
// **** NOTE - This also writes the current row into the copy of the resultSet
// **** being used to drive the JTable. Then the table is rebuilt.
// getDataUserLogDataByID(0, null);
rowObj = (dataObj)newRowObj.clone();
//System.out.println("new rowObj Date/Time");
//System.out.println(rowObj.getDtLastchangeddateText());
//System.out.println(rowObj.getTxtLastchangeddateTime());
//System.out.println("old newRowObj Date/Time");
//System.out.println(newRowObj.getDtLastchangeddateText());
//System.out.println(newRowObj.getTxtLastchangeddateTime());
if (model.getAllowsCONCUR_UPDATABLECursor()){
reSetUserLogDataData(idx__);
}
//reset focus to the row that was just updated
//Note: The comment out code that follows was replced by a tablechanged listener
// newTableRow = rowObj.getUser_id();
// createTable();
// String tmpString = "";
// try {
// oldDisplayRow = 0;
// goingBack = true;
// // note: if a row is already selected, this sets off the setData... any changes? method
// table.setRowSelectionInterval(0,0);
// goingBack = false;
// Integer tmpINT = (Integer) (table.getValueAt(0,UTM_USER_ID));
// int tmpInt = tmpINT.intValue();
// // getDataUserLogDataOneRow(tmpInt);
// // getDataUserLogData(0,0);
//
// } catch (Exception ex) {
// model.showWarningOcurred(model.getRbString(UserLogDataRb,"Error getting row number for lowest ID","UserLogData"));
// oldDisplayRow = -1;}
// double tmp = 0.0;
//
// // if (item_Id.getValue() > 0) {
// // getDataUserLogDataByID(item_Id.getValue(), null);
// updateOrInsert = "Update";
// // }
// buildLayout();
// UserLogData.this.doLayout();
// if (newTableRow > 0) {
// int maxRow = table.getRowCount();
// int tmpInt = -1;
// Object tmpObj;
// for (int i=0; i < maxRow; i++){
// tmpObj = table.getValueAt(i, UTM_USER_ID);
// if (tmpObj == null){
// tmpString = "-1";
// } else {
// tmpString = tmpObj.toString();
// };
// tmpString = tmpString.trim();
// try {
// tmpInt = Integer.parseInt(tmpString);
// } catch (Exception ex) {
// tmpInt = -1;
// }
// if (tmpInt == -1 ){
// maxRow = 0;
// break;
// }
// if ( tmpInt == newTableRow){
// maxRow = i;
// break;
// }
// }
// if (tmpInt != -1) {
// // make the row just added the active row - highlight it
// table.setRowSelectionInterval(maxRow, maxRow);
// oldDisplayRow = maxRow;
// // make sure the row is visible
// table.repaint();
// tableScrollPane.repaint();
// scrollVertically(table, getRowBounds(table, maxRow));
// }
// }
// if(newTableRow == 0) { //else it is already painted
UserLogData.this.repaint();
// table.repaint();
// tableScrollPane.repaint();
// };
newTableRow = 0;
// //
} //changes > 0
}else{ //START THE INSERT SECTION HERE
// **** NOTE This is a sample - it will vary from table to table
// **** This example assumes each client has documnts with doc_id 1,2,3
// **** It finds the current maximum for this client and bumps it by one for the insert
// **** There would need to a tableMaxDocIDQuery in Model.java
// utm.tableMaxDocidQuery();
// int maxRow = utm.getMaxRow();
// maxRow = maxRow + 1;
newId = 0;
vars_UserLogData = vars_UserLogData + ", lastchangeddate";
values_UserLogData = values_UserLogData+ ", {ts '"+longNewDate+"'} ";
vars_UserLogData = vars_UserLogData + ", lastchangedby";
values_UserLogData = values_UserLogData + ", '"+model.getCurrentUser()+"'";
utm.insertTable(vars_UserLogData, values_UserLogData, "user_id", "lastchangeddate", "{ts '" + longNewDate + "'}", "lastchangedby", model.getCurrentUser() );
utm.fire();
newId = utm.getIdNumber();
// get the data again - including the new row
getDataUserLogDataByID(rowObj.getUser_id(), null, null);
updateOrInsert = "Update";
btnSave_Setup("Save");
}
} // end of errs = 0
};//end of save button nethod
//
/** SECTION - BTNSAVE - DO INSERT or CHECK THAT ROW HASN'T CHANGED DURING EDIT AND IF OKAY DO UPDATE */
//
/** Description - Method used to create rowObj and newRowObj
* rowObj - contains all data before edits
* newRowObj - contains all data after edits
* Comparing the two lets us determinte what changed.
* Also contains getters and settsrs for all fields
*/
public class dataObj implements Cloneable {
int tmpInt = 0;
String tmpString = "";
// HSQL sometimes puts true/false in default value for numbers -these are overwritten
private int user_id = 0;
private String firstName = "''";
private String middleName = "";
private String lastname = "''";
private String login_name = "''";
private String partTime = "PartTime";
private String address1 = "''";
private String address2 = "''";
private String city = "";
private String state = "";
private String zip = "";
private String email = "";
private String officephone = UserLogDataRb.getString("telephone_default");
private String homePhone = UserLogDataRb.getString("telephone_default");
private double hireAge = 0.0;
private String userphotoUrl = "";
private String resumeUrl = "";
private String title = "";
private String gender = "";
private String department = "''";
private String authorityGroup1 = "";
private String authorityGroup2 = "";
private String dtStart_DateText = "";
private String wp_path = "";
private String brow_path = "";
private String ipaddress = "000.000.000.000";
private double category = 0.0;
private String ssn = "000-00-0000";
private String loginTime = "";
private String logfld = "";
private String ipAdds = "";
private int logon_count = 0;
private String userLock = "";
private int table_Updt = 0;
private String mach_name = "''";
private String dtXml_DtTimeText = "";
private String txtXml_DtTimeTime = "";
private String dtXml_DateText = "";
private String dtLastchangeddateText = "";
private String txtLastchangeddateTime = "";
private String lastchangedby = "";
private int screen0 = 7;
private int screen1 = 7;
private int screen2 = 7;
private int screen3 = 7;
private int screen4 = 7;
private int screen5 = 7;
private int screen6 = 7;
private int screen7 = 7;
private int screen8 = 7;
private int screen9 = 7;
private int screen10 = 7;
private String dtViewhistory_dttimeText = "";
private String txtViewhistory_dttimeTime = "";
private String password = "''";
private String inactive = "false" ;
private String dtLastLogonText = "";
private String txtLastLogonTime = "";
private String dtFirstlogonText = "";
private String txtFirstlogonTime = "";
private String notes = "";
private String skillAdmin = "";
private String skillResearch = "";
private String skillTyping = "";
private String skillComputer = "";
private String query_Classname = "";
private String query_template = "";
private int query_ColCount = 0;
private String query_Text = "";
private String query_Type = "";
private String query_Name = "";
private String query_Username = "";
void setUser_id(int ii){
this.user_id = ii;
}
int getUser_id(){
return this.user_id;
}
void setFirstName(String str){
this.firstName = str;
}
String getFirstName(){
return this.firstName;
}
void setMiddleName(String str){
this.middleName = str;
}
String getMiddleName(){
return this.middleName;
}
void setLastname(String str){
this.lastname = str;
}
String getLastname(){
return this.lastname;
}
void setLogin_name(String str){
this.login_name = str;
}
String getLogin_name(){
return this.login_name;
}
void setPartTime(String str){
this.partTime = str;
}
String getPartTime(){
return this.partTime;
}
void setAddress1(String str){
this.address1 = str;
}
String getAddress1(){
return this.address1;
}
void setAddress2(String str){
this.address2 = str;
}
String getAddress2(){
return this.address2;
}
void setCity(String str){
this.city = str;
}
String getCity(){
return this.city;
}
void setState(String str){
this.state = str;
}
String getState(){
return this.state;
}
void setZip(String str){
this.zip = str;
}
String getZip(){
return this.zip;
}
void setEmail(String str){
this.email = str;
}
String getEmail(){
return this.email;
}
void setOfficephone(String str){
this.officephone = str;
}
String getOfficephone(){
return this.officephone;
}
void setHomePhone(String str){
this.homePhone = str;
}
String getHomePhone(){
return this.homePhone;
}
void setHireAge(double dbl){
this.hireAge = dbl;
}
double getHireAge(){
return this.hireAge;
}
void setUserphotoUrl(String str){
this.userphotoUrl = str;
}
String getUserphotoUrl(){
return this.userphotoUrl;
}
void setResumeUrl(String str){
this.resumeUrl = str;
}
String getResumeUrl(){
return this.resumeUrl;
}
void setTitle(String str){
this.title = str;
}
String getTitle(){
return this.title;
}
void setGender(String str){
this.gender = str;
}
String getGender(){
return this.gender;
}
void setDepartment(String str){
this.department = str;
}
String getDepartment(){
return this.department;
}
void setAuthorityGroup1(String str){
this.authorityGroup1 = str;
}
String getAuthorityGroup1(){
return this.authorityGroup1;
}
void setAuthorityGroup2(String str){
this.authorityGroup2 = str;
}
String getAuthorityGroup2(){
return this.authorityGroup2;
}
void setDtStart_DateText(String dt){
this.dtStart_DateText = dt;
}
String getDtStart_DateText(){
return this.dtStart_DateText;
}
void setWp_path(String str){
this.wp_path = str;
}
String getWp_path(){
return this.wp_path;
}
void setBrow_path(String str){
this.brow_path = str;
}
String getBrow_path(){
return this.brow_path;
}
void setIpaddress(String str){
this.ipaddress = str;
}
String getIpaddress(){
return this.ipaddress;
}
void setCategory(double dbl){
this.category = dbl;
}
double getCategory(){
return this.category;
}
void setSsn(String str){
this.ssn = str;
}
String getSsn(){
return this.ssn;
}
void setTxtLoginTimeTime (String str){
this.loginTime = str;
}
String getTxtLoginTimeTime (){
return this.loginTime;
}
void setLogfld(String str){
this.logfld = str;
}
String getLogfld(){
return this.logfld;
}
void setIpAdds(String str){
this.ipAdds = str;
}
String getIpAdds(){
return this.ipAdds;
}
void setLogon_count(int ii){
this.logon_count = ii;
}
int getLogon_count(){
return this.logon_count;
}
void setUserLock(String str){
this.userLock = str;
}
String getUserLock(){
return this.userLock;
}
void setTable_Updt(int ii){
this.table_Updt = ii;
}
int getTable_Updt(){
return this.table_Updt;
}
void setMach_name(String str){
this.mach_name = str;
}
String getMach_name(){
return this.mach_name;
}
void setDtXml_DtTimeText(String dt){
this.dtXml_DtTimeText = dt;
}
String getDtXml_DtTimeText(){
return this.dtXml_DtTimeText;
}
void setTxtXml_DtTimeTime(String dt){
this.txtXml_DtTimeTime = dt;
}
String getTxtXml_DtTimeTime(){
return this.txtXml_DtTimeTime;
}
void setDtXml_DateText(String dt){
this.dtXml_DateText = dt;
}
String getDtXml_DateText(){
return this.dtXml_DateText;
}
void setDtLastchangeddateText(String dt){
this.dtLastchangeddateText = dt;
}
String getDtLastchangeddateText(){
return this.dtLastchangeddateText;
}
void setTxtLastchangeddateTime(String dt){
this.txtLastchangeddateTime = dt;
}
String getTxtLastchangeddateTime(){
return this.txtLastchangeddateTime;
}
void setLastchangedby(String str){
this.lastchangedby = str;
}
String getLastchangedby(){
return this.lastchangedby;
}
void setScreen0(int ii){
this.screen0 = ii;
}
int getScreen0(){
return this.screen0;
}
void setScreen1(int ii){
this.screen1 = ii;
}
int getScreen1(){
return this.screen1;
}
void setScreen2(int ii){
this.screen2 = ii;
}
int getScreen2(){
return this.screen2;
}
void setScreen3(int ii){
this.screen3 = ii;
}
int getScreen3(){
return this.screen3;
}
void setScreen4(int ii){
this.screen4 = ii;
}
int getScreen4(){
return this.screen4;
}
void setScreen5(int ii){
this.screen5 = ii;
}
int getScreen5(){
return this.screen5;
}
void setScreen6(int ii){
this.screen6 = ii;
}
int getScreen6(){
return this.screen6;
}
void setScreen7(int ii){
this.screen7 = ii;
}
int getScreen7(){
return this.screen7;
}
void setScreen8(int ii){
this.screen8 = ii;
}
int getScreen8(){
return this.screen8;
}
void setScreen9(int ii){
this.screen9 = ii;
}
int getScreen9(){
return this.screen9;
}
void setScreen10(int ii){
this.screen10 = ii;
}
int getScreen10(){
return this.screen10;
}
void setDtViewhistory_dttimeText(String dt){
this.dtViewhistory_dttimeText = dt;
}
String getDtViewhistory_dttimeText(){
return this.dtViewhistory_dttimeText;
}
void setTxtViewhistory_dttimeTime(String dt){
this.txtViewhistory_dttimeTime = dt;
}
String getTxtViewhistory_dttimeTime(){
return this.txtViewhistory_dttimeTime;
}
void setPassword(String str){
this.password = str;
}
String getPassword(){
return this.password;
}
void setInactive(String str){
this.inactive = str;
}
String getInactive(){
return this.inactive;
}
void setDtLastLogonText(String dt){
this.dtLastLogonText = dt;
}
String getDtLastLogonText(){
return this.dtLastLogonText;
}
void setTxtLastLogonTime(String dt){
this.txtLastLogonTime = dt;
}
String getTxtLastLogonTime(){
return this.txtLastLogonTime;
}
void setDtFirstlogonText(String dt){
this.dtFirstlogonText = dt;
}
String getDtFirstlogonText(){
return this.dtFirstlogonText;
}
void setTxtFirstlogonTime(String dt){
this.txtFirstlogonTime = dt;
}
String getTxtFirstlogonTime(){
return this.txtFirstlogonTime;
}
void setNotes(String str){
this.notes = str;
}
String getNotes(){
return this.notes;
}
void setSkillAdmin(String str){
this.skillAdmin = str;
}
String getSkillAdmin(){
return this.skillAdmin;
}
void setSkillResearch(String str){
this.skillResearch = str;
}
String getSkillResearch(){
return this.skillResearch;
}
void setSkillTyping(String str){
this.skillTyping = str;
}
String getSkillTyping(){
return this.skillTyping;
}
void setSkillComputer(String str){
this.skillComputer = str;
}
String getSkillComputer(){
return this.skillComputer;
}
void setQuery_Classname(String str){
this.query_Classname = str;
}
String getQuery_Classname(){
return this.query_Classname;
}
void setQuery_template(String str){
this.query_template = str;
}
String getQuery_template(){
return this.query_template;
}
void setQuery_ColCount(int ii){
this.query_ColCount = ii;
}
int getQuery_ColCount(){
return this.query_ColCount;
}
void setQuery_Text(String str){
this.query_Text = str;
}
String getQuery_Text(){
return this.query_Text;
}
void setQuery_Type(String str){
this.query_Type = str;
}
String getQuery_Type(){
return this.query_Type;
}
void setQuery_Name(String str){
this.query_Name = str;
}
String getQuery_Name(){
return this.query_Name;
}
void setQuery_Username(String str){
this.query_Username = str;
}
String getQuery_Username(){
return this.query_Username;
}
public Object clone() {
return this;
}
}
/*
Description Mouse Listener attached to jTable Column Headers (was in sorter class)
*/
public void addMouseListenerToHeaderInTable(JTable table,com.halepringle.standard.JxFrame jfram, JPanel thispanel,com.halepringle.standard.Model mod,int tablecolumncount) {
final JTable tableView = table;
final com.halepringle.standard.JxFrame myFrame = jfram;
final JPanel thisPanel = thispanel;
final com.halepringle.standard.Model model = mod;
tableView.setColumnSelectionAllowed(false);
int tabelColumnCount = tablecolumncount;
MouseAdapter listMouseListener = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
TableColumnModel columnModel = tableView.getColumnModel();
// which column (counting left to right)?
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
// which original column (before drag and drop) is not in positiong X?
int column = tableView.convertColumnIndexToModel(viewColumn);
String columnName = tableView.getColumnName(viewColumn);
columnName = columnNames[column];
System.out.println("Column Clicked on = "+ columnName);
String currDir = "A";
setCurrOrderByColumn(columnName);
if (e.getClickCount() == 1 && column != -1) {
// int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
//CODE added to make one click on the header descending
// and the next ascending - added by Hale Pringle 2/2003
if (currDirection == null) {
int colCount = tableColumnCount;
currDirection = new String[colCount];
for (int i = 0; i < colCount; i++){
currDirection[i] = "D";}
}
if (currDirection[column].equals("D")){
currDirection[column] = "A";
currDir = "A";
}else{
currDirection[column] = "D";
currDir = "D";
}
//NOTE: Changing the cursor does NOT work yet in sorter it is too far down. I'm letting it go for now. Works here
if (myFrame != null){
com.halepringle.standard.CursorToolkitTwo.startWaitCursor(myFrame.getRootPane());
tableView.setCursor( new Cursor(Cursor.WAIT_CURSOR));
} else {
}
user_id.setValue(0);
getDataUserLogDataByID( user_id.getValue(),currentQuery,currDir, "YES");
tableView.getModel().addTableModelListener(new
RepaintingDataListener(tableView));
tableView.getAccessibleContext().setAccessibleDescription(
model.getRbString(UserLogDataRb,"Table of UserLogData Data"," UserLogData"));
if (myFrame != null){
com.halepringle.standard.CursorToolkitTwo.stopWaitCursor(myFrame.getRootPane());
tableView.setCursor( new Cursor(Cursor.DEFAULT_CURSOR));
}
}
}
};
JTableHeader th = tableView.getTableHeader();
th.addMouseListener(listMouseListener);
}
public void setCurrOrderByColumn(String str){
currOrderByColumn = str;
}
public void setCurrentDirection(String[] str){
currDirection = str;
}
public String[] getCurrentDirection(){
return currDirection;
}
//
/** SECTION 20- MAIN METHOD - USED TO RUN CLASS STANDALONE - RESTORES SCREEN SIZE & PLAF TO USER PREFERENCE */
//
///** SECTION 20- MAIN METHOD - USED TO RUN CLASS STANDALONE - RESTORES SCREEN SIZE & PLAF TO USER PREFERENCE */
/**
* Description - Main method used to test the moduel
*/
public static void main(String args[]) {
boolean boolTestLowVision = false;// recommended to test
boolean boolTestSpanish = false; // recommended to test
boolean boolTestAssistive = true; // recommended to test
boolean boolTestFont = false; // not recommended - you should try to use the
// system font of the user. If you must - here it is.
if (boolTestLowVision) {
try {
UIManager.setLookAndFeel("com.halepringle.standard.LowVisionMetalLookAndFeel");
SwingUtilities.updateComponentTreeUI(paneUtm);
SwingUtilities.updateComponentTreeUI(spUtm);
String tmpText1 ="";
try {
tmpText1 = UserLogDataRb.getString("You will need to Right Click and choose LOW VISION PLAF to test");
} catch (Exception ex) {tmpText1 = "You will need to Right Click and choose LOW VISION PLAF to test";}
String tmpText2 ="";
try {
tmpText2 = UserLogDataRb.getString("TEST PLAF");
} catch (Exception ex) {tmpText2 = "TEST PLAF";}
JOptionPane.showMessageDialog(null,
tmpText1, tmpText2,
JOptionPane.ERROR_MESSAGE);
} catch (Exception exc) {
System.out.println("Failed loading Low Vision Metal Look and Feel");
exc.printStackTrace(System.out);
}
}
Locale loc;
if (boolTestSpanish) {
loc = new Locale("es"); // es for spanish se {
} else {
loc = new Locale("us"); // es for spanish
}
Locale.setDefault(loc);
UserLogDataRb = java.util.ResourceBundle.getBundle("UserLogDataRb",loc);
Font font = new Font("Times"/*#Frozen*/, Font.PLAIN, 12);
JButton fntButton = new JButton();
Font fJB = fntButton.getFont();
Font fLucida = new Font("Serif",
fJB.getStyle(),
fJB.getSize() );
if (boolTestFont) {
jFutm.setFont(fLucida);
}
com.halepringle.standard.Model mod;
com.halepringle.standard.DBMaster dbc;
mod = new com.halepringle.standard.Model();
if (boolTestFont) {
mod.propagateFont(jFutm, fLucida);
// Note: Example sets tooltips to a different font
UIManager.put("ToolTip.font",font);
// Uncomment this to see a list of all available fonts.
//String fontList[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
// for (int ii = 0; ii < fontList.length; ii++) {
// System.out.println(fontList[ii]);
// }
}
String tmpText3 ="";
try {
tmpText3 = UserLogDataRb.getString("DBMaster exited with an IO Exception");
} catch (Exception ex) {tmpText3 = "DBMaster exited with an IO Exception";}
try {
dbc = new com.halepringle.standard.DBMaster(mod);
}
catch (IOException excp) {System.out.println(tmpText3);};
try {Thread.sleep(3500);} catch (Exception excp) {};
String user = mod.getUser();
logger = mod.getLogger();
logger.info("UserLogData Started by: " + user);
// uld.setLocale(loc);
// NOTE: by leaving this in, your users will be able to scroll to see all of the
// screen if they are using a very small screen size (640 x 480 or less for example)
// or if they are using a very large default font size (like the LowVisionMetalLookAndFeel)
// JxFrame Setup - size and location on screen
// XXXX NOTEs about copying portions of this main method to your menu in order to call this JPanel
// 1. You will need to uncomment the next four static declaration and
// put them in the main declaration section of your application.
// The jFutm needs to be globally visible so that the WindowListener
// can null it out when it closes
// 2. You can start from here and copy everything down to // **** end copy here ****
// static public com.halepringle.standard.JxFrame jFutm= new com.halepringle.standard.JxFrame();
// static JPanel paneUtm;
// static JScrollPane spUtm;
// static Preferences UserLogDataPrefs;
// The following should already be there. It must appear once.
// static Preferences JGuiGenPrefs;
// The following should already be there. It pops up a screen to test for assistive helps
// boolean boolTestAssistive = true; // recommended to test
// JPanel setup starts here
// If you want this panel to edit one Row, call the panel with that ID
// Calling it with an ID = 0 (the default) tells it to obtain all rows
// obtain the current default PLAF
LookAndFeel oldLF = UIManager.getLookAndFeel();
// Set the PLAF the user existed with last time
JGuiGenPrefs = Preferences.systemNodeForPackage(com.halepringle.src.UserLogData.class);
String tmpLF = oldLF.getClass().toString();
// System.out.println("Default PLAF = "+tmpLF);
tmpLF = JGuiGenPrefs.get("Look and Feel", tmpLF.trim());
tmpLF = tmpLF.substring(tmpLF.indexOf(" "));
// System.out.println("Tried to install PLAF = "+tmpLF.trim());
// Set the PLAF to the PLAF the user set last time (or the default)
try {
UIManager.setLookAndFeel(tmpLF.trim());
} catch (Exception ex) {
System.out.println("Set Look and Feel Failed");}
com.halepringle.standard.MutableInteger tableId = new com.halepringle.standard.MutableInteger(0);
//
// THIS IS THE MAIN CALL TO THE APPLICATION
//
if (jFutm == null) {
jFutm= new com.halepringle.standard.JxFrame();
}
jFutm.setContentPane( spUtm = new JScrollPane(
paneUtm = new com.halepringle.src.UserLogData(jFutm, mod, tableId),
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED
)
);
// set width dynamically based upon screen size
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
int w = screenSize.width ;
int h = screenSize.height ;
UserLogDataPrefs = Preferences.userNodeForPackage(com.halepringle.src.UserLogData.class);
int jFWidth = UserLogDataPrefs.getInt("SCREEN_WIDTH", w/2);
// System.out.println("Read Screen_Width = " + jFWidth);
int jFHeight= UserLogDataPrefs.getInt("SCREEN_HEIGHT", 3000);
// System.out.println("Read Screen_Height = " + jFHeight);
// for testing force to 3000 - this gives us room to scroll
// XXXXOnce you have modified the buildLayout() method to stay within one screen, you can
// modify this to a more reasonable height
jFHeight = 3000;
paneUtm.setSize(jFWidth,jFHeight);
jFutm.setSize(jFWidth,jFHeight);
w = (screenSize.width - jFutm.getWidth()) /2 ;
h = (screenSize.height - jFutm.getHeight())/2;
if (h < 0) {h = 0;}
jFWidth = UserLogDataPrefs.getInt("SCREEN_X", w);
// System.out.println("Read Screen_X = " + jFWidth);
jFHeight= UserLogDataPrefs.getInt("SCREEN_Y", h);
// System.out.println("Read Screen_Y = " + jFHeight);
jFutm.setLocation(jFWidth,jFHeight);
// Comment out the next line if you want to do this manually. Otherwise it gets the value from the GplCmsIni.xml file
boolTestAssistive = mod.getDisplayAssistiveDemo();
if (boolTestAssistive) {
new com.halepringle.standard.AssistiveExample();
}
//JxFrame Window Listener - set frame to null when done
// NOTE This is required - a listener inside the class will dispose
// of the window if it is okay to close it without losing data
jFutm.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
jFutm.setVisible(true);
/**
* Listener to nullify jFutm when it closes
*/
jFutm.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent evt) {
// Save this user's setting for this screen
int jFHeight = jFutm.getHeight();
// System.out.println("Saved Screen_Height = " + jFHeight);
int jFWidth = jFutm.getWidth();
// System.out.println("Saved Screen_Width = " + jFWidth);
UserLogDataPrefs.putInt("SCREEN_HEIGHT", jFHeight);
UserLogDataPrefs.putInt("SCREEN_WIDTH", jFWidth);
jFHeight = jFutm.getY();
// System.out.println("Saved Screen_Y = " + jFHeight);
jFWidth = jFutm.getX();
// System.out.println("Saved Screen_X = " + jFWidth);
UserLogDataPrefs.putInt("SCREEN_X", jFWidth);
UserLogDataPrefs.putInt("SCREEN_Y", jFHeight);
// Save this user's setting for PLAF across the entire Application
LookAndFeel oldLF = UIManager.getLookAndFeel();
String tmpLF = oldLF.getClass().toString();
// System.out.println("PLAF saved = " + tmpLF);
JGuiGenPrefs.put("Look and Feel", tmpLF);
jFutm = new com.halepringle.standard.JxFrame();
System.out.println("Edit Panel finished and JFutm was set to NULL (i.e. removed from memory)");
logger.info("Edit Panel finished and JFutm was set to NULL (i.e. removed from memory)");
//XXXX when you copy this call to create this class
//make sure the frame name (jFutm in this case) is declared
//where it is visible to your whole program. (The window listener
//won't be able to null it out if you don't) and DELETE THE NEXT LINE.
System.exit(0);
}
});
//**** end copy here **** (Don't forget to comment out the Systtem.exit(0) - 4 lines up*/
}
}