├── src ├── com │ ├── forms │ │ ├── resources │ │ │ ├── AgentDownload.properties │ │ │ ├── AgentRequests.properties │ │ │ ├── UploadFiles.properties │ │ │ ├── UserManamgement.properties │ │ │ ├── ViewSharedFiles.properties │ │ │ ├── ProbabilityCalculations.properties │ │ │ ├── RegistrationForm.properties │ │ │ ├── SearchForm.properties │ │ │ ├── LoginForm.properties │ │ │ ├── Login.properties │ │ │ ├── ChangePassword.properties │ │ │ ├── RegisterForm.properties │ │ │ └── MainForm.properties │ │ ├── LoginForm.form │ │ ├── LoginForm.java │ │ ├── ViewSharedFiles.form │ │ ├── ChangePassword.form │ │ ├── ViewSharedFiles.java │ │ ├── UserManamgement.form │ │ ├── AgentRequests.form │ │ ├── MainForm.form │ │ ├── UserManamgement.java │ │ ├── ChangePassword.java │ │ └── AgentRequests.java │ ├── Bundle.properties │ ├── helper │ │ ├── UserSession.java │ │ ├── Constants.java │ │ ├── Application.properties │ │ ├── GetSetProperties.java │ │ ├── FileHelper.java │ │ ├── NetworkHelper.java │ │ ├── StringHelper.java │ │ └── SimpleCrypto.java │ ├── dao │ │ ├── ConnectionManager.java │ │ └── UserDAO.java │ └── model │ │ └── UserModel.java ├── Ev1.jpg ├── Readme.txt ├── Thumbs.db ├── img03.png ├── img │ ├── Thumbs.db │ ├── register.jpg │ ├── User-yellow32.png │ ├── add-to-database16.png │ └── Accept-Male-User128.png ├── login_large.jpg ├── icon_register.png ├── registration.jpg ├── ComputerNetwork.jpg └── download-upload-icons.jpg ├── WatermarkingApp.jar ├── Documentation ├── Report.pdf ├── Thumbs.db └── Presentation.pdf ├── README.md └── datadb.sql /src/com/forms/resources/AgentDownload.properties: -------------------------------------------------------------------------------- 1 | title=Data Leakage Detection 2 | -------------------------------------------------------------------------------- /src/com/forms/resources/AgentRequests.properties: -------------------------------------------------------------------------------- 1 | title=Data Leakage Detection 2 | -------------------------------------------------------------------------------- /src/com/forms/resources/UploadFiles.properties: -------------------------------------------------------------------------------- 1 | title=Data Leakage Detection 2 | -------------------------------------------------------------------------------- /src/com/forms/resources/UserManamgement.properties: -------------------------------------------------------------------------------- 1 | title=Data Leakage Detection 2 | -------------------------------------------------------------------------------- /src/com/forms/resources/ViewSharedFiles.properties: -------------------------------------------------------------------------------- 1 | title=Data Leakage Detection 2 | -------------------------------------------------------------------------------- /src/Ev1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/Ev1.jpg -------------------------------------------------------------------------------- /src/Readme.txt: -------------------------------------------------------------------------------- 1 | 1. Add Swing application framework and swing layout extension jars. 2 | 3 | -------------------------------------------------------------------------------- /src/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/Thumbs.db -------------------------------------------------------------------------------- /src/com/forms/resources/ProbabilityCalculations.properties: -------------------------------------------------------------------------------- 1 | title=Data Leakage Detection 2 | -------------------------------------------------------------------------------- /src/img03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/img03.png -------------------------------------------------------------------------------- /WatermarkingApp.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/WatermarkingApp.jar -------------------------------------------------------------------------------- /src/img/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/img/Thumbs.db -------------------------------------------------------------------------------- /src/login_large.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/login_large.jpg -------------------------------------------------------------------------------- /src/com/forms/resources/RegistrationForm.properties: -------------------------------------------------------------------------------- 1 | #NOI18N 2 | RegistrationFormFont=Verdana-Plain-12 3 | -------------------------------------------------------------------------------- /src/icon_register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/icon_register.png -------------------------------------------------------------------------------- /src/img/register.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/img/register.jpg -------------------------------------------------------------------------------- /src/registration.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/registration.jpg -------------------------------------------------------------------------------- /Documentation/Report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/Documentation/Report.pdf -------------------------------------------------------------------------------- /Documentation/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/Documentation/Thumbs.db -------------------------------------------------------------------------------- /src/ComputerNetwork.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/ComputerNetwork.jpg -------------------------------------------------------------------------------- /src/img/User-yellow32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/img/User-yellow32.png -------------------------------------------------------------------------------- /src/download-upload-icons.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/download-upload-icons.jpg -------------------------------------------------------------------------------- /src/img/add-to-database16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/img/add-to-database16.png -------------------------------------------------------------------------------- /Documentation/Presentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/Documentation/Presentation.pdf -------------------------------------------------------------------------------- /src/img/Accept-Male-User128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronakm/Data-Leakage-Detection/HEAD/src/img/Accept-Male-User128.png -------------------------------------------------------------------------------- /src/com/Bundle.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | 4 | -------------------------------------------------------------------------------- /src/com/forms/resources/SearchForm.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | 4 | title=Search Files 5 | 6 | -------------------------------------------------------------------------------- /src/com/forms/resources/LoginForm.properties: -------------------------------------------------------------------------------- 1 | jPanel2.AccessibleContext.accessibleName=Login Details 2 | jPanel2.AccessibleContext.accessibleDescription=Login Details 3 | title=Data Leakage Detection System 4 | jButton1.text=Register 5 | -------------------------------------------------------------------------------- /src/com/forms/resources/Login.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | 4 | title=Login Form 5 | toolTipText= 6 | jPanel2.border.title=Login Details 7 | uploadAction.Action.text= 8 | uploadAction.Action.shortDescription= 9 | -------------------------------------------------------------------------------- /src/com/helper/UserSession.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.helper; 7 | 8 | import com.model.UserModel; 9 | 10 | /** 11 | * 12 | * @author Admin 13 | */ 14 | public class UserSession { 15 | public static UserModel loggedInUser; 16 | } 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Data-Leakage-Detection 2 | 3 | Implemented Data allocation strategies that improve the probability of identifying leakages. 4 | Application can detect agent when the distributor’s sensitive data has been leaked by agents. 5 | Developed unobtrusive techniques for detecting leakage of a set of objects or records 6 | Developed a model for assessing the “guilt” of agents. 7 | -------------------------------------------------------------------------------- /src/com/forms/resources/ChangePassword.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | 4 | jPanel2.toolTipText= 5 | jPanel2.AccessibleContext.accessibleName=Login Details 6 | jPanel2.AccessibleContext.accessibleDescription=Login Details 7 | #NOI18N 8 | jPanel2.border.titleFont=Verdana-Plain-12 9 | title=Data Leakage Detection System 10 | jButton1.text=Close 11 | -------------------------------------------------------------------------------- /src/com/helper/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.helper; 7 | 8 | /** 9 | * 10 | * @author Administrator 11 | */ 12 | public class Constants { 13 | 14 | public static final String DISTRIBUTOR_ROLL_ID="1"; 15 | public static final String AGENT_ROLL_ID="2"; 16 | public static final String ADMIN_ROLL_ID="3"; 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/com/forms/resources/RegisterForm.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | 4 | title=Registration Form 5 | AccessibleContext.accessibleName=Register Form 6 | AccessibleContext.accessibleDescription=Register Form 7 | #NOI18N 8 | font=Verdana-Plain-12 9 | jPanel2.border.title=Please fill up your details 10 | #NOI18N 11 | jPanel2.border.titleFont=Verdana-Plain-12 12 | jPanel2.AccessibleContext.accessibleName=Registration Form 13 | jPanel2.AccessibleContext.accessibleDescription=Registration Form 14 | #NOI18N 15 | jPanel2.font=Verdana-Plain-12 16 | jPanel1.border.title=Application Login Details 17 | #NOI18N 18 | jPanel1.border.titleFont=Verdana-Plain-12 19 | jLabel2.text=First Name 20 | -------------------------------------------------------------------------------- /src/com/forms/resources/MainForm.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | 4 | desktopPane.toolTipText=Data Leakage Detection 5 | #NOI18N 6 | desktopPane.font=Verdana-Plain-12 7 | desktopPane.AccessibleContext.accessibleDescription=Data Leakage Detection 8 | desktopPane.AccessibleContext.accessibleName=Data Leakage Detection 9 | desktopPane.name=mainForm 10 | jPanel1.AccessibleContext.accessibleName=Status Panel 11 | jProgressBar1.AccessibleContext.accessibleName=Progress Bar 12 | jProgressBar1.AccessibleContext.accessibleDescription=Progress Bar 13 | title=Data Leakage Detection 14 | AccessibleContext.accessibleDescription=Data Leakage Detection 15 | uploadFiles.Action.text= 16 | uploadFiles.Action.shortDescription= 17 | -------------------------------------------------------------------------------- /src/com/helper/Application.properties: -------------------------------------------------------------------------------- 1 | # To change this template, choose Tools | Templates 2 | # and open the template in the editor. 3 | 4 | 5 | 6 | 7 | 8 | db.driver=org.gjt.mm.mysql.Driver 9 | db.user= 10 | 11 | db.pwd= 12 | 13 | 14 | db.url=jdbc:mysql://localhost/datadb 15 | 16 | USER_INSERT=insert into usermaster (firstname, emailId, phoneno, branchId, yearId, division, rollNo, loginId,cpassword,lastname) values (?,?,?,?,?,?,?,?,?,?) 17 | DUPLICATE_USER_CHECK=SELECT * FROM usermaster u where u.loginId=? 18 | 19 | LOGIN_QUERY=SELECT * FROM usermaster u where u.loginId like ? and cpassword= ? and activeflag='Y' 20 | 21 | CURR_TIMESTAMP=CURRENT_TIMESTAMP 22 | 23 | SEED_KEY=DataLeakage 24 | 25 | #directory name should not contain backward slash \ 26 | UPLOAD_FILE_DIR=//localhost/a/datadb 27 | 28 | 29 | GMAIL_ID=rmakadiya@gmail.com 30 | GMAIL_PASS=rvrocks1kano1234 31 | -------------------------------------------------------------------------------- /src/com/helper/GetSetProperties.java: -------------------------------------------------------------------------------- 1 | package com.helper; 2 | 3 | import java.util.Properties; 4 | import java.util.ResourceBundle; 5 | 6 | 7 | public class GetSetProperties { 8 | 9 | public static Properties properties = new Properties(); 10 | public static String baseName = "com.helper.Application"; 11 | public static ResourceBundle rb = null; 12 | public static boolean read = false; 13 | public static long lastModified = 0; 14 | 15 | static { 16 | System.out.println("GetSetProperties.enclosing_method()"); 17 | loadBundle(); 18 | } 19 | 20 | public static void loadBundle() { 21 | rb = ResourceBundle.getBundle(baseName); 22 | } 23 | 24 | public static String getProperty(String key) { 25 | // System.out.println("GetSetProperties.p() "+rb.getKeys()); 26 | 27 | String value = rb.getString(key); 28 | if (value == null) { 29 | value = ""; 30 | } else { 31 | value = value.trim(); 32 | } 33 | return value; 34 | } 35 | 36 | public static String p(String key) { 37 | // System.out.println("GetSetProperties.p() "+rb.getKeys()); 38 | 39 | String value = rb.getString(key); 40 | if (value == null) { 41 | value = ""; 42 | } else { 43 | value = value.trim(); 44 | } 45 | return value; 46 | } 47 | 48 | public static void main(String[] args) { 49 | 50 | System.out.println("GetSetProperties.main() " + rb.getString("INDEX_DIRECTORY")); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/com/helper/FileHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.helper; 7 | 8 | import java.io.BufferedReader; 9 | import java.io.File; 10 | import java.io.FileInputStream; 11 | import java.io.FileNotFoundException; 12 | import java.io.FileOutputStream; 13 | import java.io.IOException; 14 | import java.io.InputStream; 15 | import java.io.InputStreamReader; 16 | import java.io.OutputStream; 17 | 18 | /** 19 | * 20 | * @author admin 21 | */ 22 | public class FileHelper { 23 | 24 | 25 | public static double getDirectorySize (String dirName){ 26 | double size=0; 27 | File f1 = new File(dirName) ; 28 | if(f1.isDirectory()){ 29 | File[] subFiles = f1.listFiles(); 30 | for(File file : subFiles){ 31 | if(file.isFile()){ 32 | size += file.length(); 33 | } 34 | else { 35 | size += FileHelper.getDirectorySize(file.getAbsolutePath()); 36 | } 37 | } 38 | }else{ 39 | size += f1.length(); 40 | } 41 | return size; 42 | } 43 | 44 | 45 | public static void CopyDirectory(File srcPath, File dstPath) throws FileNotFoundException, 46 | IOException{ 47 | if (srcPath.isDirectory()){ 48 | if (!dstPath.exists()){ 49 | dstPath.mkdir(); 50 | } 51 | String files[] = srcPath.list(); 52 | for(int i = 0; i < files.length; i++){ 53 | CopyDirectory(new File(srcPath, files[i]), 54 | new File(dstPath, files[i])); 55 | } 56 | } 57 | else{ 58 | InputStream in = new FileInputStream(srcPath); 59 | OutputStream out = new FileOutputStream(dstPath); 60 | byte[] buf = new byte[1024]; 61 | int len; 62 | while ((len = in.read(buf)) > 0) { 63 | out.write(buf, 0, len); 64 | } 65 | in.close(); 66 | out.close(); 67 | } 68 | } 69 | public static String getFileText(String fileName) { 70 | StringBuffer str=new StringBuffer(""); 71 | try{ 72 | BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); 73 | String strLine=""; 74 | //Read File Line By Line 75 | while ((strLine = br.readLine()) != null) { 76 | str.append(strLine); 77 | str.append('\n'); 78 | } 79 | br.close(); 80 | }catch(Exception e){ 81 | e.printStackTrace(); 82 | } 83 | return str.toString(); 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/com/helper/NetworkHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package com.helper; 6 | 7 | import java.net.InetAddress; 8 | import java.net.NetworkInterface; 9 | import java.net.SocketException; 10 | import java.net.UnknownHostException; 11 | import java.util.Collections; 12 | import java.util.Enumeration; 13 | import java.util.HashSet; 14 | import java.util.Iterator; 15 | import java.util.Set; 16 | 17 | /** 18 | * 19 | * @author Admin 20 | */ 21 | public class NetworkHelper { 22 | 23 | public static void main(String args[]) throws Exception { 24 | getMACAddress(); 25 | 26 | } 27 | 28 | public static String getLocalIpAddress() throws SocketException { 29 | final String LOOPBACK_ADDR = "127.0.0.1"; 30 | String ip = ""; 31 | Set set = new HashSet(); 32 | Enumeration nets = NetworkInterface.getNetworkInterfaces(); 33 | for (NetworkInterface netint : Collections.list(nets)) { 34 | // System.out.println("\nDisplay name : " + netint.getDisplayName()); 35 | Enumeration inetAddresses = netint.getInetAddresses(); 36 | for (InetAddress inetAddress : Collections.list(inetAddresses)) { 37 | String str = inetAddress.getHostAddress(); 38 | if (str.indexOf(":") == -1) { 39 | // System.out.println("InetAddress : " + inetAddress.getCanonicalHostName()); 40 | // System.out.println("InetAddress getHostAddress : " + inetAddress.getHostAddress()); 41 | set.add(str); 42 | } 43 | } 44 | } 45 | Iterator it = set.iterator(); 46 | while (it.hasNext()) { 47 | Object object = it.next(); 48 | if (!object.toString().equalsIgnoreCase(LOOPBACK_ADDR)) { 49 | ip = object.toString(); 50 | break; 51 | } 52 | } 53 | if (ip.length() == 0) { 54 | ip = LOOPBACK_ADDR; 55 | } 56 | System.out.println(" ip " + ip); 57 | return ip; 58 | } 59 | 60 | public static String getMACAddress(){ 61 | StringBuilder sb = new StringBuilder(); 62 | InetAddress ip; 63 | try { 64 | 65 | ip = InetAddress.getLocalHost(); 66 | System.out.println("Current IP address : " + ip.getHostAddress()); 67 | 68 | NetworkInterface network = NetworkInterface.getByInetAddress(ip); 69 | 70 | byte[] mac = network.getHardwareAddress(); 71 | 72 | System.out.print("Current MAC address : "); 73 | 74 | 75 | for (int i = 0; i < mac.length; i++) { 76 | sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "")); 77 | } 78 | System.out.println(sb.toString()); 79 | 80 | } catch (UnknownHostException e) { 81 | 82 | e.printStackTrace(); 83 | 84 | } catch (SocketException e){ 85 | 86 | e.printStackTrace(); 87 | 88 | } 89 | return sb.toString(); 90 | 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/com/helper/StringHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Created on Dec 27, 2008 3 | * 4 | * To change the template for this generated file go to 5 | * Window>Preferences>Java>Code Generation>Code and Comments 6 | */ 7 | package com.helper; 8 | 9 | import java.text.CharacterIterator; 10 | import java.text.ParseException; 11 | import java.text.SimpleDateFormat; 12 | import java.text.StringCharacterIterator; 13 | import java.util.Date; 14 | import java.util.StringTokenizer; 15 | import java.util.logging.Level; 16 | import java.util.logging.Logger; 17 | 18 | /** 19 | * @author user 20 | * 21 | * To change the template for this generated type comment go to 22 | * Window>Preferences>Java>Code Generation>Code and Comments 23 | */ 24 | public class StringHelper { 25 | 26 | public static String[] stringSplit(String target,String delim){ 27 | String[] ret=new String[255]; 28 | int index=-1; 29 | StringTokenizer st = new StringTokenizer(target,delim); 30 | while(st.hasMoreTokens()){ 31 | String obj=st.nextToken(); 32 | if(obj.indexOf("\"")!=-1) 33 | obj=obj.substring(1,obj.lastIndexOf("\"")); 34 | ret[++index]=obj; 35 | } 36 | String[] ret1 = new String[index+1]; 37 | for(int i=0;i<=index;i++){ 38 | ret1[i]=ret[i]; 39 | } 40 | return ret1; 41 | 42 | } 43 | public static String emptyToStringNull(String d){ 44 | String ret = d; 45 | if(ret.equals("")){ 46 | ret = "NULL"; 47 | } 48 | return ret; 49 | } 50 | 51 | public static String toSentenceCase(String s){ 52 | String s2 = ""; 53 | s2 += Character.toUpperCase(s.charAt(0)); 54 | for (int i = 1; i < s.length(); i++) { 55 | if (Character.isUpperCase(s.charAt(i))) { 56 | s2 += Character.toLowerCase(s.charAt(i)); 57 | } else { 58 | s2 += s.charAt(i); 59 | } 60 | } 61 | return s2; 62 | } 63 | 64 | 65 | 66 | public static String nullToStringEmpty(String d){ 67 | String ret = d; 68 | if(ret==null){ 69 | ret = ""; 70 | } 71 | 72 | return ret; 73 | } 74 | public static String nullObjectToStringEmpty(Object d){ 75 | String dual=""; 76 | if(d==null){ 77 | dual = ""; 78 | } 79 | else 80 | dual=d.toString().trim(); 81 | 82 | return dual; 83 | } 84 | public static int nullObjectToIntegerEmpty(Object d){ 85 | int i=0; 86 | if(d!=null){ 87 | String dual=d.toString().trim(); 88 | try{ 89 | i=new Integer(dual).intValue(); 90 | }catch (Exception e) { 91 | System.out.println("Unable to find integer value"); 92 | } 93 | } 94 | return i; 95 | } 96 | public static void main(String[] args) { 97 | System.out.println(usualRound(new Float("2.0").floatValue())); 98 | 99 | } 100 | public static float usualRound(float f) { 101 | try{ 102 | String flo = (f+"").substring(0,(f+"").indexOf(".")+3); 103 | f = new Float(flo).floatValue(); 104 | }catch (Exception e) {} 105 | float result = ((float)((int)(100*f)))/100; 106 | System.out.println(100*f); 107 | if ( ((int)(1000 * f) % 10) < 5 ) 108 | return result; 109 | return (result + 0.01f); 110 | } 111 | public static String CovertIdAry2String(int[] id_array){ 112 | if(id_array!=null){ 113 | String inStr = ""; 114 | for(int i=0; i>4)&0x0f)).append(HEX.charAt(b&0x0f)); 119 | } 120 | public static void main(String[] args) { 121 | try { 122 | // System.out.println(new SimpleCrypto().encrypt("seed", "xzmAJSASJFbnvmzbxc&*Q$@^^$(*")); 123 | // System.out.println(new SimpleCrypto().encrypt("seed", "name=rajesh&password=rajesh")); 124 | // System.out.println(new SimpleCrypto().decrypt("seed", "7981B379310008184B22ABB8B649BFB5811C56CAEB324F9A60D6297F7069A8A1")); 125 | // System.out.println(System.getProperty("java.io.tmpdir")); 126 | // encryptFile("Rajesh ", "F:\\write\\Picture 3.jpg", "F:\\write\\Picture 3_0.jpg"); 127 | decryptFile("rajesh ", "//192.168.0.108/a/datadb/1334345154961/Dos.dmp", "//192.168.0.108/a/datadb/1334345154961/Dos_o.dmp"); 128 | 129 | 130 | } catch (Exception e) { 131 | // TODO Auto-generated catch block 132 | e.printStackTrace(); 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/com/dao/ConnectionManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package com.dao; 6 | 7 | import java.sql.Connection; 8 | import java.sql.DriverManager; 9 | import java.sql.SQLException; 10 | import java.util.List; 11 | 12 | import org.apache.commons.dbutils.DbUtils; 13 | import org.apache.commons.dbutils.QueryRunner; 14 | import org.apache.commons.dbutils.handlers.BeanListHandler; 15 | import org.apache.commons.dbutils.handlers.MapListHandler; 16 | import com.helper.GetSetProperties; 17 | 18 | 19 | /** 20 | * 21 | * @author Admin 22 | */ 23 | public class ConnectionManager { 24 | 25 | private static Connection getDBConnection() { 26 | DbUtils.loadDriver(GetSetProperties.p("db.driver")); 27 | Connection conn = null; 28 | try { 29 | conn = DriverManager.getConnection(GetSetProperties.p("db.url"), GetSetProperties.p("db.user"), GetSetProperties.p("db.pwd")); 30 | System.out.println("Got Connection"); 31 | } catch (SQLException ex) { 32 | ex.printStackTrace(); 33 | } 34 | 35 | return conn; 36 | } 37 | 38 | 39 | 40 | 41 | private static void closeConnection(Connection conn) { 42 | try { 43 | DbUtils.closeQuietly(conn); 44 | } catch (Exception ex) { 45 | ex.printStackTrace(); 46 | } 47 | 48 | } 49 | 50 | public static void main(String args[]) throws Exception { 51 | Connection conn = getDBConnection(); 52 | 53 | // int i=executeUpdate(GetSetProperties.p("USER_INSERT"), 54 | // "rajesh","raj@gmail.com","9860923474",1,2011,"Div 1",201,"rajesh","rajesh","agrawal"); 55 | // List list=getBeanList(UserModel.class, "Select * from usermaster"); 56 | // 57 | // 58 | // System.out.println("l "+list.get(0)); 59 | // 60 | // 61 | // System.out.println(list.size()); 62 | 63 | // Connection conn=getDBConnection(); 64 | // Statement stmt=conn.createStatement(); 65 | // ResultSet rs=stmt.executeQuery("SELECT b.`branchId`, b.`branchName` FROM branch b"); 66 | //ArrayList arr=new ArrayList(); 67 | // while(rs.next()){ 68 | // String branchId=rs.getString("branchId"); 69 | // String branchDesc=rs.getString("branchName"); 70 | // System.out.println(" "+branchId+" "+branchDesc); 71 | // 72 | // HashMap hmp=new HashMap(); 73 | // hmp.put("branchId",branchId); 74 | // hmp.put("branchName", branchDesc); 75 | // arr.add(hmp); 76 | // 77 | // } 78 | 79 | 80 | // closeConnection(conn); 81 | 82 | 83 | 84 | List arr1= getMapList("SELECT * FROM userinfo "); 85 | System.out.println(" arr "+arr1.size()); 86 | System.out.println("arr "+arr1); 87 | 88 | } 89 | 90 | // public static int saveUser(UserModel um){ 91 | // int i=executeUpdate(GetSetProperties.p("USER_INSERT"), 92 | // um.getFirstname(),um.getEmailId(),um.getPhoneno(),um.getBranchId(),um.getYearId(),um.getDivision(),um.getRollNo(),um.getLoginId(),um.getCpassword(),um.getLastname()); 93 | // return i; 94 | // } 95 | 96 | public static List getBeanList(Class cls, String query) { 97 | Connection conn = null; 98 | List beans = null; 99 | try { 100 | conn = getDBConnection(); 101 | 102 | QueryRunner qRunner = new QueryRunner(); 103 | beans = (List) qRunner.query(conn, query, new BeanListHandler(cls)); 104 | 105 | } catch (SQLException e) { 106 | // handle the exception 107 | e.printStackTrace(); 108 | } finally { 109 | closeConnection(conn); 110 | } 111 | return beans; 112 | } 113 | 114 | public static List getMapList(String query) { 115 | Connection conn = null; 116 | List beans = null; 117 | try { 118 | System.out.println("query "+query); 119 | conn = getDBConnection(); 120 | 121 | QueryRunner qRunner = new QueryRunner(); 122 | beans = (List) qRunner.query(conn, query, new MapListHandler()); 123 | 124 | } catch (SQLException e) { 125 | // handle the exception 126 | e.printStackTrace(); 127 | } finally { 128 | closeConnection(conn); 129 | } 130 | return beans; 131 | } 132 | 133 | public static List getParameterizedList(String query,Object... param) { 134 | Connection conn = null; 135 | List beans = null; 136 | try { 137 | conn = getDBConnection(); 138 | 139 | QueryRunner qRunner = new QueryRunner(); 140 | beans = (List) qRunner.query(conn, query, new MapListHandler(),param); 141 | 142 | } catch (SQLException e) { 143 | // handle the exception 144 | e.printStackTrace(); 145 | } finally { 146 | closeConnection(conn); 147 | } 148 | return beans; 149 | } 150 | 151 | public static int executeUpdate(String query, Object... param) { 152 | Connection conn = null; 153 | int beans = 0; 154 | try { 155 | conn = getDBConnection(); 156 | QueryRunner qRunner = new QueryRunner(); 157 | beans = qRunner.update(conn, query, param); 158 | } catch (SQLException e) { 159 | 160 | e.printStackTrace(); 161 | } finally { 162 | closeConnection(conn); 163 | } 164 | return beans; 165 | } 166 | 167 | } 168 | -------------------------------------------------------------------------------- /src/com/model/UserModel.java: -------------------------------------------------------------------------------- 1 | package com.model; 2 | 3 | /* 4 | * To change this template, choose Tools | Templates 5 | * and open the template in the editor. 6 | */ 7 | 8 | 9 | import com.helper.GetSetProperties; 10 | import org.openide.util.Exceptions; 11 | import com.helper.SimpleCrypto; 12 | 13 | 14 | 15 | /** 16 | * 17 | * @author Admin 18 | */ 19 | public class UserModel { 20 | private String LoginId =""; 21 | private String UserPassword =""; 22 | private String UserId =""; 23 | private String FName =""; 24 | private String LName =""; 25 | private String IPAddress =""; 26 | private String CellNumber =""; 27 | private String EmailAddress =""; 28 | private String ActiveFlag =""; 29 | private String LogStatus =""; 30 | private String LogOnTime =""; 31 | private String LogOffTime =""; 32 | private String rollId=""; 33 | private String days=""; 34 | private String city=""; 35 | private String pincode=""; 36 | 37 | 38 | /** 39 | * @return the LoginId 40 | */ 41 | public String getLoginId() { 42 | return LoginId; 43 | } 44 | 45 | /** 46 | * @param LoginId the LoginId to set 47 | */ 48 | public void setLoginId(String LoginId) { 49 | 50 | this.LoginId = LoginId; 51 | } 52 | 53 | /** 54 | * @return the UserPassword 55 | */ 56 | public String getUserPassword() { 57 | return UserPassword; 58 | } 59 | 60 | /** 61 | * @param UserPassword the UserPassword to set 62 | */ 63 | public void setUserPassword(String UserPassword) { 64 | String upassword=""; 65 | try { 66 | 67 | upassword = SimpleCrypto.encrypt(GetSetProperties.getProperty("SEED_KEY"), UserPassword); 68 | } catch (Exception ex) { 69 | Exceptions.printStackTrace(ex); 70 | } 71 | 72 | this.UserPassword = upassword; 73 | } 74 | 75 | /** 76 | * @return the UserId 77 | */ 78 | public String getUserId() { 79 | return UserId; 80 | } 81 | 82 | /** 83 | * @param UserId the UserId to set 84 | */ 85 | public void setUserId(String UserId) { 86 | this.UserId = UserId; 87 | } 88 | 89 | /** 90 | * @return the FName 91 | */ 92 | public String getFName() { 93 | return FName; 94 | } 95 | 96 | /** 97 | * @param FName the FName to set 98 | */ 99 | public void setFName(String FName) { 100 | this.FName = FName; 101 | } 102 | 103 | /** 104 | * @return the LName 105 | */ 106 | public String getLName() { 107 | return LName; 108 | } 109 | 110 | /** 111 | * @param LName the LName to set 112 | */ 113 | public void setLName(String LName) { 114 | this.LName = LName; 115 | } 116 | 117 | /** 118 | * @return the IPAddress 119 | */ 120 | public String getIPAddress() { 121 | return IPAddress; 122 | } 123 | 124 | /** 125 | * @param IPAddress the IPAddress to set 126 | */ 127 | public void setIPAddress(String IPAddress) { 128 | this.IPAddress = IPAddress; 129 | } 130 | 131 | /** 132 | * @return the CellNumber 133 | */ 134 | public String getCellNumber() { 135 | return CellNumber; 136 | } 137 | 138 | /** 139 | * @param CellNumber the CellNumber to set 140 | */ 141 | public void setCellNumber(String CellNumber) { 142 | this.CellNumber = CellNumber; 143 | } 144 | 145 | /** 146 | * @return the EmailAddress 147 | */ 148 | public String getEmailAddress() { 149 | return EmailAddress; 150 | } 151 | 152 | /** 153 | * @param EmailAddress the EmailAddress to set 154 | */ 155 | public void setEmailAddress(String EmailAddress) { 156 | this.EmailAddress = EmailAddress; 157 | } 158 | 159 | /** 160 | * @return the ActiveFlag 161 | */ 162 | public String getActiveFlag() { 163 | return ActiveFlag; 164 | } 165 | 166 | /** 167 | * @param ActiveFlag the ActiveFlag to set 168 | */ 169 | public void setActiveFlag(String ActiveFlag) { 170 | this.ActiveFlag = ActiveFlag; 171 | } 172 | 173 | /** 174 | * @return the LogStatus 175 | */ 176 | public String getLogStatus() { 177 | return LogStatus; 178 | } 179 | 180 | /** 181 | * @param LogStatus the LogStatus to set 182 | */ 183 | public void setLogStatus(String LogStatus) { 184 | this.LogStatus = LogStatus; 185 | } 186 | 187 | /** 188 | * @return the LogOnTime 189 | */ 190 | public String getLogOnTime() { 191 | return LogOnTime; 192 | } 193 | 194 | /** 195 | * @param LogOnTime the LogOnTime to set 196 | */ 197 | public void setLogOnTime(String LogOnTime) { 198 | this.LogOnTime = LogOnTime; 199 | } 200 | 201 | /** 202 | * @return the LogOffTime 203 | */ 204 | public String getLogOffTime() { 205 | return LogOffTime; 206 | } 207 | 208 | /** 209 | * @param LogOffTime the LogOffTime to set 210 | */ 211 | public void setLogOffTime(String LogOffTime) { 212 | this.LogOffTime = LogOffTime; 213 | } 214 | 215 | /** 216 | * @return the rollId 217 | */ 218 | public String getRollId() { 219 | return rollId; 220 | } 221 | 222 | /** 223 | * @param rollId the rollId to set 224 | */ 225 | public void setRollId(String rollId) { 226 | this.rollId = rollId; 227 | } 228 | 229 | /** 230 | * @return the city 231 | */ 232 | public String getCity() { 233 | return city; 234 | } 235 | 236 | /** 237 | * @param city the city to set 238 | */ 239 | public void setCity(String city) { 240 | this.city = city; 241 | } 242 | 243 | /** 244 | * @return the pincode 245 | */ 246 | public String getPincode() { 247 | return pincode; 248 | } 249 | 250 | /** 251 | * @param pincode the pincode to set 252 | */ 253 | public void setPincode(String pincode) { 254 | this.pincode = pincode; 255 | } 256 | 257 | /** 258 | * @return the days 259 | */ 260 | public String getDays() { 261 | return days; 262 | } 263 | 264 | /** 265 | * @param days the days to set 266 | */ 267 | public void setDays(String days) { 268 | this.days = days; 269 | } 270 | 271 | 272 | } 273 | -------------------------------------------------------------------------------- /src/com/forms/LoginForm.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | -------------------------------------------------------------------------------- /datadb.sql: -------------------------------------------------------------------------------- 1 | -- MySQL Administrator dump 1.4 2 | -- 3 | -- ------------------------------------------------------ 4 | -- Server version 5.0.51 5 | 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | 12 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 13 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 14 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 15 | 16 | 17 | -- 18 | -- Create schema datadb 19 | -- 20 | 21 | CREATE DATABASE IF NOT EXISTS datadb; 22 | USE datadb; 23 | 24 | -- 25 | -- Definition of table `agentrequest` 26 | -- 27 | 28 | DROP TABLE IF EXISTS `agentrequest`; 29 | CREATE TABLE `agentrequest` ( 30 | `idAgentRequest` int(10) unsigned NOT NULL auto_increment, 31 | `description` varchar(45) NOT NULL, 32 | `ditributorid` int(10) unsigned NOT NULL, 33 | `udate` timestamp NOT NULL default CURRENT_TIMESTAMP, 34 | `sentFromIp` varchar(45) NOT NULL, 35 | `agentId` int(10) unsigned NOT NULL, 36 | `status` int(11) NOT NULL default '-1', 37 | PRIMARY KEY (`idAgentRequest`) 38 | ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; 39 | 40 | -- 41 | -- Dumping data for table `agentrequest` 42 | -- 43 | 44 | /*!40000 ALTER TABLE `agentrequest` DISABLE KEYS */; 45 | INSERT INTO `agentrequest` (`idAgentRequest`,`description`,`ditributorid`,`udate`,`sentFromIp`,`agentId`,`status`) VALUES 46 | (1,'Need Data for Osmanpura region',144,'2012-03-03 23:47:10','192.168.0.108',143,-1), 47 | (2,'need pune data',143,'2012-03-29 14:10:57','192.168.0.108',143,1), 48 | (3,'',145,'2012-04-13 23:29:13','90-E6-BA-BA-38-9B',143,-1), 49 | (4,'Need Data',145,'2012-04-14 00:55:00','90-E6-BA-BA-38-9B',146,-1); 50 | /*!40000 ALTER TABLE `agentrequest` ENABLE KEYS */; 51 | 52 | 53 | -- 54 | -- Definition of table `backupinfo` 55 | -- 56 | 57 | DROP TABLE IF EXISTS `backupinfo`; 58 | CREATE TABLE `backupinfo` ( 59 | `ID` int(10) unsigned NOT NULL auto_increment, 60 | `Sender` int(10) unsigned NOT NULL, 61 | `FolderPath` varchar(255) default NULL, 62 | `TotalSize` varchar(10) default NULL, 63 | `Receiver` int(10) unsigned default NULL, 64 | `SaveTimestamp` datetime default NULL, 65 | `encryptionKey` varchar(100) NOT NULL, 66 | `originalPath` varchar(255) NOT NULL, 67 | `description` varchar(255) NOT NULL, 68 | PRIMARY KEY USING BTREE (`ID`) 69 | ) ENGINE=MyISAM AUTO_INCREMENT=98 DEFAULT CHARSET=latin1; 70 | 71 | -- 72 | -- Dumping data for table `backupinfo` 73 | -- 74 | 75 | /*!40000 ALTER TABLE `backupinfo` DISABLE KEYS */; 76 | INSERT INTO `backupinfo` (`ID`,`Sender`,`FolderPath`,`TotalSize`,`Receiver`,`SaveTimestamp`,`encryptionKey`,`originalPath`,`description`) VALUES 77 | (79,143,'D:/test/PHP Brochure.dmp','1077024',143,'2012-02-24 10:47:17','DDDAB61613B70AF79BE0B459FA9F388C','PHP Brochure',''), 78 | (80,143,'D:/test/PHP Brochure.dmp','1077024',143,'2012-03-01 12:11:20','DDDAB61613B70AF79BE0B459FA9F388C','PHP Brochure',''), 79 | (81,143,'D:/test/Doc1.dmp','621600',144,'2013-03-02 10:59:17','DDDAB61613B70AF79BE0B459FA9F388C','Doc1',''), 80 | (82,143,'D:/test/carpooling.dmp','400',144,'2013-03-02 11:00:16','AD7AFACBD2E08C458A7D22CC2405DA2F','carpooling',''), 81 | (83,143,'D:/test/carpooling.dmp','400',144,'2013-03-02 11:02:19','DDDAB61613B70AF79BE0B459FA9F388C','carpooling.txt',''), 82 | (84,144,'//192.168.0.108/a/datadb/FileOrDirectory.dmp','768',143,'2012-03-03 10:43:47','DDDAB61613B70AF79BE0B459FA9F388C','FileOrDirectory.java',''), 83 | (85,144,'//192.168.0.108/a/datadb/ProgressBarExample.dmp','1424',144,'2012-03-03 11:07:04','DDDAB61613B70AF79BE0B459FA9F388C','ProgressBarExample.java',''), 84 | (86,144,'//192.168.0.108/a/datadb/DialANumber.dmp','1584',143,'2012-03-03 13:31:38','DDDAB61613B70AF79BE0B459FA9F388C','DialANumber.java','COmpany Personal Info'), 85 | (87,144,'//192.168.0.108/a/datadb/cmd.dmp','992',143,'2012-03-03 13:48:12','DDDAB61613B70AF79BE0B459FA9F388C','cmd.txt','Test Data'), 86 | (88,143,'/1330785367390/cmd.dmp','992',144,'2012-03-03 20:06:07','DDDAB61613B70AF79BE0B459FA9F388C','cmd.txt','command details'), 87 | (89,143,'/1330788910686/DialANumber.dmp','1584',144,'2012-03-03 21:05:10','DDDAB61613B70AF79BE0B459FA9F388C','DialANumber.java','sdafsdf'), 88 | (90,143,'/1330788910686/DialANumber.dmp','1584',145,'2012-03-03 21:05:10','DDDAB61613B70AF79BE0B459FA9F388C','DialANumber.java','sdafsdf'), 89 | (91,143,'/1330788996983/HashMapDemo.dmp','896',145,'2012-03-03 21:06:37','DDDAB61613B70AF79BE0B459FA9F388C','HashMapDemo.java','my document'), 90 | (92,143,'/1333023772690/Q1.dmp','6320',144,'2012-03-29 17:52:58','DDDAB61613B70AF79BE0B459FA9F388C','Q1.txt','rajesh'), 91 | (93,143,'/1334343411695/CurrencyConverter.dmp','1600',144,'2012-04-14 00:26:51','DDDAB61613B70AF79BE0B459FA9F388C','CurrencyConverter.java','my data'), 92 | (94,143,'/1334343868617/CurrencyConverter.dmp','1600',144,'2012-04-14 00:34:28','DDDAB61613B70AF79BE0B459FA9F388C','CurrencyConverter.java','my data'), 93 | (95,143,'/1334344342945/Dos.dmp','1200',144,'2012-04-14 00:42:23','DDDAB61613B70AF79BE0B459FA9F388C','Dos.java','Test data'), 94 | (96,143,'/1334345154961/Dos.dmp','1200',147,'2012-04-14 00:55:55','DDDAB61613B70AF79BE0B459FA9F388C','Dos.java','rajesh'), 95 | (97,143,'/1334345490711/TextAreaExample.dmp','512',147,'2012-04-14 01:01:30','DDDAB61613B70AF79BE0B459FA9F388C','TextAreaExample.java','rajesh'); 96 | /*!40000 ALTER TABLE `backupinfo` ENABLE KEYS */; 97 | 98 | 99 | -- 100 | -- Definition of table `roles` 101 | -- 102 | 103 | DROP TABLE IF EXISTS `roles`; 104 | CREATE TABLE `roles` ( 105 | `rollId` int(10) unsigned NOT NULL auto_increment, 106 | `rollDesc` varchar(255) NOT NULL, 107 | PRIMARY KEY (`rollId`) 108 | ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; 109 | 110 | -- 111 | -- Dumping data for table `roles` 112 | -- 113 | 114 | /*!40000 ALTER TABLE `roles` DISABLE KEYS */; 115 | INSERT INTO `roles` (`rollId`,`rollDesc`) VALUES 116 | (1,'Distributor'), 117 | (2,'Agent'), 118 | (3,'Admin'); 119 | /*!40000 ALTER TABLE `roles` ENABLE KEYS */; 120 | 121 | 122 | -- 123 | -- Definition of table `senderreceiver` 124 | -- 125 | 126 | DROP TABLE IF EXISTS `senderreceiver`; 127 | CREATE TABLE `senderreceiver` ( 128 | `Sender` int(10) unsigned NOT NULL, 129 | `Receiver` int(10) unsigned NOT NULL, 130 | `ARFlag` tinyint(3) unsigned default NULL, 131 | `RequestTimestamp` datetime NOT NULL, 132 | `ARTimestamp` datetime default NULL, 133 | `LogID` int(10) unsigned NOT NULL auto_increment, 134 | PRIMARY KEY (`LogID`) 135 | ) ENGINE=MyISAM AUTO_INCREMENT=52 DEFAULT CHARSET=latin1; 136 | 137 | -- 138 | -- Dumping data for table `senderreceiver` 139 | -- 140 | 141 | /*!40000 ALTER TABLE `senderreceiver` DISABLE KEYS */; 142 | INSERT INTO `senderreceiver` (`Sender`,`Receiver`,`ARFlag`,`RequestTimestamp`,`ARTimestamp`,`LogID`) VALUES 143 | (131,135,1,'2010-01-30 13:41:59','2010-01-30 13:42:12',51), 144 | (135,131,1,'2010-01-30 13:41:20','2010-01-30 13:41:42',50); 145 | /*!40000 ALTER TABLE `senderreceiver` ENABLE KEYS */; 146 | 147 | 148 | -- 149 | -- Definition of table `trackdownloads` 150 | -- 151 | 152 | DROP TABLE IF EXISTS `trackdownloads`; 153 | CREATE TABLE `trackdownloads` ( 154 | `idtrackdownloads` int(10) unsigned NOT NULL auto_increment, 155 | `userid` int(10) unsigned NOT NULL, 156 | `fileid` int(10) unsigned NOT NULL, 157 | `ipaddress` varchar(45) NOT NULL, 158 | `downloadtimestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, 159 | PRIMARY KEY (`idtrackdownloads`) 160 | ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; 161 | 162 | -- 163 | -- Dumping data for table `trackdownloads` 164 | -- 165 | 166 | /*!40000 ALTER TABLE `trackdownloads` DISABLE KEYS */; 167 | INSERT INTO `trackdownloads` (`idtrackdownloads`,`userid`,`fileid`,`ipaddress`,`downloadtimestamp`) VALUES 168 | (1,143,86,'192.168.0.108','2012-03-03 13:38:32'), 169 | (2,143,87,'192.168.0.108','2012-03-29 14:11:09'), 170 | (3,143,86,'90-E6-BA-BA-38-9B','2012-04-14 00:45:35'), 171 | (4,147,97,'90-E6-BA-BA-38-9B','2012-04-14 01:04:06'); 172 | /*!40000 ALTER TABLE `trackdownloads` ENABLE KEYS */; 173 | 174 | 175 | -- 176 | -- Definition of table `userinfo` 177 | -- 178 | 179 | DROP TABLE IF EXISTS `userinfo`; 180 | CREATE TABLE `userinfo` ( 181 | `LoginId` varchar(35) NOT NULL, 182 | `UserPassword` varchar(255) NOT NULL, 183 | `UserId` int(10) unsigned NOT NULL auto_increment, 184 | `FName` varchar(35) NOT NULL, 185 | `LName` varchar(35) NOT NULL, 186 | `IPAddress` varchar(30) NOT NULL, 187 | `CellNumber` varchar(15) NOT NULL, 188 | `EmailAddress` varchar(45) NOT NULL, 189 | `ActiveFlag` tinyint(1) NOT NULL default '2', 190 | `LogStatus` varchar(45) NOT NULL default '0', 191 | `LogOnTime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, 192 | `LogOffTime` timestamp NOT NULL default '0000-00-00 00:00:00', 193 | `rollId` int(10) unsigned default '1', 194 | `city` varchar(45) default NULL, 195 | `pincode` varchar(45) default NULL, 196 | `changepassword` timestamp NOT NULL default '0000-00-00 00:00:00', 197 | PRIMARY KEY (`UserId`) 198 | ) ENGINE=MyISAM AUTO_INCREMENT=148 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; 199 | 200 | -- 201 | -- Dumping data for table `userinfo` 202 | -- 203 | 204 | /*!40000 ALTER TABLE `userinfo` DISABLE KEYS */; 205 | INSERT INTO `userinfo` (`LoginId`,`UserPassword`,`UserId`,`FName`,`LName`,`IPAddress`,`CellNumber`,`EmailAddress`,`ActiveFlag`,`LogStatus`,`LogOnTime`,`LogOffTime`,`rollId`,`city`,`pincode`,`changepassword`) VALUES 206 | ('rajesh','9FECE5B695F97680C68F1FA6CA3502CD',143,'rajesh','agrawal','192.168.0.109','9860923474','mail.rajesh.agrawal@gmail.com',1,'Online','2012-04-14 03:24:59','2012-02-13 09:59:47',3,'Akola',NULL,'2012-04-14 03:24:59'), 207 | ('kaustubh','4B81685BA11CF4E5023A0DE569A86966',144,'Kaustubh','bojewar','192.168.0.109','9096356472','kau@gmail.com',1,'Online','2012-03-29 17:52:30','2012-02-13 17:14:15',2,'Aurangabad',NULL,'0000-00-00 00:00:00'), 208 | ('raj','9FECE5B695F97680C68F1FA6CA3502CD',145,'Raj1','Agrawal1','192.168.0.109','9860923474','mail.rajesh.agrawal@gmail.com',1,'Online','2012-02-13 17:14:15','2012-02-13 17:14:15',1,'Pune','431103','0000-00-00 00:00:00'), 209 | ('agent','E5BEEAB8B8A4451E319335F30EC23146',146,'agent','agent','90-E6-BA-BA-38-9B','9860923474','a@gmail.com',1,'Online','2012-04-14 03:31:55','2012-04-14 00:51:59',2,'pune','431021','2012-04-14 03:31:55'), 210 | ('agent2','B34FD244C89C0AD59E6E42A455E57254',147,'agent2','agent2','90-E6-BA-BA-38-9B','9860923474','a@gmail.com',1,'Online','2012-04-14 00:53:25','2012-04-14 00:52:31',2,'pune','431032','0000-00-00 00:00:00'); 211 | /*!40000 ALTER TABLE `userinfo` ENABLE KEYS */; 212 | 213 | 214 | 215 | 216 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 217 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 218 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 219 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 220 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 221 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 222 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 223 | -------------------------------------------------------------------------------- /src/com/forms/LoginForm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | /* 7 | * LoginForm.java 8 | * 9 | * Created on Dec 8, 2011, 10:46:36 AM 10 | */ 11 | 12 | package com.forms; 13 | 14 | import java.awt.HeadlessException; 15 | import javax.swing.JOptionPane; 16 | import org.netbeans.validation.api.Problem; 17 | import org.netbeans.validation.api.builtin.Validators; 18 | import org.netbeans.validation.api.ui.ValidationGroup; 19 | 20 | import com.dao.UserDAO; 21 | import com.helper.UserSession; 22 | import com.model.UserModel; 23 | import java.awt.event.KeyEvent; 24 | import swinghelper.OptionHelper; 25 | import swinghelper.StringHelper; 26 | 27 | /** 28 | * 29 | * @author Admin 30 | */ 31 | public class LoginForm extends javax.swing.JFrame { 32 | ValidationGroup vg; 33 | /** Creates new form LoginForm */ 34 | public LoginForm() { 35 | initComponents(); 36 | swinghelper.SwingUtilities.setScreenCenter(this); 37 | 38 | vg= validationPanel1.getValidationGroup(); 39 | //vg.add(jTextField1, ValidationStrategy.DEFAULT, null) 40 | vg.add(jTextField2, Validators.REQUIRE_NON_EMPTY_STRING, 41 | Validators.NO_WHITESPACE); 42 | 43 | vg.add(jPasswordField1, Validators.REQUIRE_NON_EMPTY_STRING, 44 | Validators.NO_WHITESPACE); 45 | 46 | } 47 | 48 | public boolean performLogin() throws HeadlessException { 49 | // TODO add your handling code here: 50 | Problem p = vg.validateAll(); 51 | String msg = ""; 52 | if (p != null) { 53 | msg = p.getMessage(); 54 | } 55 | System.out.println("msg " + msg); 56 | if (msg.length() == 0) { 57 | UserModel um = new UserModel(); 58 | um.setLoginId(jTextField2.getText()); 59 | um.setUserPassword(jPasswordField1.getText()); 60 | um = new UserDAO().CheckIDandPassword(um); 61 | if (um != null) { 62 | if(um!=null&&um.getActiveFlag().equalsIgnoreCase("2")){ 63 | JOptionPane.showMessageDialog(this, "You are blocked by administrator!!!"); 64 | return false; 65 | } 66 | 67 | 68 | UserSession.loggedInUser = um; 69 | int di=StringHelper.nullObjectToIntegerEmpty(um.getDays()); 70 | if(um.getDays()==null||di>15 ){ 71 | OptionHelper.showMessage("You are logging in for the first time. YOu need to change your password."); 72 | 73 | ChangePassword cp=new ChangePassword(); 74 | cp.setVisible(true); 75 | return false; 76 | 77 | } 78 | 79 | 80 | 81 | this.setVisible(false); 82 | new MainForm().setVisible(true); 83 | } else { 84 | if(um==null){ 85 | JOptionPane.showMessageDialog(this, "Login id or password may be incorrect !!!"); 86 | 87 | }if(um!=null&&um.getActiveFlag().equalsIgnoreCase("2")){ 88 | JOptionPane.showMessageDialog(this, "You are blocked by administrator!!!"); 89 | 90 | } 91 | return true; 92 | } 93 | } 94 | return false; 95 | } 96 | 97 | /** This method is called from within the constructor to 98 | * initialize the form. 99 | * WARNING: Do NOT modify this code. The content of this method is 100 | * always regenerated by the Form Editor. 101 | */ 102 | @SuppressWarnings("unchecked") 103 | // //GEN-BEGIN:initComponents 104 | private void initComponents() { 105 | 106 | jPanel1 = new javax.swing.JPanel(); 107 | validationPanel1 = new org.netbeans.validation.api.ui.ValidationPanel(); 108 | jLabel2 = new javax.swing.JLabel(); 109 | jTextField2 = new javax.swing.JTextField(); 110 | jLabel3 = new javax.swing.JLabel(); 111 | jPasswordField1 = new javax.swing.JPasswordField(); 112 | jButton2 = new javax.swing.JButton(); 113 | jButton1 = new javax.swing.JButton(); 114 | jLabel1 = new javax.swing.JLabel(); 115 | jLabel5 = new javax.swing.JLabel(); 116 | 117 | jPanel1.setName("jPanel1"); // NOI18N 118 | 119 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); 120 | jPanel1.setLayout(jPanel1Layout); 121 | jPanel1Layout.setHorizontalGroup( 122 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 123 | .addGap(0, 100, Short.MAX_VALUE) 124 | ); 125 | jPanel1Layout.setVerticalGroup( 126 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 127 | .addGap(0, 100, Short.MAX_VALUE) 128 | ); 129 | 130 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 131 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(LoginForm.class); 132 | setTitle(resourceMap.getString("title")); // NOI18N 133 | setMinimumSize(new java.awt.Dimension(440, 214)); 134 | setResizable(false); 135 | getContentPane().setLayout(null); 136 | 137 | validationPanel1.setBackground(java.awt.SystemColor.window); 138 | validationPanel1.setName("validationPanel1"); // NOI18N 139 | getContentPane().add(validationPanel1); 140 | validationPanel1.setBounds(120, 180, 278, 30); 141 | 142 | jLabel2.setFont(new java.awt.Font("Lucida Sans", 1, 14)); 143 | jLabel2.setText("Login Name"); 144 | jLabel2.setName("jLabel2"); // NOI18N 145 | getContentPane().add(jLabel2); 146 | jLabel2.setBounds(100, 60, 94, 27); 147 | 148 | jTextField2.setName("Login Name"); // NOI18N 149 | getContentPane().add(jTextField2); 150 | jTextField2.setBounds(210, 70, 101, 20); 151 | 152 | jLabel3.setFont(new java.awt.Font("Lucida Sans", 1, 14)); 153 | jLabel3.setText("Password"); 154 | jLabel3.setName("jLabel3"); // NOI18N 155 | getContentPane().add(jLabel3); 156 | jLabel3.setBounds(100, 100, 94, 27); 157 | 158 | jPasswordField1.setName("Password "); // NOI18N 159 | jPasswordField1.addKeyListener(new java.awt.event.KeyAdapter() { 160 | public void keyPressed(java.awt.event.KeyEvent evt) { 161 | jPasswordField1KeyPressed(evt); 162 | } 163 | public void keyTyped(java.awt.event.KeyEvent evt) { 164 | jPasswordField1KeyTyped(evt); 165 | } 166 | }); 167 | getContentPane().add(jPasswordField1); 168 | jPasswordField1.setBounds(210, 110, 101, 20); 169 | 170 | jButton2.setFont(new java.awt.Font("Verdana", 0, 12)); 171 | jButton2.setText("Login"); 172 | jButton2.setName("jButton2"); // NOI18N 173 | jButton2.addActionListener(new java.awt.event.ActionListener() { 174 | public void actionPerformed(java.awt.event.ActionEvent evt) { 175 | jButton2ActionPerformed(evt); 176 | } 177 | }); 178 | getContentPane().add(jButton2); 179 | jButton2.setBounds(170, 140, 69, 25); 180 | 181 | jButton1.setFont(new java.awt.Font("Verdana", 0, 12)); 182 | jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N 183 | jButton1.setName("jButton1"); // NOI18N 184 | jButton1.addActionListener(new java.awt.event.ActionListener() { 185 | public void actionPerformed(java.awt.event.ActionEvent evt) { 186 | jButton1ActionPerformed(evt); 187 | } 188 | }); 189 | getContentPane().add(jButton1); 190 | jButton1.setBounds(250, 140, 87, 25); 191 | 192 | jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/login_large.jpg"))); // NOI18N 193 | jLabel1.setName("jLabel1"); // NOI18N 194 | getContentPane().add(jLabel1); 195 | jLabel1.setBounds(0, 0, 440, 220); 196 | 197 | jLabel5.setFont(new java.awt.Font("Lucida Sans", 1, 14)); 198 | jLabel5.setText("Login Name"); 199 | jLabel5.setName("jLabel5"); // NOI18N 200 | getContentPane().add(jLabel5); 201 | jLabel5.setBounds(100, 60, 94, 27); 202 | 203 | pack(); 204 | }// //GEN-END:initComponents 205 | 206 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed 207 | performLogin(); 208 | jButton2.setEnabled(true); 209 | 210 | }//GEN-LAST:event_jButton2ActionPerformed 211 | 212 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed 213 | // TODO add your handling code here: 214 | 215 | java.awt.EventQueue.invokeLater(new Runnable() { 216 | public void run() { 217 | 218 | new RegistrationForm().setVisible(true); 219 | 220 | 221 | } 222 | }); 223 | 224 | }//GEN-LAST:event_jButton1ActionPerformed 225 | 226 | private void jPasswordField1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jPasswordField1KeyTyped 227 | // TODO add your handling code here: 228 | 229 | 230 | 231 | }//GEN-LAST:event_jPasswordField1KeyTyped 232 | 233 | private void jPasswordField1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jPasswordField1KeyPressed 234 | // TODO add your handling code here: 235 | System.out.println(" evt.getKeyCode() "+evt.getKeyCode()); 236 | if(evt.getKeyCode()==KeyEvent.VK_ENTER){ 237 | performLogin(); 238 | } 239 | }//GEN-LAST:event_jPasswordField1KeyPressed 240 | 241 | /** 242 | * @param args the command line arguments 243 | */ 244 | public static void main(String args[]) { 245 | java.awt.EventQueue.invokeLater(new Runnable() { 246 | public void run() { 247 | 248 | // UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); 249 | // UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); 250 | // UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); 251 | 252 | // swinghelper.SwingUtilities.applyLiquidtheme(); 253 | new LoginForm().setVisible(true); 254 | 255 | 256 | } 257 | }); 258 | } 259 | 260 | // Variables declaration - do not modify//GEN-BEGIN:variables 261 | private javax.swing.JButton jButton1; 262 | private javax.swing.JButton jButton2; 263 | private javax.swing.JLabel jLabel1; 264 | private javax.swing.JLabel jLabel2; 265 | private javax.swing.JLabel jLabel3; 266 | private javax.swing.JLabel jLabel5; 267 | private javax.swing.JPanel jPanel1; 268 | private javax.swing.JPasswordField jPasswordField1; 269 | private javax.swing.JTextField jTextField2; 270 | private org.netbeans.validation.api.ui.ValidationPanel validationPanel1; 271 | // End of variables declaration//GEN-END:variables 272 | 273 | } 274 | -------------------------------------------------------------------------------- /src/com/dao/UserDAO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package com.dao; 6 | 7 | import com.helper.Constants; 8 | import java.util.List; 9 | 10 | 11 | import com.helper.GetSetProperties; 12 | import com.helper.NetworkHelper; 13 | import com.helper.SimpleCrypto; 14 | import com.helper.StringHelper; 15 | import com.helper.UserSession; 16 | import com.model.UserModel; 17 | import java.util.HashMap; 18 | import javax.swing.JTable; 19 | import javax.swing.table.DefaultTableModel; 20 | import swinghelper.OptionHelper; 21 | 22 | /** 23 | * 24 | * @author admin 25 | */ 26 | public class UserDAO { 27 | 28 | //add user details in userinfo : RegistrationForm.java 29 | public boolean AddUser(String loginID, String password, int userID, String firstName, String lastName, long cellNo, String emailId, String city, String pincode) { 30 | // String ipAddrStr = LoginForm.userInfo.getIpAddrStr(); 31 | String ipAddrStr = ""; 32 | 33 | ipAddrStr = NetworkHelper.getMACAddress(); 34 | 35 | String query = "insert into userinfo (`LoginId`, `UserPassword`, `FName`, `LName`, `IPAddress`, `CellNumber`, `EmailAddress`, `ActiveFlag`, `LogStatus`, `LogOnTime`, `LogOffTime`,`city`,`pincode` )" + " values ('" + loginID + "','" + password + "','" + firstName + "','" + lastName + "','" + ipAddrStr + "','" + cellNo + "','" + emailId + "',1,'Online'," + GetSetProperties.getProperty("CURR_TIMESTAMP") + ",null,'" + city + "','" + pincode + "')"; 36 | System.out.println(" query " + query); 37 | // new UserDAOHelper().executeInsert(query); 38 | int i = ConnectionManager.executeUpdate(query, null); 39 | boolean success = false; 40 | if (i > 0) { 41 | success = true; 42 | } 43 | 44 | return success; 45 | } 46 | 47 | public boolean addTrackDownload(String fileId) { 48 | // String ipAddrStr = LoginForm.userInfo.getIpAddrStr(); 49 | String ipAddrStr = ""; 50 | try { 51 | ipAddrStr = NetworkHelper.getMACAddress(); 52 | } catch (Exception ex) { 53 | ex.printStackTrace(); 54 | ; 55 | } 56 | if (UserSession.loggedInUser == null) { 57 | OptionHelper.showError("Please login.", "Error"); 58 | return false; 59 | } 60 | String query = "insert into trackdownloads (`userid`, `fileid`, `ipaddress`)" + "values (" + UserSession.loggedInUser.getUserId() + "," + fileId + ",'" + ipAddrStr + "')"; 61 | System.out.println(" query " + query); 62 | // new UserDAOHelper().executeInsert(query); 63 | int i = ConnectionManager.executeUpdate(query, null); 64 | boolean success = false; 65 | if (i > 0) { 66 | success = true; 67 | } 68 | 69 | return success; 70 | } 71 | public boolean addAgentRequest(String fileDesc,String distributorId) { 72 | // String ipAddrStr = LoginForm.userInfo.getIpAddrStr(); 73 | String ipAddrStr = ""; 74 | 75 | ipAddrStr = NetworkHelper.getMACAddress(); 76 | 77 | if (UserSession.loggedInUser == null) { 78 | OptionHelper.showError("Please login.", "Error"); 79 | return false; 80 | } 81 | String query = "insert into agentrequest (description, ditributorid, sentFromIp,agentId) values ('" + 82 | fileDesc + "'," + distributorId + ",'" + ipAddrStr + "',"+UserSession.loggedInUser.getUserId() +")"; 83 | System.out.println(" query " + query); 84 | // new UserDAOHelper().executeInsert(query); 85 | int i = ConnectionManager.executeUpdate(query, null); 86 | boolean success = false; 87 | if (i > 0) { 88 | success = true; 89 | } 90 | 91 | return success; 92 | } 93 | 94 | public boolean addRequest(String sender, String folderPath, String totalSize, String receiver, String encryptionKey, String originalPath, String desc) { 95 | // String ipAddrStr = LoginForm.userInfo.getIpAddrStr(); 96 | String ipAddrStr = ""; 97 | try { 98 | ipAddrStr = NetworkHelper.getMACAddress(); 99 | encryptionKey = SimpleCrypto.encrypt("DATALEAK", encryptionKey); 100 | } catch (Exception ex) { 101 | ex.printStackTrace(); 102 | ; 103 | } 104 | String query = "insert into datadb.backupinfo (Sender, FolderPath, TotalSize, Receiver,encryptionKey,originalPath,SaveTimestamp,description )" + " values (" + sender + ",'" + folderPath + "','" + totalSize + "'," + receiver + ",'" + encryptionKey + "','" + originalPath + "',NOW(),'" + desc + "')"; 105 | System.out.println(" query " + query); 106 | // new UserDAOHelper().executeInsert(query); 107 | int i = ConnectionManager.executeUpdate(query, null); 108 | boolean success = false; 109 | if (i > 0) { 110 | success = true; 111 | } 112 | 113 | return success; 114 | } 115 | 116 | public UserModel CheckIDandPassword(UserModel um) { 117 | String query = "select activeflag,UserId,FName,LName,CellNumber,EmailAddress,rollId,DATEDIFF( current_timestamp ,`changepassword`) as days from userinfo where LoginId = '" + um.getLoginId() + "' and UserPassword = '" + um.getUserPassword() + "'"; 118 | //"' and LogStatus = 'Offline'"; 119 | List list = new ConnectionManager().getBeanList(UserModel.class, query); 120 | if (list.size() > 0) { 121 | um = (UserModel) list.get(0); 122 | } else { 123 | um = null; 124 | } 125 | 126 | return um; 127 | } 128 | 129 | public List getUsers() { 130 | List list = null; 131 | if (UserSession.loggedInUser == null) { 132 | OptionHelper.showError("Please login.", "Error"); 133 | return null; 134 | } else { 135 | String query = "select * from userinfo where ActiveFlag=1 and rollId=" + Constants.AGENT_ROLL_ID + " and UserId != " + UserSession.loggedInUser.getUserId(); 136 | list = new ConnectionManager().getBeanList(UserModel.class, query); 137 | } 138 | 139 | return list; 140 | } 141 | 142 | public List getUsers(String rollId) { 143 | List list = null; 144 | if (UserSession.loggedInUser == null) { 145 | OptionHelper.showError("Please login.", "Error"); 146 | return null; 147 | } else { 148 | String query = "select * from userinfo where ActiveFlag=1 and rollId=" + rollId ; 149 | list = new ConnectionManager().getBeanList(UserModel.class, query); 150 | } 151 | return list; 152 | } 153 | 154 | public List populateFiles(JTable jtable) throws Exception { 155 | String query = "SELECT b.FolderPath, b.TotalSize, b.Receiver,date_format( b.SaveTimestamp, '%d-%b-%y %a') as st ,u.FName , u.LName FROM datadb.backupinfo b,datadb.userinfo u where u.userid=b.Receiver and b.sender =" + UserSession.loggedInUser.getUserId()+" order by b.SaveTimestamp desc"; 156 | System.out.println("query " + query); 157 | List list = new ConnectionManager().getMapList(query); 158 | ; 159 | 160 | DefaultTableModel model = new DefaultTableModel(); 161 | model = (DefaultTableModel) jtable.getModel(); 162 | while (model.getRowCount() > 0) { 163 | model.removeRow(0); 164 | } 165 | for (int i = 0; i < list.size(); i++) { 166 | HashMap param = (HashMap) list.get(i); 167 | String folderPath = StringHelper.nullObjectToStringEmpty(param.get("FolderPath")); 168 | String totalSize = StringHelper.nullObjectToStringEmpty(param.get("TotalSize")); 169 | String receiver = StringHelper.nullObjectToStringEmpty(param.get("Receiver")); 170 | String saveTimestamp = StringHelper.nullObjectToStringEmpty(param.get("st")); 171 | String fname = StringHelper.nullObjectToStringEmpty(param.get("FName")); 172 | String lname = StringHelper.nullObjectToStringEmpty(param.get("LName")); 173 | model.addRow(new Object[]{i + 1, fname + " " + lname, folderPath, totalSize, saveTimestamp}); 174 | } 175 | return list; 176 | } 177 | public List populateFileReviews(JTable jtable) throws Exception { 178 | String query = "SELECT b.FolderPath, b.TotalSize, b.Receiver,date_format( b.SaveTimestamp, '%d-%b-%y %a') as SaveTimestamp ,u.FName , u.LName FROM datadb.backupinfo b,datadb.userinfo u where u.userid=b.Receiver and b.sender =" + UserSession.loggedInUser.getUserId(); 179 | System.out.println("query " + query); 180 | List list = new ConnectionManager().getMapList(query); 181 | ; 182 | 183 | DefaultTableModel model = new DefaultTableModel(); 184 | model = (DefaultTableModel) jtable.getModel(); 185 | while (model.getRowCount() > 0) { 186 | model.removeRow(0); 187 | } 188 | for (int i = 0; i < list.size(); i++) { 189 | HashMap param = (HashMap) list.get(i); 190 | String folderPath = StringHelper.nullObjectToStringEmpty(param.get("FolderPath")); 191 | String totalSize = StringHelper.nullObjectToStringEmpty(param.get("TotalSize")); 192 | String receiver = StringHelper.nullObjectToStringEmpty(param.get("Receiver")); 193 | String saveTimestamp = StringHelper.nullObjectToStringEmpty(param.get("SaveTimestamp")); 194 | String fname = StringHelper.nullObjectToStringEmpty(param.get("FName")); 195 | String lname = StringHelper.nullObjectToStringEmpty(param.get("LName")); 196 | model.addRow(new Object[]{i + 1, fname + " " + lname, folderPath, totalSize, saveTimestamp}); 197 | } 198 | return list; 199 | } 200 | 201 | public List populateFiles2(JTable jtable) throws Exception { 202 | String query = "SELECT b.FolderPath, b.TotalSize, b.Receiver,date_format( b.SaveTimestamp, '%d-%b-%y %a') as SaveTimestamp " + 203 | ",u.FName , u.LName,originalPath ,u.`EmailAddress`, u.`CellNumber`,b.`description`,b.`ID` FROM datadb.backupinfo b,datadb.userinfo u where u.userid=b.sender and b.Receiver =" + UserSession.loggedInUser.getUserId(); 204 | System.out.println("query " + query); 205 | List list = new ConnectionManager().getMapList(query); 206 | ; 207 | 208 | DefaultTableModel model = new DefaultTableModel(); 209 | model = (DefaultTableModel) jtable.getModel(); 210 | while (model.getRowCount() > 0) { 211 | model.removeRow(0); 212 | } 213 | for (int i = 0; i < list.size(); i++) { 214 | HashMap param = (HashMap) list.get(i); 215 | String originalPath = StringHelper.nullObjectToStringEmpty(param.get("description")); 216 | String totalSize = StringHelper.nullObjectToStringEmpty(param.get("TotalSize")); 217 | String receiver = StringHelper.nullObjectToStringEmpty(param.get("Receiver")); 218 | String saveTimestamp = StringHelper.nullObjectToStringEmpty(param.get("SaveTimestamp")); 219 | String fname = StringHelper.nullObjectToStringEmpty(param.get("FName")); 220 | String lname = StringHelper.nullObjectToStringEmpty(param.get("LName")); 221 | String EmailAddress = StringHelper.nullObjectToStringEmpty(param.get("EmailAddress")); 222 | String CellNumber = StringHelper.nullObjectToStringEmpty(param.get("CellNumber")); 223 | 224 | model.addRow(new Object[]{i + 1, fname + " " + lname, EmailAddress, CellNumber, originalPath, totalSize, saveTimestamp}); 225 | } 226 | return list; 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /src/com/forms/ViewSharedFiles.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 |
212 |
213 | 214 | 215 | 216 | 217 | <Editor/> 218 | <Renderer/> 219 | </Column> 220 | <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> 221 | <Title/> 222 | <Editor/> 223 | <Renderer/> 224 | </Column> 225 | <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> 226 | <Title/> 227 | <Editor/> 228 | <Renderer/> 229 | </Column> 230 | <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> 231 | <Title/> 232 | <Editor/> 233 | <Renderer/> 234 | </Column> 235 | <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> 236 | <Title/> 237 | <Editor/> 238 | <Renderer/> 239 | </Column> 240 | </TableColumnModel> 241 | </Property> 242 | <Property name="columnSelectionAllowed" type="boolean" value="true"/> 243 | <Property name="dragEnabled" type="boolean" value="true"/> 244 | <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> 245 | <TableHeader reorderingAllowed="true" resizingAllowed="true"/> 246 | </Property> 247 | </Properties> 248 | <AuxValues> 249 | <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JTable() { public String getToolTipText(MouseEvent e) { String tip = null; java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); int colIndex = columnAtPoint(p); int realColumnIndex = convertColumnIndexToModel(colIndex); if (realColumnIndex == 1) { tip = getValueAt(rowIndex, colIndex).toString(); } return tip; } } "/> 250 | </AuxValues> 251 | </Component> 252 | </SubComponents> 253 | </Container> 254 | </SubComponents> 255 | </Container> 256 | </SubComponents> 257 | </Form> 258 | -------------------------------------------------------------------------------- /src/com/forms/ChangePassword.form: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | 3 | <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> 4 | <NonVisualComponents> 5 | <Container class="javax.swing.JPanel" name="jPanel1"> 6 | <Properties> 7 | <Property name="name" type="java.lang.String" value="jPanel1" noResource="true"/> 8 | </Properties> 9 | 10 | <Layout> 11 | <DimensionLayout dim="0"> 12 | <Group type="103" groupAlignment="0" attributes="0"> 13 | <EmptySpace min="0" pref="100" max="32767" attributes="0"/> 14 | </Group> 15 | </DimensionLayout> 16 | <DimensionLayout dim="1"> 17 | <Group type="103" groupAlignment="0" attributes="0"> 18 | <EmptySpace min="0" pref="100" max="32767" attributes="0"/> 19 | </Group> 20 | </DimensionLayout> 21 | </Layout> 22 | </Container> 23 | </NonVisualComponents> 24 | <Properties> 25 | <Property name="title" type="java.lang.String" resourceKey="title"/> 26 | </Properties> 27 | <SyntheticProperties> 28 | <SyntheticProperty name="formSizePolicy" type="int" value="1"/> 29 | </SyntheticProperties> 30 | <AuxValues> 31 | <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> 32 | <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/> 33 | <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> 34 | <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> 35 | <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> 36 | <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> 37 | <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> 38 | <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> 39 | <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> 40 | </AuxValues> 41 | 42 | <Layout> 43 | <DimensionLayout dim="0"> 44 | <Group type="103" groupAlignment="0" attributes="0"> 45 | <Group type="102" alignment="1" attributes="0"> 46 | <EmptySpace max="32767" attributes="0"/> 47 | <Component id="jPanel2" min="-2" max="-2" attributes="0"/> 48 | <EmptySpace max="-2" attributes="0"/> 49 | </Group> 50 | </Group> 51 | </DimensionLayout> 52 | <DimensionLayout dim="1"> 53 | <Group type="103" groupAlignment="0" attributes="0"> 54 | <Group type="102" alignment="0" attributes="0"> 55 | <Component id="jPanel2" max="32767" attributes="0"/> 56 | <EmptySpace max="-2" attributes="0"/> 57 | </Group> 58 | </Group> 59 | </DimensionLayout> 60 | </Layout> 61 | <SubComponents> 62 | <Container class="javax.swing.JPanel" name="jPanel2"> 63 | <Properties> 64 | <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> 65 | <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> 66 | <TitledBorder title="Change Password"> 67 | <Property name="font" resourceKey="jPanel2.border.titleFont"/> 68 | </TitledBorder> 69 | </Border> 70 | </Property> 71 | <Property name="toolTipText" type="java.lang.String" resourceKey="jPanel2.toolTipText"/> 72 | <Property name="name" type="java.lang.String" value="jPanel2" noResource="true"/> 73 | </Properties> 74 | <AccessibilityProperties> 75 | <Property name="AccessibleContext.accessibleName" type="java.lang.String" resourceKey="jPanel2.AccessibleContext.accessibleName"/> 76 | <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" resourceKey="jPanel2.AccessibleContext.accessibleDescription"/> 77 | </AccessibilityProperties> 78 | 79 | <Layout> 80 | <DimensionLayout dim="0"> 81 | <Group type="103" groupAlignment="0" attributes="0"> 82 | <Group type="102" attributes="0"> 83 | <Group type="103" groupAlignment="0" attributes="0"> 84 | <Group type="102" alignment="0" attributes="0"> 85 | <EmptySpace min="-2" pref="56" max="-2" attributes="0"/> 86 | <Component id="jButton2" min="-2" max="-2" attributes="0"/> 87 | <EmptySpace max="-2" attributes="0"/> 88 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> 89 | </Group> 90 | <Group type="102" alignment="0" attributes="0"> 91 | <EmptySpace max="-2" attributes="0"/> 92 | <Group type="103" groupAlignment="0" attributes="0"> 93 | <Group type="102" alignment="0" attributes="0"> 94 | <Component id="jLabel2" min="-2" pref="94" max="-2" attributes="0"/> 95 | <EmptySpace min="-2" pref="18" max="-2" attributes="0"/> 96 | <Component id="jPasswordField3" pref="173" max="32767" attributes="0"/> 97 | </Group> 98 | <Group type="102" alignment="0" attributes="0"> 99 | <Component id="jLabel3" min="-2" pref="94" max="-2" attributes="0"/> 100 | <EmptySpace type="separate" max="-2" attributes="0"/> 101 | <Component id="jPasswordField1" pref="173" max="32767" attributes="0"/> 102 | </Group> 103 | </Group> 104 | </Group> 105 | <Group type="102" alignment="0" attributes="0"> 106 | <EmptySpace max="-2" attributes="0"/> 107 | <Component id="jLabel4" min="-2" pref="94" max="-2" attributes="0"/> 108 | <EmptySpace type="separate" max="-2" attributes="0"/> 109 | <Component id="jPasswordField2" min="-2" pref="171" max="-2" attributes="0"/> 110 | </Group> 111 | <Group type="102" alignment="0" attributes="0"> 112 | <EmptySpace max="-2" attributes="0"/> 113 | <Component id="validationPanel1" pref="285" max="32767" attributes="0"/> 114 | </Group> 115 | </Group> 116 | <EmptySpace max="-2" attributes="0"/> 117 | </Group> 118 | </Group> 119 | </DimensionLayout> 120 | <DimensionLayout dim="1"> 121 | <Group type="103" groupAlignment="0" attributes="0"> 122 | <Group type="102" attributes="0"> 123 | <Group type="103" groupAlignment="3" attributes="0"> 124 | <Component id="jLabel2" alignment="3" min="-2" pref="27" max="-2" attributes="0"/> 125 | <Component id="jPasswordField3" alignment="3" min="-2" max="-2" attributes="0"/> 126 | </Group> 127 | <EmptySpace type="unrelated" max="-2" attributes="0"/> 128 | <Group type="103" groupAlignment="3" attributes="0"> 129 | <Component id="jLabel3" alignment="3" min="-2" pref="27" max="-2" attributes="0"/> 130 | <Component id="jPasswordField1" alignment="3" min="-2" max="-2" attributes="0"/> 131 | </Group> 132 | <EmptySpace max="-2" attributes="0"/> 133 | <Group type="103" groupAlignment="3" attributes="0"> 134 | <Component id="jLabel4" alignment="3" min="-2" pref="27" max="-2" attributes="0"/> 135 | <Component id="jPasswordField2" alignment="3" min="-2" max="-2" attributes="0"/> 136 | </Group> 137 | <EmptySpace max="-2" attributes="0"/> 138 | <Component id="validationPanel1" min="-2" pref="25" max="-2" attributes="0"/> 139 | <EmptySpace max="-2" attributes="0"/> 140 | <Group type="103" groupAlignment="3" attributes="0"> 141 | <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/> 142 | <Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/> 143 | </Group> 144 | </Group> 145 | </Group> 146 | </DimensionLayout> 147 | </Layout> 148 | <SubComponents> 149 | <Component class="javax.swing.JLabel" name="jLabel2"> 150 | <Properties> 151 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 152 | <Font name="Verdana" size="12" style="0"/> 153 | </Property> 154 | <Property name="text" type="java.lang.String" value="Old Password"/> 155 | <Property name="name" type="java.lang.String" value="jLabel2" noResource="true"/> 156 | </Properties> 157 | </Component> 158 | <Component class="javax.swing.JLabel" name="jLabel3"> 159 | <Properties> 160 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 161 | <Font name="Verdana" size="12" style="0"/> 162 | </Property> 163 | <Property name="text" type="java.lang.String" value="New Password"/> 164 | <Property name="name" type="java.lang.String" value="jLabel3" noResource="true"/> 165 | </Properties> 166 | </Component> 167 | <Component class="javax.swing.JButton" name="jButton2"> 168 | <Properties> 169 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 170 | <Font name="Verdana" size="12" style="0"/> 171 | </Property> 172 | <Property name="text" type="java.lang.String" value="Update"/> 173 | <Property name="name" type="java.lang.String" value="jButton2" noResource="true"/> 174 | </Properties> 175 | <Events> 176 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> 177 | </Events> 178 | </Component> 179 | <Component class="javax.swing.JPasswordField" name="jPasswordField1"> 180 | <Properties> 181 | <Property name="name" type="java.lang.String" value="Password " noResource="true"/> 182 | </Properties> 183 | <Events> 184 | <EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="jPasswordField1KeyPressed"/> 185 | <EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="jPasswordField1KeyTyped"/> 186 | </Events> 187 | </Component> 188 | <Component class="javax.swing.JButton" name="jButton1"> 189 | <Properties> 190 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 191 | <Font name="Verdana" size="12" style="0"/> 192 | </Property> 193 | <Property name="text" type="java.lang.String" resourceKey="jButton1.text"/> 194 | <Property name="name" type="java.lang.String" value="jButton1" noResource="true"/> 195 | </Properties> 196 | <Events> 197 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> 198 | </Events> 199 | </Component> 200 | <Component class="javax.swing.JLabel" name="jLabel4"> 201 | <Properties> 202 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 203 | <Font name="Verdana" size="12" style="0"/> 204 | </Property> 205 | <Property name="text" type="java.lang.String" value="Confirm Pass"/> 206 | <Property name="name" type="java.lang.String" value="jLabel4" noResource="true"/> 207 | </Properties> 208 | </Component> 209 | <Component class="javax.swing.JPasswordField" name="jPasswordField2"> 210 | <Properties> 211 | <Property name="name" type="java.lang.String" value="jPasswordField2" noResource="true"/> 212 | </Properties> 213 | <Events> 214 | <EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="jPasswordField2KeyPressed"/> 215 | <EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="jPasswordField2KeyTyped"/> 216 | </Events> 217 | </Component> 218 | <Component class="javax.swing.JPasswordField" name="jPasswordField3"> 219 | <Properties> 220 | <Property name="name" type="java.lang.String" value="jPasswordField3" noResource="true"/> 221 | </Properties> 222 | <Events> 223 | <EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="jPasswordField3KeyPressed"/> 224 | <EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="jPasswordField3KeyTyped"/> 225 | </Events> 226 | </Component> 227 | <Component class="org.netbeans.validation.api.ui.ValidationPanel" name="validationPanel1"> 228 | <Properties> 229 | <Property name="name" type="java.lang.String" value="validationPanel1" noResource="true"/> 230 | </Properties> 231 | </Component> 232 | </SubComponents> 233 | </Container> 234 | </SubComponents> 235 | </Form> 236 | -------------------------------------------------------------------------------- /src/com/forms/ViewSharedFiles.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | /* 7 | * BackupFolder.java 8 | * 9 | * Created on Jan 19, 2010, 11:58:41 AM 10 | */ 11 | package com.forms; 12 | 13 | import java.awt.event.MouseEvent; 14 | import java.io.File; 15 | import java.util.logging.Level; 16 | import java.util.logging.Logger; 17 | import javax.swing.JTable; 18 | import javax.swing.table.DefaultTableModel; 19 | import com.dao.UserDAO; 20 | import com.helper.GetSetProperties; 21 | import java.awt.Desktop; 22 | import java.awt.event.MouseListener; 23 | import java.io.IOException; 24 | import swinghelper.OptionHelper; 25 | 26 | 27 | /** 28 | * 29 | * @author Administrator 30 | */ 31 | public class ViewSharedFiles extends javax.swing.JInternalFrame { 32 | DefaultTableModel tm; 33 | private int WARNING_MESSAGE; 34 | // public static ArrayList arr = null, arr1 = null; 35 | MainForm jd; 36 | /** Creates new form BackupFolder */ 37 | public ViewSharedFiles() throws Exception { 38 | System.out.println("BackupFolder"); 39 | initComponents(); 40 | // swinghelper.SwingUtilities.setScreenCenter(this); 41 | UserDAO u = new UserDAO(); 42 | // u.CheckForPendingFiles(jTableDisplay); 43 | // jd=(MainForm) this.getParent().getParent(); 44 | 45 | u.populateFiles(jTableDisplay); 46 | tm = (DefaultTableModel) jTableDisplay.getModel(); 47 | jTableDisplay.addMouseListener(new MouseListener() { 48 | 49 | public void mouseClicked(MouseEvent e) { 50 | try{ 51 | int selRow = jTableDisplay.getSelectedRow(); 52 | System.out.println("Selected Row "+selRow); 53 | String filename = GetSetProperties.getProperty("UPLOAD_FILE_DIR")+ tm.getValueAt(selRow, 2).toString(); 54 | System.out.println("filename "+filename); 55 | File file = new File(filename); 56 | File parent=new File(file.getParent()); 57 | 58 | if (Desktop.isDesktopSupported() ) { 59 | 60 | if(file.exists()){ 61 | try { 62 | 63 | Desktop.getDesktop().open(parent); 64 | } catch (IOException ex) { 65 | OptionHelper.showError("Error while opening the file " + file.getAbsolutePath(), "Error"); 66 | return; 67 | } 68 | }else{ 69 | OptionHelper.showError("File does not exist - " + file.getAbsolutePath(), "Error"); 70 | return; 71 | } 72 | } else { 73 | OptionHelper.showMessage("Desktop Class is not supported by your JDK."); 74 | return; 75 | } 76 | 77 | }catch(Exception e1){ 78 | e1.printStackTrace(); 79 | } 80 | 81 | } 82 | 83 | public void mousePressed(MouseEvent e) { 84 | } 85 | 86 | public void mouseReleased(MouseEvent e) { 87 | } 88 | 89 | public void mouseEntered(MouseEvent e) { 90 | } 91 | 92 | public void mouseExited(MouseEvent e) { 93 | } 94 | }); 95 | } 96 | 97 | 98 | 99 | 100 | 101 | /** This method is called from within the constructor to 102 | * initialize the form. 103 | * WARNING: Do NOT modify this code. The content of this method is 104 | * always regenerated by the Form Editor. 105 | */ 106 | @SuppressWarnings("unchecked") 107 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 108 | private void initComponents() { 109 | 110 | jDialog1 = new javax.swing.JDialog(); 111 | jDialog2 = new javax.swing.JDialog(); 112 | jDialog3 = new javax.swing.JDialog(); 113 | jDialog4 = new javax.swing.JDialog(); 114 | jDialog5 = new javax.swing.JDialog(); 115 | jFileChooser1 = new javax.swing.JFileChooser(); 116 | jScrollPane2 = new javax.swing.JScrollPane(); 117 | jTable1 = new javax.swing.JTable(); 118 | jPanel2 = new javax.swing.JPanel(); 119 | jScrollPane1 = new javax.swing.JScrollPane(); 120 | jTableDisplay = new JTable() { 121 | 122 | public String getToolTipText(MouseEvent e) { 123 | String tip = null; 124 | java.awt.Point p = e.getPoint(); 125 | int rowIndex = rowAtPoint(p); 126 | int colIndex = columnAtPoint(p); 127 | int realColumnIndex = convertColumnIndexToModel(colIndex); 128 | 129 | if (realColumnIndex == 1) { 130 | tip = getValueAt(rowIndex, colIndex).toString(); 131 | } 132 | return tip; 133 | } 134 | } 135 | ; 136 | 137 | org.jdesktop.layout.GroupLayout jDialog1Layout = new org.jdesktop.layout.GroupLayout(jDialog1.getContentPane()); 138 | jDialog1.getContentPane().setLayout(jDialog1Layout); 139 | jDialog1Layout.setHorizontalGroup( 140 | jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 141 | .add(0, 400, Short.MAX_VALUE) 142 | ); 143 | jDialog1Layout.setVerticalGroup( 144 | jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 145 | .add(0, 300, Short.MAX_VALUE) 146 | ); 147 | 148 | org.jdesktop.layout.GroupLayout jDialog2Layout = new org.jdesktop.layout.GroupLayout(jDialog2.getContentPane()); 149 | jDialog2.getContentPane().setLayout(jDialog2Layout); 150 | jDialog2Layout.setHorizontalGroup( 151 | jDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 152 | .add(0, 400, Short.MAX_VALUE) 153 | ); 154 | jDialog2Layout.setVerticalGroup( 155 | jDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 156 | .add(0, 300, Short.MAX_VALUE) 157 | ); 158 | 159 | org.jdesktop.layout.GroupLayout jDialog3Layout = new org.jdesktop.layout.GroupLayout(jDialog3.getContentPane()); 160 | jDialog3.getContentPane().setLayout(jDialog3Layout); 161 | jDialog3Layout.setHorizontalGroup( 162 | jDialog3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 163 | .add(0, 400, Short.MAX_VALUE) 164 | ); 165 | jDialog3Layout.setVerticalGroup( 166 | jDialog3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 167 | .add(0, 300, Short.MAX_VALUE) 168 | ); 169 | 170 | org.jdesktop.layout.GroupLayout jDialog4Layout = new org.jdesktop.layout.GroupLayout(jDialog4.getContentPane()); 171 | jDialog4.getContentPane().setLayout(jDialog4Layout); 172 | jDialog4Layout.setHorizontalGroup( 173 | jDialog4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 174 | .add(0, 400, Short.MAX_VALUE) 175 | ); 176 | jDialog4Layout.setVerticalGroup( 177 | jDialog4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 178 | .add(0, 300, Short.MAX_VALUE) 179 | ); 180 | 181 | org.jdesktop.layout.GroupLayout jDialog5Layout = new org.jdesktop.layout.GroupLayout(jDialog5.getContentPane()); 182 | jDialog5.getContentPane().setLayout(jDialog5Layout); 183 | jDialog5Layout.setHorizontalGroup( 184 | jDialog5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 185 | .add(0, 400, Short.MAX_VALUE) 186 | ); 187 | jDialog5Layout.setVerticalGroup( 188 | jDialog5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 189 | .add(0, 300, Short.MAX_VALUE) 190 | ); 191 | 192 | jFileChooser1.setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY); 193 | 194 | jTable1.setModel(new javax.swing.table.DefaultTableModel( 195 | new Object [][] { 196 | {null, null, null, null}, 197 | {null, null, null, null}, 198 | {null, null, null, null}, 199 | {null, null, null, null} 200 | }, 201 | new String [] { 202 | "Title 1", "Title 2", "Title 3", "Title 4" 203 | } 204 | )); 205 | jScrollPane2.setViewportView(jTable1); 206 | 207 | setClosable(true); 208 | setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); 209 | setMaximizable(true); 210 | setResizable(true); 211 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(ViewSharedFiles.class); 212 | setTitle(resourceMap.getString("title")); // NOI18N 213 | setToolTipText(resourceMap.getString("title")); // NOI18N 214 | setMinimumSize(new java.awt.Dimension(530, 485)); 215 | setName("Peer2peer Trust Framework"); // NOI18N 216 | 217 | jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("List of Folders to be Shared")); 218 | jPanel2.setFont(new java.awt.Font("Verdana", 0, 11)); 219 | 220 | jTableDisplay.setFont(new java.awt.Font("Verdana", 0, 10)); 221 | jTableDisplay.setModel(new javax.swing.table.DefaultTableModel( 222 | new Object [][] { 223 | 224 | }, 225 | new String [] { 226 | "Sr. No", "Name", "Folder Path", "Size", "Date" 227 | } 228 | ) { 229 | Class[] types = new Class [] { 230 | java.lang.Object.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class 231 | }; 232 | boolean[] canEdit = new boolean [] { 233 | false, false, false, false, false 234 | }; 235 | 236 | public Class getColumnClass(int columnIndex) { 237 | return types [columnIndex]; 238 | } 239 | 240 | public boolean isCellEditable(int rowIndex, int columnIndex) { 241 | return canEdit [columnIndex]; 242 | } 243 | }); 244 | jTableDisplay.setColumnSelectionAllowed(true); 245 | jTableDisplay.setDragEnabled(true); 246 | jScrollPane1.setViewportView(jTableDisplay); 247 | jTableDisplay.getColumnModel().getColumn(0).setPreferredWidth(30); 248 | 249 | org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); 250 | jPanel2.setLayout(jPanel2Layout); 251 | jPanel2Layout.setHorizontalGroup( 252 | jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 253 | .add(jPanel2Layout.createSequentialGroup() 254 | .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 255 | .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 492, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 256 | ); 257 | jPanel2Layout.setVerticalGroup( 258 | jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 259 | .add(jPanel2Layout.createSequentialGroup() 260 | .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 403, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 261 | .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 262 | ); 263 | 264 | org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); 265 | getContentPane().setLayout(layout); 266 | layout.setHorizontalGroup( 267 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 268 | .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 269 | ); 270 | layout.setVerticalGroup( 271 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 272 | .add(layout.createSequentialGroup() 273 | .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 274 | .addContainerGap(15, Short.MAX_VALUE)) 275 | ); 276 | 277 | jPanel2.getAccessibleContext().setAccessibleName("List of Files to share"); 278 | jPanel2.getAccessibleContext().setAccessibleDescription("List of Files to share"); 279 | 280 | getAccessibleContext().setAccessibleName(resourceMap.getString("title")); // NOI18N 281 | getAccessibleContext().setAccessibleDescription(resourceMap.getString("title")); // NOI18N 282 | getAccessibleContext().setAccessibleParent(this); 283 | 284 | pack(); 285 | }// </editor-fold>//GEN-END:initComponents 286 | 287 | public static int index = 0; 288 | 289 | // File srcPath = new File("E:/vidio songs/NEW SONGS"); 290 | 291 | /** 292 | * @param args the command line arguments 293 | */ 294 | public static void main(String args[]) { 295 | java.awt.EventQueue.invokeLater(new Runnable() { 296 | 297 | public void run() { 298 | try { 299 | 300 | new ViewSharedFiles().setVisible(true); 301 | } catch (Exception ex) { 302 | Logger.getLogger(ViewSharedFiles.class.getName()).log(Level.SEVERE, null, ex); 303 | } 304 | } 305 | }); 306 | } 307 | 308 | // Variables declaration - do not modify//GEN-BEGIN:variables 309 | private javax.swing.JDialog jDialog1; 310 | private javax.swing.JDialog jDialog2; 311 | private javax.swing.JDialog jDialog3; 312 | private javax.swing.JDialog jDialog4; 313 | private javax.swing.JDialog jDialog5; 314 | private javax.swing.JFileChooser jFileChooser1; 315 | private javax.swing.JPanel jPanel2; 316 | private javax.swing.JScrollPane jScrollPane1; 317 | private javax.swing.JScrollPane jScrollPane2; 318 | private javax.swing.JTable jTable1; 319 | private javax.swing.JTable jTableDisplay; 320 | // End of variables declaration//GEN-END:variables 321 | } 322 | -------------------------------------------------------------------------------- /src/com/forms/UserManamgement.form: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | 3 | <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo"> 4 | <NonVisualComponents> 5 | <Container class="javax.swing.JDialog" name="jDialog1"> 6 | 7 | <Layout> 8 | <DimensionLayout dim="0"> 9 | <Group type="103" groupAlignment="0" attributes="0"> 10 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 11 | </Group> 12 | </DimensionLayout> 13 | <DimensionLayout dim="1"> 14 | <Group type="103" groupAlignment="0" attributes="0"> 15 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 16 | </Group> 17 | </DimensionLayout> 18 | </Layout> 19 | </Container> 20 | <Container class="javax.swing.JDialog" name="jDialog2"> 21 | 22 | <Layout> 23 | <DimensionLayout dim="0"> 24 | <Group type="103" groupAlignment="0" attributes="0"> 25 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 26 | </Group> 27 | </DimensionLayout> 28 | <DimensionLayout dim="1"> 29 | <Group type="103" groupAlignment="0" attributes="0"> 30 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 31 | </Group> 32 | </DimensionLayout> 33 | </Layout> 34 | </Container> 35 | <Container class="javax.swing.JDialog" name="jDialog3"> 36 | 37 | <Layout> 38 | <DimensionLayout dim="0"> 39 | <Group type="103" groupAlignment="0" attributes="0"> 40 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 41 | </Group> 42 | </DimensionLayout> 43 | <DimensionLayout dim="1"> 44 | <Group type="103" groupAlignment="0" attributes="0"> 45 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 46 | </Group> 47 | </DimensionLayout> 48 | </Layout> 49 | </Container> 50 | <Container class="javax.swing.JDialog" name="jDialog4"> 51 | 52 | <Layout> 53 | <DimensionLayout dim="0"> 54 | <Group type="103" groupAlignment="0" attributes="0"> 55 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 56 | </Group> 57 | </DimensionLayout> 58 | <DimensionLayout dim="1"> 59 | <Group type="103" groupAlignment="0" attributes="0"> 60 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 61 | </Group> 62 | </DimensionLayout> 63 | </Layout> 64 | </Container> 65 | <Container class="javax.swing.JDialog" name="jDialog5"> 66 | 67 | <Layout> 68 | <DimensionLayout dim="0"> 69 | <Group type="103" groupAlignment="0" attributes="0"> 70 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 71 | </Group> 72 | </DimensionLayout> 73 | <DimensionLayout dim="1"> 74 | <Group type="103" groupAlignment="0" attributes="0"> 75 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 76 | </Group> 77 | </DimensionLayout> 78 | </Layout> 79 | </Container> 80 | <Component class="javax.swing.JFileChooser" name="jFileChooser1"> 81 | <Properties> 82 | <Property name="fileSelectionMode" type="int" value="1"/> 83 | </Properties> 84 | </Component> 85 | <Container class="javax.swing.JScrollPane" name="jScrollPane2"> 86 | <AuxValues> 87 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> 88 | </AuxValues> 89 | 90 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> 91 | <SubComponents> 92 | <Component class="javax.swing.JTable" name="jTable1"> 93 | <Properties> 94 | <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> 95 | <Table columnCount="4" rowCount="4"> 96 | <Column editable="true" title="Title 1" type="java.lang.Object"/> 97 | <Column editable="true" title="Title 2" type="java.lang.Object"/> 98 | <Column editable="true" title="Title 3" type="java.lang.Object"/> 99 | <Column editable="true" title="Title 4" type="java.lang.Object"/> 100 | </Table> 101 | </Property> 102 | </Properties> 103 | </Component> 104 | </SubComponents> 105 | </Container> 106 | <Container class="javax.swing.JScrollPane" name="jScrollPane3"> 107 | <AuxValues> 108 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> 109 | </AuxValues> 110 | 111 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> 112 | <SubComponents> 113 | <Component class="javax.swing.JTable" name="jTable2"> 114 | <Properties> 115 | <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> 116 | <Table columnCount="4" rowCount="4"> 117 | <Column editable="true" title="Title 1" type="java.lang.Object"/> 118 | <Column editable="true" title="Title 2" type="java.lang.Object"/> 119 | <Column editable="true" title="Title 3" type="java.lang.Object"/> 120 | <Column editable="true" title="Title 4" type="java.lang.Object"/> 121 | </Table> 122 | </Property> 123 | </Properties> 124 | </Component> 125 | </SubComponents> 126 | </Container> 127 | </NonVisualComponents> 128 | <Properties> 129 | <Property name="closable" type="boolean" value="true"/> 130 | <Property name="defaultCloseOperation" type="int" value="1"/> 131 | <Property name="maximizable" type="boolean" value="true"/> 132 | <Property name="resizable" type="boolean" value="true"/> 133 | <Property name="title" type="java.lang.String" resourceKey="title"/> 134 | <Property name="toolTipText" type="java.lang.String" resourceKey="title"/> 135 | <Property name="name" type="java.lang.String" value="Peer2peer Trust Framework" noResource="true"/> 136 | </Properties> 137 | <AccessibilityProperties> 138 | <Property name="AccessibleContext.accessibleName" type="java.lang.String" resourceKey="title"/> 139 | <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" resourceKey="title"/> 140 | <Property name="AccessibleContext.accessibleParent" type="javax.accessibility.Accessible" editor="org.netbeans.modules.form.RADVisualComponent$AccessibleParentEditor"> 141 | <ComponentRef name="Form"/> 142 | </Property> 143 | </AccessibilityProperties> 144 | <SyntheticProperties> 145 | <SyntheticProperty name="formSizePolicy" type="int" value="1"/> 146 | </SyntheticProperties> 147 | <AuxValues> 148 | <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> 149 | <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> 150 | <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> 151 | <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> 152 | <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> 153 | <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/> 154 | <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> 155 | <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> 156 | <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> 157 | </AuxValues> 158 | 159 | <Layout> 160 | <DimensionLayout dim="0"> 161 | <Group type="103" groupAlignment="0" attributes="0"> 162 | <Group type="102" attributes="0"> 163 | <Group type="103" groupAlignment="0" attributes="0"> 164 | <Component id="jPanel3" max="32767" attributes="1"/> 165 | <Group type="102" alignment="0" attributes="0"> 166 | <EmptySpace min="-2" pref="233" max="-2" attributes="0"/> 167 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> 168 | </Group> 169 | </Group> 170 | <EmptySpace max="-2" attributes="0"/> 171 | </Group> 172 | </Group> 173 | </DimensionLayout> 174 | <DimensionLayout dim="1"> 175 | <Group type="103" groupAlignment="0" attributes="0"> 176 | <Group type="102" alignment="0" attributes="0"> 177 | <EmptySpace min="-2" pref="28" max="-2" attributes="0"/> 178 | <Component id="jPanel3" min="-2" max="-2" attributes="0"/> 179 | <EmptySpace pref="10" max="32767" attributes="0"/> 180 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> 181 | <EmptySpace max="-2" attributes="0"/> 182 | </Group> 183 | </Group> 184 | </DimensionLayout> 185 | </Layout> 186 | <SubComponents> 187 | <Container class="javax.swing.JPanel" name="jPanel3"> 188 | <Properties> 189 | <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> 190 | <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> 191 | <TitledBorder title="Block Guilty Agent"/> 192 | </Border> 193 | </Property> 194 | </Properties> 195 | 196 | <Layout> 197 | <DimensionLayout dim="0"> 198 | <Group type="103" groupAlignment="0" attributes="0"> 199 | <Group type="102" attributes="0"> 200 | <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> 201 | <Group type="103" groupAlignment="0" attributes="0"> 202 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> 203 | <Component id="jLabel3" min="-2" max="-2" attributes="0"/> 204 | </Group> 205 | <EmptySpace min="-2" pref="121" max="-2" attributes="0"/> 206 | <Group type="103" groupAlignment="0" attributes="0"> 207 | <Component id="jComboBox1" min="-2" pref="229" max="-2" attributes="1"/> 208 | <Component id="jScrollPane1" min="-2" pref="306" max="-2" attributes="0"/> 209 | </Group> 210 | <EmptySpace pref="289" max="32767" attributes="0"/> 211 | </Group> 212 | </Group> 213 | </DimensionLayout> 214 | <DimensionLayout dim="1"> 215 | <Group type="103" groupAlignment="0" attributes="0"> 216 | <Group type="102" attributes="0"> 217 | <EmptySpace max="-2" attributes="0"/> 218 | <Group type="103" groupAlignment="0" attributes="0"> 219 | <Group type="102" alignment="0" attributes="0"> 220 | <EmptySpace min="-2" pref="33" max="-2" attributes="0"/> 221 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> 222 | </Group> 223 | <Group type="102" alignment="0" attributes="0"> 224 | <EmptySpace min="-2" pref="31" max="-2" attributes="0"/> 225 | <Component id="jComboBox1" min="-2" max="-2" attributes="0"/> 226 | </Group> 227 | </Group> 228 | <Group type="103" groupAlignment="0" attributes="0"> 229 | <Group type="102" attributes="0"> 230 | <EmptySpace min="-2" pref="21" max="-2" attributes="0"/> 231 | <Component id="jLabel3" min="-2" max="-2" attributes="0"/> 232 | </Group> 233 | <Group type="102" alignment="0" attributes="0"> 234 | <EmptySpace type="unrelated" max="-2" attributes="0"/> 235 | <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/> 236 | </Group> 237 | </Group> 238 | <EmptySpace pref="23" max="32767" attributes="0"/> 239 | </Group> 240 | </Group> 241 | </DimensionLayout> 242 | </Layout> 243 | <SubComponents> 244 | <Component class="javax.swing.JLabel" name="jLabel2"> 245 | <Properties> 246 | <Property name="text" type="java.lang.String" value="Select Agent"/> 247 | </Properties> 248 | </Component> 249 | <Component class="javax.swing.JComboBox" name="jComboBox1"> 250 | <Properties> 251 | <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> 252 | <StringArray count="4"> 253 | <StringItem index="0" value="Item 1"/> 254 | <StringItem index="1" value="Item 2"/> 255 | <StringItem index="2" value="Item 3"/> 256 | <StringItem index="3" value="Item 4"/> 257 | </StringArray> 258 | </Property> 259 | </Properties> 260 | <Events> 261 | <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="jComboBox1ItemStateChanged"/> 262 | </Events> 263 | </Component> 264 | <Container class="javax.swing.JScrollPane" name="jScrollPane1"> 265 | <AuxValues> 266 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> 267 | </AuxValues> 268 | 269 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> 270 | <SubComponents> 271 | <Component class="javax.swing.JTextArea" name="jTextArea1"> 272 | <Properties> 273 | <Property name="columns" type="int" value="20"/> 274 | <Property name="rows" type="int" value="5"/> 275 | </Properties> 276 | </Component> 277 | </SubComponents> 278 | </Container> 279 | <Component class="javax.swing.JLabel" name="jLabel3"> 280 | <Properties> 281 | <Property name="text" type="java.lang.String" value="Block Reason"/> 282 | </Properties> 283 | </Component> 284 | </SubComponents> 285 | </Container> 286 | <Component class="javax.swing.JButton" name="jButton1"> 287 | <Properties> 288 | <Property name="text" type="java.lang.String" value="Deactivate"/> 289 | </Properties> 290 | <Events> 291 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> 292 | </Events> 293 | </Component> 294 | </SubComponents> 295 | </Form> 296 | -------------------------------------------------------------------------------- /src/com/forms/AgentRequests.form: -------------------------------------------------------------------------------- 1 | <?xml version="1.1" encoding="UTF-8" ?> 2 | 3 | <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo"> 4 | <NonVisualComponents> 5 | <Container class="javax.swing.JDialog" name="jDialog1"> 6 | 7 | <Layout> 8 | <DimensionLayout dim="0"> 9 | <Group type="103" groupAlignment="0" attributes="0"> 10 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 11 | </Group> 12 | </DimensionLayout> 13 | <DimensionLayout dim="1"> 14 | <Group type="103" groupAlignment="0" attributes="0"> 15 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 16 | </Group> 17 | </DimensionLayout> 18 | </Layout> 19 | </Container> 20 | <Container class="javax.swing.JDialog" name="jDialog2"> 21 | 22 | <Layout> 23 | <DimensionLayout dim="0"> 24 | <Group type="103" groupAlignment="0" attributes="0"> 25 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 26 | </Group> 27 | </DimensionLayout> 28 | <DimensionLayout dim="1"> 29 | <Group type="103" groupAlignment="0" attributes="0"> 30 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 31 | </Group> 32 | </DimensionLayout> 33 | </Layout> 34 | </Container> 35 | <Container class="javax.swing.JDialog" name="jDialog3"> 36 | 37 | <Layout> 38 | <DimensionLayout dim="0"> 39 | <Group type="103" groupAlignment="0" attributes="0"> 40 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 41 | </Group> 42 | </DimensionLayout> 43 | <DimensionLayout dim="1"> 44 | <Group type="103" groupAlignment="0" attributes="0"> 45 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 46 | </Group> 47 | </DimensionLayout> 48 | </Layout> 49 | </Container> 50 | <Container class="javax.swing.JDialog" name="jDialog4"> 51 | 52 | <Layout> 53 | <DimensionLayout dim="0"> 54 | <Group type="103" groupAlignment="0" attributes="0"> 55 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 56 | </Group> 57 | </DimensionLayout> 58 | <DimensionLayout dim="1"> 59 | <Group type="103" groupAlignment="0" attributes="0"> 60 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 61 | </Group> 62 | </DimensionLayout> 63 | </Layout> 64 | </Container> 65 | <Container class="javax.swing.JDialog" name="jDialog5"> 66 | 67 | <Layout> 68 | <DimensionLayout dim="0"> 69 | <Group type="103" groupAlignment="0" attributes="0"> 70 | <EmptySpace min="0" pref="400" max="32767" attributes="0"/> 71 | </Group> 72 | </DimensionLayout> 73 | <DimensionLayout dim="1"> 74 | <Group type="103" groupAlignment="0" attributes="0"> 75 | <EmptySpace min="0" pref="300" max="32767" attributes="0"/> 76 | </Group> 77 | </DimensionLayout> 78 | </Layout> 79 | </Container> 80 | <Component class="javax.swing.JFileChooser" name="jFileChooser1"> 81 | <Properties> 82 | <Property name="fileSelectionMode" type="int" value="1"/> 83 | </Properties> 84 | </Component> 85 | <Container class="javax.swing.JScrollPane" name="jScrollPane2"> 86 | <AuxValues> 87 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> 88 | </AuxValues> 89 | 90 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> 91 | <SubComponents> 92 | <Component class="javax.swing.JTable" name="jTable1"> 93 | <Properties> 94 | <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> 95 | <Table columnCount="4" rowCount="4"> 96 | <Column editable="true" title="Title 1" type="java.lang.Object"/> 97 | <Column editable="true" title="Title 2" type="java.lang.Object"/> 98 | <Column editable="true" title="Title 3" type="java.lang.Object"/> 99 | <Column editable="true" title="Title 4" type="java.lang.Object"/> 100 | </Table> 101 | </Property> 102 | </Properties> 103 | </Component> 104 | </SubComponents> 105 | </Container> 106 | <Container class="javax.swing.JScrollPane" name="jScrollPane3"> 107 | <AuxValues> 108 | <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> 109 | </AuxValues> 110 | 111 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> 112 | <SubComponents> 113 | <Component class="javax.swing.JTable" name="jTable2"> 114 | <Properties> 115 | <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> 116 | <Table columnCount="4" rowCount="4"> 117 | <Column editable="true" title="Title 1" type="java.lang.Object"/> 118 | <Column editable="true" title="Title 2" type="java.lang.Object"/> 119 | <Column editable="true" title="Title 3" type="java.lang.Object"/> 120 | <Column editable="true" title="Title 4" type="java.lang.Object"/> 121 | </Table> 122 | </Property> 123 | </Properties> 124 | </Component> 125 | </SubComponents> 126 | </Container> 127 | </NonVisualComponents> 128 | <Properties> 129 | <Property name="closable" type="boolean" value="true"/> 130 | <Property name="defaultCloseOperation" type="int" value="1"/> 131 | <Property name="maximizable" type="boolean" value="true"/> 132 | <Property name="resizable" type="boolean" value="true"/> 133 | <Property name="title" type="java.lang.String" resourceKey="title"/> 134 | <Property name="toolTipText" type="java.lang.String" resourceKey="title"/> 135 | <Property name="name" type="java.lang.String" value="Peer2peer Trust Framework" noResource="true"/> 136 | </Properties> 137 | <AccessibilityProperties> 138 | <Property name="AccessibleContext.accessibleName" type="java.lang.String" resourceKey="title"/> 139 | <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" resourceKey="title"/> 140 | <Property name="AccessibleContext.accessibleParent" type="javax.accessibility.Accessible" editor="org.netbeans.modules.form.RADVisualComponent$AccessibleParentEditor"> 141 | <ComponentRef name="Form"/> 142 | </Property> 143 | </AccessibilityProperties> 144 | <SyntheticProperties> 145 | <SyntheticProperty name="formSizePolicy" type="int" value="1"/> 146 | </SyntheticProperties> 147 | <AuxValues> 148 | <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> 149 | <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> 150 | <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> 151 | <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> 152 | <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> 153 | <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/> 154 | <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> 155 | <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> 156 | <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> 157 | </AuxValues> 158 | 159 | <Layout> 160 | <DimensionLayout dim="0"> 161 | <Group type="103" groupAlignment="0" attributes="0"> 162 | <Group type="102" attributes="0"> 163 | <Component id="jPanel3" max="32767" attributes="1"/> 164 | <EmptySpace max="-2" attributes="0"/> 165 | </Group> 166 | </Group> 167 | </DimensionLayout> 168 | <DimensionLayout dim="1"> 169 | <Group type="103" groupAlignment="0" attributes="0"> 170 | <Group type="102" alignment="0" attributes="0"> 171 | <EmptySpace min="-2" pref="28" max="-2" attributes="0"/> 172 | <Component id="jPanel3" min="-2" max="-2" attributes="0"/> 173 | <EmptySpace pref="19" max="32767" attributes="0"/> 174 | </Group> 175 | </Group> 176 | </DimensionLayout> 177 | </Layout> 178 | <SubComponents> 179 | <Container class="javax.swing.JPanel" name="jPanel3"> 180 | <Properties> 181 | <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> 182 | <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> 183 | <TitledBorder title="Sharing Details"/> 184 | </Border> 185 | </Property> 186 | </Properties> 187 | 188 | <Layout> 189 | <DimensionLayout dim="0"> 190 | <Group type="103" groupAlignment="0" attributes="0"> 191 | <Group type="102" attributes="0"> 192 | <Group type="103" groupAlignment="0" attributes="0"> 193 | <Group type="102" alignment="0" attributes="0"> 194 | <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> 195 | <Group type="103" groupAlignment="0" attributes="0"> 196 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> 197 | <Component id="jLabel1" min="-2" pref="132" max="-2" attributes="1"/> 198 | <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> 199 | </Group> 200 | <EmptySpace min="-2" pref="54" max="-2" attributes="0"/> 201 | <Group type="103" groupAlignment="0" max="-2" attributes="0"> 202 | <Component id="jComboBox2" alignment="0" pref="229" max="32767" attributes="1"/> 203 | <Component id="jComboBox1" alignment="0" pref="229" max="32767" attributes="1"/> 204 | <Component id="jTextField1" alignment="0" max="32767" attributes="1"/> 205 | </Group> 206 | </Group> 207 | <Group type="102" alignment="0" attributes="0"> 208 | <EmptySpace min="-2" pref="170" max="-2" attributes="0"/> 209 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> 210 | </Group> 211 | </Group> 212 | <EmptySpace pref="364" max="32767" attributes="0"/> 213 | </Group> 214 | </Group> 215 | </DimensionLayout> 216 | <DimensionLayout dim="1"> 217 | <Group type="103" groupAlignment="0" attributes="0"> 218 | <Group type="102" attributes="0"> 219 | <EmptySpace max="-2" attributes="0"/> 220 | <Group type="103" groupAlignment="0" attributes="0"> 221 | <Group type="102" alignment="0" attributes="0"> 222 | <Component id="jLabel1" min="-2" pref="22" max="-2" attributes="0"/> 223 | <EmptySpace type="unrelated" max="-2" attributes="0"/> 224 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> 225 | </Group> 226 | <Group type="102" alignment="0" attributes="0"> 227 | <Component id="jTextField1" min="-2" max="-2" attributes="0"/> 228 | <EmptySpace type="unrelated" max="-2" attributes="0"/> 229 | <Component id="jComboBox1" min="-2" max="-2" attributes="0"/> 230 | </Group> 231 | </Group> 232 | <Group type="103" groupAlignment="0" attributes="0"> 233 | <Group type="102" attributes="0"> 234 | <EmptySpace min="-2" pref="20" max="-2" attributes="0"/> 235 | <Component id="jLabel3" min="-2" max="-2" attributes="0"/> 236 | </Group> 237 | <Group type="102" alignment="0" attributes="0"> 238 | <EmptySpace type="separate" max="-2" attributes="0"/> 239 | <Component id="jComboBox2" min="-2" max="-2" attributes="0"/> 240 | </Group> 241 | </Group> 242 | <EmptySpace min="-2" pref="28" max="-2" attributes="0"/> 243 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> 244 | <EmptySpace pref="41" max="32767" attributes="0"/> 245 | </Group> 246 | </Group> 247 | </DimensionLayout> 248 | </Layout> 249 | <SubComponents> 250 | <Component class="javax.swing.JLabel" name="jLabel1"> 251 | <Properties> 252 | <Property name="text" type="java.lang.String" value="Data Request Description"/> 253 | </Properties> 254 | </Component> 255 | <Component class="javax.swing.JLabel" name="jLabel2"> 256 | <Properties> 257 | <Property name="text" type="java.lang.String" value="Select Region"/> 258 | </Properties> 259 | </Component> 260 | <Component class="javax.swing.JComboBox" name="jComboBox1"> 261 | <Properties> 262 | <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> 263 | <StringArray count="4"> 264 | <StringItem index="0" value="Item 1"/> 265 | <StringItem index="1" value="Item 2"/> 266 | <StringItem index="2" value="Item 3"/> 267 | <StringItem index="3" value="Item 4"/> 268 | </StringArray> 269 | </Property> 270 | </Properties> 271 | <Events> 272 | <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="jComboBox1ItemStateChanged"/> 273 | </Events> 274 | </Component> 275 | <Component class="javax.swing.JLabel" name="jLabel3"> 276 | <Properties> 277 | <Property name="text" type="java.lang.String" value="Select Distributor"/> 278 | </Properties> 279 | </Component> 280 | <Component class="javax.swing.JComboBox" name="jComboBox2"> 281 | <Properties> 282 | <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> 283 | <StringArray count="4"> 284 | <StringItem index="0" value="Item 1"/> 285 | <StringItem index="1" value="Item 2"/> 286 | <StringItem index="2" value="Item 3"/> 287 | <StringItem index="3" value="Item 4"/> 288 | </StringArray> 289 | </Property> 290 | </Properties> 291 | </Component> 292 | <Component class="javax.swing.JButton" name="jButton1"> 293 | <Properties> 294 | <Property name="text" type="java.lang.String" value="Send Request"/> 295 | </Properties> 296 | <Events> 297 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> 298 | </Events> 299 | </Component> 300 | <Component class="javax.swing.JTextField" name="jTextField1"> 301 | </Component> 302 | </SubComponents> 303 | </Container> 304 | </SubComponents> 305 | </Form> 306 | -------------------------------------------------------------------------------- /src/com/forms/MainForm.form: -------------------------------------------------------------------------------- 1 | <?xml version="1.1" encoding="UTF-8" ?> 2 | 3 | <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> 4 | <NonVisualComponents> 5 | <Menu class="javax.swing.JMenuBar" name="menuBar"> 6 | <SubComponents> 7 | <Menu class="javax.swing.JMenu" name="fileMenu"> 8 | <Properties> 9 | <Property name="text" type="java.lang.String" value="File"/> 10 | </Properties> 11 | <SubComponents> 12 | <MenuItem class="javax.swing.JMenuItem" name="exitMenuItem"> 13 | <Properties> 14 | <Property name="text" type="java.lang.String" value="Exit"/> 15 | </Properties> 16 | <Events> 17 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitMenuItemActionPerformed"/> 18 | </Events> 19 | </MenuItem> 20 | </SubComponents> 21 | </Menu> 22 | <Menu class="javax.swing.JMenu" name="jMenu1"> 23 | <Properties> 24 | <Property name="text" type="java.lang.String" value="Distributor"/> 25 | </Properties> 26 | <Events> 27 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenu1ActionPerformed"/> 28 | </Events> 29 | <SubComponents> 30 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem1"> 31 | <Events> 32 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem1ActionPerformed"/> 33 | </Events> 34 | </MenuItem> 35 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem5"> 36 | <Properties> 37 | <Property name="text" type="java.lang.String" value="View Shared Files"/> 38 | </Properties> 39 | <Events> 40 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem5ActionPerformed"/> 41 | </Events> 42 | </MenuItem> 43 | </SubComponents> 44 | </Menu> 45 | <Menu class="javax.swing.JMenu" name="jMenu3"> 46 | <Properties> 47 | <Property name="text" type="java.lang.String" value="Agent"/> 48 | </Properties> 49 | <SubComponents> 50 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem4"> 51 | <Properties> 52 | <Property name="text" type="java.lang.String" value="Agent Requests"/> 53 | </Properties> 54 | <Events> 55 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem4ActionPerformed"/> 56 | </Events> 57 | </MenuItem> 58 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem6"> 59 | <Properties> 60 | <Property name="text" type="java.lang.String" value="Agent Downloads"/> 61 | </Properties> 62 | <Events> 63 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem6ActionPerformed"/> 64 | </Events> 65 | </MenuItem> 66 | </SubComponents> 67 | </Menu> 68 | <Menu class="javax.swing.JMenu" name="jMenu2"> 69 | <Properties> 70 | <Property name="text" type="java.lang.String" value="Admin"/> 71 | </Properties> 72 | <SubComponents> 73 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem3"> 74 | <Properties> 75 | <Property name="text" type="java.lang.String" value="Configure App"/> 76 | </Properties> 77 | </MenuItem> 78 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem2"> 79 | <Properties> 80 | <Property name="text" type="java.lang.String" value="Probability Calculations"/> 81 | </Properties> 82 | <Events> 83 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem2ActionPerformed"/> 84 | </Events> 85 | </MenuItem> 86 | <MenuItem class="javax.swing.JMenuItem" name="jMenuItem7"> 87 | <Properties> 88 | <Property name="text" type="java.lang.String" value="Manage Agents"/> 89 | </Properties> 90 | <Events> 91 | <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jMenuItem7MouseClicked"/> 92 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem7ActionPerformed"/> 93 | </Events> 94 | </MenuItem> 95 | </SubComponents> 96 | </Menu> 97 | <Menu class="javax.swing.JMenu" name="helpMenu2"> 98 | <Properties> 99 | <Property name="text" type="java.lang.String" value="Change Password"/> 100 | </Properties> 101 | <Events> 102 | <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="helpMenu2MouseClicked"/> 103 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="helpMenu2ActionPerformed"/> 104 | </Events> 105 | </Menu> 106 | <Menu class="javax.swing.JMenu" name="helpMenu1"> 107 | <Properties> 108 | <Property name="text" type="java.lang.String" value="Logout"/> 109 | </Properties> 110 | <Events> 111 | <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="helpMenu1MouseClicked"/> 112 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="helpMenu1ActionPerformed"/> 113 | </Events> 114 | </Menu> 115 | </SubComponents> 116 | </Menu> 117 | </NonVisualComponents> 118 | <Properties> 119 | <Property name="defaultCloseOperation" type="int" value="3"/> 120 | <Property name="title" type="java.lang.String" resourceKey="title"/> 121 | <Property name="focusCycleRoot" type="boolean" value="false"/> 122 | <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> 123 | <Dimension value="[950, 662]"/> 124 | </Property> 125 | </Properties> 126 | <AccessibilityProperties> 127 | <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" resourceKey="AccessibleContext.accessibleDescription"/> 128 | </AccessibilityProperties> 129 | <SyntheticProperties> 130 | <SyntheticProperty name="menuBar" type="java.lang.String" value="menuBar"/> 131 | <SyntheticProperty name="formSizePolicy" type="int" value="1"/> 132 | </SyntheticProperties> 133 | <AuxValues> 134 | <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> 135 | <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> 136 | <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> 137 | <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> 138 | <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> 139 | <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> 140 | <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> 141 | <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> 142 | <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> 143 | <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,-106,0,0,3,-74"/> 144 | </AuxValues> 145 | 146 | <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> 147 | <SubComponents> 148 | <Container class="javax.swing.JDesktopPane" name="desktopPane"> 149 | <Properties> 150 | <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> 151 | <Color blue="c8" green="d0" id="Button.background" palette="3" red="d4" type="palette"/> 152 | </Property> 153 | <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> 154 | <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo"> 155 | <EtchetBorder> 156 | <Color PropertyName="highlight" blue="c0" green="c0" id="lightGray" palette="1" red="c0" type="palette"/> 157 | <Color PropertyName="shadow" blue="80" green="80" id="gray" palette="1" red="80" type="palette"/> 158 | </EtchetBorder> 159 | </Border> 160 | </Property> 161 | <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> 162 | <Color blue="0" green="0" red="0" type="rgb"/> 163 | </Property> 164 | <Property name="toolTipText" type="java.lang.String" resourceKey="desktopPane.toolTipText"/> 165 | <Property name="font" type="java.awt.Font" resourceKey="desktopPane.font"/> 166 | <Property name="name" type="java.lang.String" resourceKey="desktopPane.name"/> 167 | <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> 168 | <Dimension value="[950, 662]"/> 169 | </Property> 170 | </Properties> 171 | <AccessibilityProperties> 172 | <Property name="AccessibleContext.accessibleName" type="java.lang.String" resourceKey="desktopPane.AccessibleContext.accessibleName"/> 173 | <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" resourceKey="desktopPane.AccessibleContext.accessibleDescription"/> 174 | </AccessibilityProperties> 175 | <Constraints> 176 | <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> 177 | <BorderConstraints direction="Center"/> 178 | </Constraint> 179 | </Constraints> 180 | 181 | <Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/> 182 | <SubComponents> 183 | <Component class="javax.swing.JLabel" name="jLabel1"> 184 | <Properties> 185 | <Property name="icon" type="javax.swing.Icon" noResource="true" editor="org.netbeans.modules.form.editors2.IconEditor"> 186 | <Image iconType="3" name="/img03.png"/> 187 | </Property> 188 | </Properties> 189 | <Constraints> 190 | <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout$JLayeredPaneConstraintsDescription"> 191 | <JLayeredPaneConstraints x="20" y="10" width="500" height="460" layer="0" position="-1"/> 192 | </Constraint> 193 | </Constraints> 194 | </Component> 195 | <Container class="javax.swing.JPanel" name="jPanel1"> 196 | <Properties> 197 | <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> 198 | <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo"> 199 | <EtchetBorder> 200 | <Color PropertyName="highlight" blue="c0" green="c0" id="lightGray" palette="1" red="c0" type="palette"/> 201 | <Color PropertyName="shadow" blue="c0" green="c0" id="lightGray" palette="1" red="c0" type="palette"/> 202 | </EtchetBorder> 203 | </Border> 204 | </Property> 205 | <Property name="font" type="java.awt.Font" resourceKey="desktopPane.font"/> 206 | <Property name="name" type="java.lang.String" value="PanelBottom" noResource="true"/> 207 | </Properties> 208 | <AccessibilityProperties> 209 | <Property name="AccessibleContext.accessibleName" type="java.lang.String" resourceKey="jPanel1.AccessibleContext.accessibleName"/> 210 | <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value="Status Panel"/> 211 | </AccessibilityProperties> 212 | <Constraints> 213 | <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout$JLayeredPaneConstraintsDescription"> 214 | <JLayeredPaneConstraints x="0" y="610" width="-1" height="-1" layer="0" position="-1"/> 215 | </Constraint> 216 | </Constraints> 217 | 218 | <Layout> 219 | <DimensionLayout dim="0"> 220 | <Group type="103" groupAlignment="0" attributes="0"> 221 | <Group type="102" alignment="0" attributes="0"> 222 | <Component id="statusLabel" min="-2" pref="597" max="-2" attributes="0"/> 223 | <EmptySpace pref="203" max="32767" attributes="0"/> 224 | <Component id="jProgressBar1" min="-2" max="-2" attributes="0"/> 225 | </Group> 226 | </Group> 227 | </DimensionLayout> 228 | <DimensionLayout dim="1"> 229 | <Group type="103" groupAlignment="0" attributes="0"> 230 | <Component id="statusLabel" alignment="1" pref="25" max="32767" attributes="0"/> 231 | <Group type="102" alignment="0" attributes="0"> 232 | <Component id="jProgressBar1" max="32767" attributes="0"/> 233 | <EmptySpace max="-2" attributes="0"/> 234 | </Group> 235 | </Group> 236 | </DimensionLayout> 237 | </Layout> 238 | <SubComponents> 239 | <Component class="javax.swing.JLabel" name="statusLabel"> 240 | <Properties> 241 | <Property name="text" type="java.lang.String" value="Done"/> 242 | </Properties> 243 | <AuxValues> 244 | <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="9"/> 245 | </AuxValues> 246 | </Component> 247 | <Component class="javax.swing.JProgressBar" name="jProgressBar1"> 248 | <Properties> 249 | <Property name="font" type="java.awt.Font" resourceKey="desktopPane.font"/> 250 | </Properties> 251 | <AccessibilityProperties> 252 | <Property name="AccessibleContext.accessibleName" type="java.lang.String" value=""/> 253 | <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/> 254 | </AccessibilityProperties> 255 | <AuxValues> 256 | <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="9"/> 257 | </AuxValues> 258 | </Component> 259 | </SubComponents> 260 | </Container> 261 | </SubComponents> 262 | </Container> 263 | </SubComponents> 264 | </Form> 265 | -------------------------------------------------------------------------------- /src/com/forms/UserManamgement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | /* 7 | * BackupFolder.java 8 | * 9 | * Created on Jan 19, 2010, 11:58:41 AM 10 | */ 11 | package com.forms; 12 | 13 | import com.dao.ConnectionManager; 14 | import java.awt.event.ItemEvent; 15 | import java.util.logging.Level; 16 | import java.util.logging.Logger; 17 | import com.dao.UserDAO; 18 | import com.helper.Constants; 19 | import com.helper.GetSetProperties; 20 | import com.helper.MailUtility; 21 | import com.helper.UserSession; 22 | import com.model.UserModel; 23 | import java.awt.event.ItemListener; 24 | import java.util.HashMap; 25 | import java.util.Iterator; 26 | import java.util.List; 27 | import javax.swing.DefaultComboBoxModel; 28 | import swinghelper.OptionHelper; 29 | 30 | 31 | /** 32 | * 33 | * @author Administrator 34 | */ 35 | public class UserManamgement extends javax.swing.JInternalFrame { 36 | public static List activeUserList = null; 37 | private int WARNING_MESSAGE; 38 | DefaultComboBoxModel dm; 39 | // public static ArrayList arr = null, arr1 = null; 40 | MainForm jd; 41 | /** Creates new form BackupFolder */ 42 | public UserManamgement() throws Exception { 43 | System.out.println("BackupFolder"); 44 | initComponents(); 45 | // swinghelper.SwingUtilities.setScreenCenter(this); 46 | UserDAO u = new UserDAO(); 47 | // u.CheckForPendingFiles(jTableDisplay); 48 | // jd=(MainForm) this.getParent().getParent(); 49 | UserManamgement.activeUserList= u.getUsers(Constants.AGENT_ROLL_ID+""); 50 | dm=(DefaultComboBoxModel) jComboBox1.getModel(); 51 | 52 | dm.removeAllElements();; 53 | 54 | for (Iterator it = UserManamgement.activeUserList.iterator(); it.hasNext();) { 55 | UserModel object = (UserModel) it.next(); 56 | System.out.println("Adding Element "+object.getFName() + " " + object.getLName()); 57 | dm.addElement(object.getFName() + " " + object.getLName() ); 58 | 59 | } 60 | jComboBox1.updateUI(); 61 | 62 | 63 | 64 | } 65 | public static String mailid=""; 66 | public String getUserId(String username) { 67 | String userId = "-1"; 68 | 69 | for (int i = 0; i < UserManamgement.activeUserList.size(); i++) { 70 | UserModel object = (UserModel) UserManamgement.activeUserList.get(i); 71 | String uname = object.getFName() + " " + object.getLName().trim(); 72 | 73 | if (uname.equalsIgnoreCase(username.trim())) { 74 | userId = object.getUserId(); 75 | mailid=object.getEmailAddress(); 76 | break; 77 | } 78 | } 79 | return userId; 80 | } 81 | private boolean checkForRepeatedPath() { 82 | 83 | return true; 84 | } 85 | 86 | /** This method is called from within the constructor to 87 | * initialize the form. 88 | * WARNING: Do NOT modify this code. The content of this method is 89 | * always regenerated by the Form Editor. 90 | */ 91 | @SuppressWarnings("unchecked") 92 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 93 | private void initComponents() { 94 | 95 | jDialog1 = new javax.swing.JDialog(); 96 | jDialog2 = new javax.swing.JDialog(); 97 | jDialog3 = new javax.swing.JDialog(); 98 | jDialog4 = new javax.swing.JDialog(); 99 | jDialog5 = new javax.swing.JDialog(); 100 | jFileChooser1 = new javax.swing.JFileChooser(); 101 | jScrollPane2 = new javax.swing.JScrollPane(); 102 | jTable1 = new javax.swing.JTable(); 103 | jScrollPane3 = new javax.swing.JScrollPane(); 104 | jTable2 = new javax.swing.JTable(); 105 | jPanel3 = new javax.swing.JPanel(); 106 | jLabel2 = new javax.swing.JLabel(); 107 | jComboBox1 = new javax.swing.JComboBox(); 108 | jScrollPane1 = new javax.swing.JScrollPane(); 109 | jTextArea1 = new javax.swing.JTextArea(); 110 | jLabel3 = new javax.swing.JLabel(); 111 | jButton1 = new javax.swing.JButton(); 112 | 113 | org.jdesktop.layout.GroupLayout jDialog1Layout = new org.jdesktop.layout.GroupLayout(jDialog1.getContentPane()); 114 | jDialog1.getContentPane().setLayout(jDialog1Layout); 115 | jDialog1Layout.setHorizontalGroup( 116 | jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 117 | .add(0, 400, Short.MAX_VALUE) 118 | ); 119 | jDialog1Layout.setVerticalGroup( 120 | jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 121 | .add(0, 300, Short.MAX_VALUE) 122 | ); 123 | 124 | org.jdesktop.layout.GroupLayout jDialog2Layout = new org.jdesktop.layout.GroupLayout(jDialog2.getContentPane()); 125 | jDialog2.getContentPane().setLayout(jDialog2Layout); 126 | jDialog2Layout.setHorizontalGroup( 127 | jDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 128 | .add(0, 400, Short.MAX_VALUE) 129 | ); 130 | jDialog2Layout.setVerticalGroup( 131 | jDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 132 | .add(0, 300, Short.MAX_VALUE) 133 | ); 134 | 135 | org.jdesktop.layout.GroupLayout jDialog3Layout = new org.jdesktop.layout.GroupLayout(jDialog3.getContentPane()); 136 | jDialog3.getContentPane().setLayout(jDialog3Layout); 137 | jDialog3Layout.setHorizontalGroup( 138 | jDialog3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 139 | .add(0, 400, Short.MAX_VALUE) 140 | ); 141 | jDialog3Layout.setVerticalGroup( 142 | jDialog3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 143 | .add(0, 300, Short.MAX_VALUE) 144 | ); 145 | 146 | org.jdesktop.layout.GroupLayout jDialog4Layout = new org.jdesktop.layout.GroupLayout(jDialog4.getContentPane()); 147 | jDialog4.getContentPane().setLayout(jDialog4Layout); 148 | jDialog4Layout.setHorizontalGroup( 149 | jDialog4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 150 | .add(0, 400, Short.MAX_VALUE) 151 | ); 152 | jDialog4Layout.setVerticalGroup( 153 | jDialog4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 154 | .add(0, 300, Short.MAX_VALUE) 155 | ); 156 | 157 | org.jdesktop.layout.GroupLayout jDialog5Layout = new org.jdesktop.layout.GroupLayout(jDialog5.getContentPane()); 158 | jDialog5.getContentPane().setLayout(jDialog5Layout); 159 | jDialog5Layout.setHorizontalGroup( 160 | jDialog5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 161 | .add(0, 400, Short.MAX_VALUE) 162 | ); 163 | jDialog5Layout.setVerticalGroup( 164 | jDialog5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 165 | .add(0, 300, Short.MAX_VALUE) 166 | ); 167 | 168 | jFileChooser1.setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY); 169 | 170 | jTable1.setModel(new javax.swing.table.DefaultTableModel( 171 | new Object [][] { 172 | {null, null, null, null}, 173 | {null, null, null, null}, 174 | {null, null, null, null}, 175 | {null, null, null, null} 176 | }, 177 | new String [] { 178 | "Title 1", "Title 2", "Title 3", "Title 4" 179 | } 180 | )); 181 | jScrollPane2.setViewportView(jTable1); 182 | 183 | jTable2.setModel(new javax.swing.table.DefaultTableModel( 184 | new Object [][] { 185 | {null, null, null, null}, 186 | {null, null, null, null}, 187 | {null, null, null, null}, 188 | {null, null, null, null} 189 | }, 190 | new String [] { 191 | "Title 1", "Title 2", "Title 3", "Title 4" 192 | } 193 | )); 194 | jScrollPane3.setViewportView(jTable2); 195 | 196 | setClosable(true); 197 | setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); 198 | setMaximizable(true); 199 | setResizable(true); 200 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(UserManamgement.class); 201 | setTitle(resourceMap.getString("title")); // NOI18N 202 | setToolTipText(resourceMap.getString("title")); // NOI18N 203 | setName("Peer2peer Trust Framework"); // NOI18N 204 | 205 | jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Block Guilty Agent")); 206 | 207 | jLabel2.setText("Select Agent"); 208 | 209 | jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); 210 | jComboBox1.addItemListener(new java.awt.event.ItemListener() { 211 | public void itemStateChanged(java.awt.event.ItemEvent evt) { 212 | jComboBox1ItemStateChanged(evt); 213 | } 214 | }); 215 | 216 | jTextArea1.setColumns(20); 217 | jTextArea1.setRows(5); 218 | jScrollPane1.setViewportView(jTextArea1); 219 | 220 | jLabel3.setText("Block Reason"); 221 | 222 | org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); 223 | jPanel3.setLayout(jPanel3Layout); 224 | jPanel3Layout.setHorizontalGroup( 225 | jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 226 | .add(jPanel3Layout.createSequentialGroup() 227 | .add(24, 24, 24) 228 | .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 229 | .add(jLabel2) 230 | .add(jLabel3)) 231 | .add(121, 121, 121) 232 | .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 233 | .add(jComboBox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 229, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 234 | .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 306, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 235 | .addContainerGap(289, Short.MAX_VALUE)) 236 | ); 237 | jPanel3Layout.setVerticalGroup( 238 | jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 239 | .add(jPanel3Layout.createSequentialGroup() 240 | .addContainerGap() 241 | .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 242 | .add(jPanel3Layout.createSequentialGroup() 243 | .add(33, 33, 33) 244 | .add(jLabel2)) 245 | .add(jPanel3Layout.createSequentialGroup() 246 | .add(31, 31, 31) 247 | .add(jComboBox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) 248 | .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 249 | .add(jPanel3Layout.createSequentialGroup() 250 | .add(21, 21, 21) 251 | .add(jLabel3)) 252 | .add(jPanel3Layout.createSequentialGroup() 253 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) 254 | .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) 255 | .addContainerGap(23, Short.MAX_VALUE)) 256 | ); 257 | 258 | jButton1.setText("Deactivate"); 259 | jButton1.addActionListener(new java.awt.event.ActionListener() { 260 | public void actionPerformed(java.awt.event.ActionEvent evt) { 261 | jButton1ActionPerformed(evt); 262 | } 263 | }); 264 | 265 | org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); 266 | getContentPane().setLayout(layout); 267 | layout.setHorizontalGroup( 268 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 269 | .add(layout.createSequentialGroup() 270 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 271 | .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 272 | .add(layout.createSequentialGroup() 273 | .add(233, 233, 233) 274 | .add(jButton1))) 275 | .addContainerGap()) 276 | ); 277 | layout.setVerticalGroup( 278 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 279 | .add(layout.createSequentialGroup() 280 | .add(28, 28, 28) 281 | .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 282 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 10, Short.MAX_VALUE) 283 | .add(jButton1) 284 | .addContainerGap()) 285 | ); 286 | 287 | getAccessibleContext().setAccessibleName(resourceMap.getString("title")); // NOI18N 288 | getAccessibleContext().setAccessibleDescription(resourceMap.getString("title")); // NOI18N 289 | getAccessibleContext().setAccessibleParent(this); 290 | 291 | pack(); 292 | }// </editor-fold>//GEN-END:initComponents 293 | 294 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed 295 | // TODO add your handling code here: 296 | 297 | if (jComboBox1.getSelectedIndex()==-1) { 298 | OptionHelper.showMessage("Please Select an Agent to block!!"); 299 | return; 300 | 301 | } 302 | 303 | String distributorId=getUserId(jComboBox1.getSelectedItem().toString()); 304 | String reason=jTextArea1.getText(); 305 | 306 | if(reason.trim().length()==0){ 307 | OptionHelper.showMessage("Please enter the rejection remarks."); 308 | return; 309 | } 310 | 311 | 312 | String sql="update userinfo set ActiveFlag=2 where userid ="+distributorId; 313 | int rows=ConnectionManager.executeUpdate(sql,null); 314 | 315 | 316 | if(rows>0){ 317 | OptionHelper.showMessage("Agent has been blocked."); 318 | try{ 319 | 320 | HashMap parameters=new HashMap(); 321 | parameters.put("to", mailid); 322 | parameters.put("from", GetSetProperties.p("GMAIL_ID")); 323 | parameters.put("user", GetSetProperties.p("GMAIL_ID")); 324 | parameters.put("password", GetSetProperties.p("GMAIL_PASS")); 325 | parameters.put("subject","Your Login Id has been deactivated by distributor "+UserSession.loggedInUser.getFName()+" "+UserSession.loggedInUser.getLName()); 326 | parameters.put("body", "Rejection Remarks are "+jTextArea1.getText()); 327 | new MailUtility().sendEmail(parameters); 328 | }catch(Exception e){ 329 | e.printStackTrace();; 330 | } 331 | 332 | 333 | 334 | }else{ 335 | OptionHelper.showError("Error while blocking the agent!!","Error"); 336 | 337 | } 338 | 339 | 340 | }//GEN-LAST:event_jButton1ActionPerformed 341 | 342 | private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox1ItemStateChanged 343 | // TODO add your handling code here: 344 | }//GEN-LAST:event_jComboBox1ItemStateChanged 345 | 346 | public static int index = 0; 347 | 348 | // File srcPath = new File("E:/vidio songs/NEW SONGS"); 349 | 350 | /** 351 | * @param args the command line arguments 352 | */ 353 | public static void main(String args[]) { 354 | java.awt.EventQueue.invokeLater(new Runnable() { 355 | 356 | public void run() { 357 | try { 358 | 359 | new UserManamgement().setVisible(true); 360 | } catch (Exception ex) { 361 | Logger.getLogger(UserManamgement.class.getName()).log(Level.SEVERE, null, ex); 362 | } 363 | } 364 | }); 365 | } 366 | 367 | // Variables declaration - do not modify//GEN-BEGIN:variables 368 | private javax.swing.JButton jButton1; 369 | private javax.swing.JComboBox jComboBox1; 370 | private javax.swing.JDialog jDialog1; 371 | private javax.swing.JDialog jDialog2; 372 | private javax.swing.JDialog jDialog3; 373 | private javax.swing.JDialog jDialog4; 374 | private javax.swing.JDialog jDialog5; 375 | private javax.swing.JFileChooser jFileChooser1; 376 | private javax.swing.JLabel jLabel2; 377 | private javax.swing.JLabel jLabel3; 378 | private javax.swing.JPanel jPanel3; 379 | private javax.swing.JScrollPane jScrollPane1; 380 | private javax.swing.JScrollPane jScrollPane2; 381 | private javax.swing.JScrollPane jScrollPane3; 382 | private javax.swing.JTable jTable1; 383 | private javax.swing.JTable jTable2; 384 | private javax.swing.JTextArea jTextArea1; 385 | // End of variables declaration//GEN-END:variables 386 | } 387 | -------------------------------------------------------------------------------- /src/com/forms/ChangePassword.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | /* 7 | * LoginForm.java 8 | * 9 | * Created on Dec 8, 2011, 10:46:36 AM 10 | */ 11 | 12 | package com.forms; 13 | 14 | import com.dao.ConnectionManager; 15 | import java.awt.HeadlessException; 16 | import javax.swing.JOptionPane; 17 | import org.netbeans.validation.api.Problem; 18 | import org.netbeans.validation.api.builtin.Validators; 19 | import org.netbeans.validation.api.ui.ValidationGroup; 20 | 21 | import com.dao.UserDAO; 22 | import com.helper.GetSetProperties; 23 | import com.helper.SimpleCrypto; 24 | import com.helper.UserSession; 25 | import java.awt.event.KeyEvent; 26 | import org.openide.util.Exceptions; 27 | 28 | /** 29 | * 30 | * @author Admin 31 | */ 32 | public class ChangePassword extends javax.swing.JFrame { 33 | ValidationGroup vg; 34 | /** Creates new form LoginForm */ 35 | public ChangePassword() { 36 | initComponents(); 37 | swinghelper.SwingUtilities.setScreenCenter(this); 38 | 39 | vg= validationPanel1.getValidationGroup(); 40 | //vg.add(jTextField1, ValidationStrategy.DEFAULT, null) 41 | vg.add(jPasswordField1, Validators.REQUIRE_NON_EMPTY_STRING, 42 | Validators.NO_WHITESPACE); 43 | 44 | vg.add(jPasswordField2, Validators.REQUIRE_NON_EMPTY_STRING, 45 | Validators.NO_WHITESPACE); 46 | vg.add(jPasswordField3, Validators.REQUIRE_NON_EMPTY_STRING, 47 | Validators.NO_WHITESPACE); 48 | } 49 | 50 | public boolean performLogin() throws HeadlessException { 51 | // TODO add your handling code here: 52 | Problem p = vg.validateAll(); 53 | String msg = ""; 54 | if (p != null) { 55 | msg = p.getMessage(); 56 | } 57 | System.out.println("msg " + msg); 58 | if (msg.length() == 0) { 59 | jButton2.setEnabled(false); 60 | 61 | String UserPassword=jPasswordField1.getText(); 62 | try { 63 | UserPassword = SimpleCrypto.encrypt(GetSetProperties.getProperty("SEED_KEY"), UserPassword); 64 | } catch (Exception ex) { 65 | Exceptions.printStackTrace(ex); 66 | } 67 | 68 | String oldUserPassword=jPasswordField3.getText(); 69 | try { 70 | oldUserPassword = SimpleCrypto.encrypt(GetSetProperties.getProperty("SEED_KEY"), oldUserPassword); 71 | } catch (Exception ex) { 72 | Exceptions.printStackTrace(ex); 73 | } 74 | 75 | 76 | String query="update userinfo set UserPassword='%s',changepassword=CURRENT_TIMESTAMP where userid="+UserSession.loggedInUser.getUserId()+" and UserPassword='"+oldUserPassword+"'"; 77 | query=String.format(query, UserPassword); 78 | 79 | int rows=ConnectionManager.executeUpdate(query, null); 80 | if (rows>0) { 81 | JOptionPane.showMessageDialog(this, "Password Updated Successfully!!!"); 82 | this.setVisible(false); 83 | } else { 84 | JOptionPane.showMessageDialog(this, "Incorrect Old password!!!"); 85 | jPasswordField1.setText(""); 86 | jPasswordField2.setText(""); 87 | jPasswordField3.setText(""); 88 | 89 | 90 | return true; 91 | } 92 | } 93 | return false; 94 | } 95 | 96 | /** This method is called from within the constructor to 97 | * initialize the form. 98 | * WARNING: Do NOT modify this code. The content of this method is 99 | * always regenerated by the Form Editor. 100 | */ 101 | @SuppressWarnings("unchecked") 102 | // <editor-fold defaultstate="collapsed" desc="Generated Code"> 103 | private void initComponents() { 104 | 105 | jPanel1 = new javax.swing.JPanel(); 106 | jPanel2 = new javax.swing.JPanel(); 107 | jLabel2 = new javax.swing.JLabel(); 108 | jLabel3 = new javax.swing.JLabel(); 109 | jButton2 = new javax.swing.JButton(); 110 | jPasswordField1 = new javax.swing.JPasswordField(); 111 | jButton1 = new javax.swing.JButton(); 112 | jLabel4 = new javax.swing.JLabel(); 113 | jPasswordField2 = new javax.swing.JPasswordField(); 114 | jPasswordField3 = new javax.swing.JPasswordField(); 115 | validationPanel1 = new org.netbeans.validation.api.ui.ValidationPanel(); 116 | 117 | jPanel1.setName("jPanel1"); // NOI18N 118 | 119 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); 120 | jPanel1.setLayout(jPanel1Layout); 121 | jPanel1Layout.setHorizontalGroup( 122 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 123 | .addGap(0, 100, Short.MAX_VALUE) 124 | ); 125 | jPanel1Layout.setVerticalGroup( 126 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 127 | .addGap(0, 100, Short.MAX_VALUE) 128 | ); 129 | 130 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(ChangePassword.class); 131 | setTitle(resourceMap.getString("title")); // NOI18N 132 | 133 | jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Change Password", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel2.border.titleFont"))); // NOI18N 134 | jPanel2.setToolTipText(resourceMap.getString("jPanel2.toolTipText")); // NOI18N 135 | jPanel2.setName("jPanel2"); // NOI18N 136 | 137 | jLabel2.setFont(new java.awt.Font("Verdana", 0, 12)); 138 | jLabel2.setText("Old Password"); 139 | jLabel2.setName("jLabel2"); // NOI18N 140 | 141 | jLabel3.setFont(new java.awt.Font("Verdana", 0, 12)); 142 | jLabel3.setText("New Password"); 143 | jLabel3.setName("jLabel3"); // NOI18N 144 | 145 | jButton2.setFont(new java.awt.Font("Verdana", 0, 12)); 146 | jButton2.setText("Update"); 147 | jButton2.setName("jButton2"); // NOI18N 148 | jButton2.addActionListener(new java.awt.event.ActionListener() { 149 | public void actionPerformed(java.awt.event.ActionEvent evt) { 150 | jButton2ActionPerformed(evt); 151 | } 152 | }); 153 | 154 | jPasswordField1.setName("Password "); // NOI18N 155 | jPasswordField1.addKeyListener(new java.awt.event.KeyAdapter() { 156 | public void keyPressed(java.awt.event.KeyEvent evt) { 157 | jPasswordField1KeyPressed(evt); 158 | } 159 | public void keyTyped(java.awt.event.KeyEvent evt) { 160 | jPasswordField1KeyTyped(evt); 161 | } 162 | }); 163 | 164 | jButton1.setFont(new java.awt.Font("Verdana", 0, 12)); 165 | jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N 166 | jButton1.setName("jButton1"); // NOI18N 167 | jButton1.addActionListener(new java.awt.event.ActionListener() { 168 | public void actionPerformed(java.awt.event.ActionEvent evt) { 169 | jButton1ActionPerformed(evt); 170 | } 171 | }); 172 | 173 | jLabel4.setFont(new java.awt.Font("Verdana", 0, 12)); 174 | jLabel4.setText("Confirm Pass"); 175 | jLabel4.setName("jLabel4"); // NOI18N 176 | 177 | jPasswordField2.setName("jPasswordField2"); // NOI18N 178 | jPasswordField2.addKeyListener(new java.awt.event.KeyAdapter() { 179 | public void keyPressed(java.awt.event.KeyEvent evt) { 180 | jPasswordField2KeyPressed(evt); 181 | } 182 | public void keyTyped(java.awt.event.KeyEvent evt) { 183 | jPasswordField2KeyTyped(evt); 184 | } 185 | }); 186 | 187 | jPasswordField3.setName("jPasswordField3"); // NOI18N 188 | jPasswordField3.addKeyListener(new java.awt.event.KeyAdapter() { 189 | public void keyPressed(java.awt.event.KeyEvent evt) { 190 | jPasswordField3KeyPressed(evt); 191 | } 192 | public void keyTyped(java.awt.event.KeyEvent evt) { 193 | jPasswordField3KeyTyped(evt); 194 | } 195 | }); 196 | 197 | validationPanel1.setName("validationPanel1"); // NOI18N 198 | 199 | javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); 200 | jPanel2.setLayout(jPanel2Layout); 201 | jPanel2Layout.setHorizontalGroup( 202 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 203 | .addGroup(jPanel2Layout.createSequentialGroup() 204 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 205 | .addGroup(jPanel2Layout.createSequentialGroup() 206 | .addGap(56, 56, 56) 207 | .addComponent(jButton2) 208 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 209 | .addComponent(jButton1)) 210 | .addGroup(jPanel2Layout.createSequentialGroup() 211 | .addContainerGap() 212 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 213 | .addGroup(jPanel2Layout.createSequentialGroup() 214 | .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) 215 | .addGap(18, 18, 18) 216 | .addComponent(jPasswordField3, javax.swing.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE)) 217 | .addGroup(jPanel2Layout.createSequentialGroup() 218 | .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) 219 | .addGap(18, 18, 18) 220 | .addComponent(jPasswordField1, javax.swing.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE)))) 221 | .addGroup(jPanel2Layout.createSequentialGroup() 222 | .addContainerGap() 223 | .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) 224 | .addGap(18, 18, 18) 225 | .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)) 226 | .addGroup(jPanel2Layout.createSequentialGroup() 227 | .addContainerGap() 228 | .addComponent(validationPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 285, Short.MAX_VALUE))) 229 | .addContainerGap()) 230 | ); 231 | jPanel2Layout.setVerticalGroup( 232 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 233 | .addGroup(jPanel2Layout.createSequentialGroup() 234 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 235 | .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) 236 | .addComponent(jPasswordField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 237 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 238 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 239 | .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) 240 | .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 241 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 242 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 243 | .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) 244 | .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 245 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 246 | .addComponent(validationPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) 247 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 248 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 249 | .addComponent(jButton2) 250 | .addComponent(jButton1))) 251 | ); 252 | 253 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 254 | getContentPane().setLayout(layout); 255 | layout.setHorizontalGroup( 256 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 257 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 258 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 259 | .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 260 | .addContainerGap()) 261 | ); 262 | layout.setVerticalGroup( 263 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 264 | .addGroup(layout.createSequentialGroup() 265 | .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 266 | .addContainerGap()) 267 | ); 268 | 269 | jPanel2.getAccessibleContext().setAccessibleName(resourceMap.getString("jPanel2.AccessibleContext.accessibleName")); // NOI18N 270 | jPanel2.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jPanel2.AccessibleContext.accessibleDescription")); // NOI18N 271 | 272 | pack(); 273 | }// </editor-fold> 274 | 275 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 276 | performLogin(); 277 | jButton2.setEnabled(true); 278 | 279 | } 280 | 281 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 282 | // TODO add your handling code here: 283 | 284 | this.setVisible(false); 285 | 286 | } 287 | 288 | private void jPasswordField1KeyTyped(java.awt.event.KeyEvent evt) { 289 | // TODO add your handling code here: 290 | 291 | 292 | 293 | } 294 | 295 | private void jPasswordField1KeyPressed(java.awt.event.KeyEvent evt) { 296 | // TODO add your handling code here: 297 | System.out.println(" evt.getKeyCode() "+evt.getKeyCode()); 298 | if(evt.getKeyCode()==KeyEvent.VK_ENTER){ 299 | performLogin(); 300 | } 301 | } 302 | 303 | private void jPasswordField2KeyPressed(java.awt.event.KeyEvent evt) { 304 | // TODO add your handling code here: 305 | } 306 | 307 | private void jPasswordField2KeyTyped(java.awt.event.KeyEvent evt) { 308 | // TODO add your handling code here: 309 | } 310 | 311 | private void jPasswordField3KeyPressed(java.awt.event.KeyEvent evt) { 312 | // TODO add your handling code here: 313 | } 314 | 315 | private void jPasswordField3KeyTyped(java.awt.event.KeyEvent evt) { 316 | // TODO add your handling code here: 317 | } 318 | 319 | /** 320 | * @param args the command line arguments 321 | */ 322 | public static void main(String args[]) { 323 | java.awt.EventQueue.invokeLater(new Runnable() { 324 | public void run() { 325 | 326 | // UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); 327 | // UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); 328 | // UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); 329 | 330 | // swinghelper.SwingUtilities.applyLiquidtheme(); 331 | new ChangePassword().setVisible(true); 332 | 333 | 334 | } 335 | }); 336 | } 337 | 338 | // Variables declaration - do not modify 339 | private javax.swing.JButton jButton1; 340 | private javax.swing.JButton jButton2; 341 | private javax.swing.JLabel jLabel2; 342 | private javax.swing.JLabel jLabel3; 343 | private javax.swing.JLabel jLabel4; 344 | private javax.swing.JPanel jPanel1; 345 | private javax.swing.JPanel jPanel2; 346 | private javax.swing.JPasswordField jPasswordField1; 347 | private javax.swing.JPasswordField jPasswordField2; 348 | private javax.swing.JPasswordField jPasswordField3; 349 | private org.netbeans.validation.api.ui.ValidationPanel validationPanel1; 350 | // End of variables declaration 351 | 352 | } 353 | -------------------------------------------------------------------------------- /src/com/forms/AgentRequests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | /* 7 | * BackupFolder.java 8 | * 9 | * Created on Jan 19, 2010, 11:58:41 AM 10 | */ 11 | package com.forms; 12 | 13 | import java.awt.event.ItemEvent; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import com.dao.UserDAO; 17 | import com.helper.Constants; 18 | import com.model.UserModel; 19 | import java.awt.event.ItemListener; 20 | import java.util.Iterator; 21 | import java.util.List; 22 | import javax.swing.DefaultComboBoxModel; 23 | import swinghelper.OptionHelper; 24 | 25 | 26 | /** 27 | * 28 | * @author Administrator 29 | */ 30 | public class AgentRequests extends javax.swing.JInternalFrame { 31 | public static List activeUserList = null; 32 | private int WARNING_MESSAGE; 33 | DefaultComboBoxModel dm,dm2; 34 | // public static ArrayList arr = null, arr1 = null; 35 | MainForm jd; 36 | /** Creates new form BackupFolder */ 37 | public AgentRequests() throws Exception { 38 | System.out.println("BackupFolder"); 39 | initComponents(); 40 | // swinghelper.SwingUtilities.setScreenCenter(this); 41 | UserDAO u = new UserDAO(); 42 | // u.CheckForPendingFiles(jTableDisplay); 43 | // jd=(MainForm) this.getParent().getParent(); 44 | AgentRequests.activeUserList= u.getUsers(Constants.DISTRIBUTOR_ROLL_ID+""); 45 | dm=(DefaultComboBoxModel) jComboBox1.getModel(); 46 | dm2=(DefaultComboBoxModel) jComboBox2.getModel(); 47 | dm.removeAllElements();; 48 | dm2.removeAllElements();; 49 | for (Iterator it = AgentRequests.activeUserList.iterator(); it.hasNext();) { 50 | UserModel object = (UserModel) it.next(); 51 | System.out.println("Adding Element "+object.getFName() + " " + object.getLName()); 52 | dm.addElement(object.getCity()); 53 | dm2.addElement(object.getFName()+" "+object.getLName()); 54 | } 55 | jComboBox1.updateUI(); 56 | jComboBox2.updateUI(); 57 | jComboBox1.addItemListener(new ItemListener() { 58 | 59 | public void itemStateChanged(ItemEvent e) { 60 | String selVal=jComboBox1.getSelectedItem().toString(); 61 | dm2.removeAllElements();; 62 | for (Iterator it = AgentRequests.activeUserList.iterator(); it.hasNext();) { 63 | UserModel object = (UserModel) it.next(); 64 | System.out.println(" In Item state listener "+object.getFName() + " " + object.getLName()); 65 | if(selVal.equalsIgnoreCase(object.getCity())){ 66 | dm2.addElement(object.getFName()+" "+object.getLName()); 67 | 68 | } 69 | } 70 | 71 | } 72 | }); 73 | 74 | 75 | } 76 | public String getUserId(String username) { 77 | String userId = "-1"; 78 | 79 | for (int i = 0; i < AgentRequests.activeUserList.size(); i++) { 80 | UserModel object = (UserModel) AgentRequests.activeUserList.get(i); 81 | String uname = object.getFName() + " " + object.getLName().trim(); 82 | 83 | if (uname.equalsIgnoreCase(username.trim())) { 84 | userId = object.getUserId(); 85 | break; 86 | } 87 | } 88 | return userId; 89 | } 90 | private boolean checkForRepeatedPath() { 91 | 92 | return true; 93 | } 94 | 95 | /** This method is called from within the constructor to 96 | * initialize the form. 97 | * WARNING: Do NOT modify this code. The content of this method is 98 | * always regenerated by the Form Editor. 99 | */ 100 | @SuppressWarnings("unchecked") 101 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 102 | private void initComponents() { 103 | 104 | jDialog1 = new javax.swing.JDialog(); 105 | jDialog2 = new javax.swing.JDialog(); 106 | jDialog3 = new javax.swing.JDialog(); 107 | jDialog4 = new javax.swing.JDialog(); 108 | jDialog5 = new javax.swing.JDialog(); 109 | jFileChooser1 = new javax.swing.JFileChooser(); 110 | jScrollPane2 = new javax.swing.JScrollPane(); 111 | jTable1 = new javax.swing.JTable(); 112 | jScrollPane3 = new javax.swing.JScrollPane(); 113 | jTable2 = new javax.swing.JTable(); 114 | jPanel3 = new javax.swing.JPanel(); 115 | jLabel1 = new javax.swing.JLabel(); 116 | jLabel2 = new javax.swing.JLabel(); 117 | jComboBox1 = new javax.swing.JComboBox(); 118 | jLabel3 = new javax.swing.JLabel(); 119 | jComboBox2 = new javax.swing.JComboBox(); 120 | jButton1 = new javax.swing.JButton(); 121 | jTextField1 = new javax.swing.JTextField(); 122 | 123 | org.jdesktop.layout.GroupLayout jDialog1Layout = new org.jdesktop.layout.GroupLayout(jDialog1.getContentPane()); 124 | jDialog1.getContentPane().setLayout(jDialog1Layout); 125 | jDialog1Layout.setHorizontalGroup( 126 | jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 127 | .add(0, 400, Short.MAX_VALUE) 128 | ); 129 | jDialog1Layout.setVerticalGroup( 130 | jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 131 | .add(0, 300, Short.MAX_VALUE) 132 | ); 133 | 134 | org.jdesktop.layout.GroupLayout jDialog2Layout = new org.jdesktop.layout.GroupLayout(jDialog2.getContentPane()); 135 | jDialog2.getContentPane().setLayout(jDialog2Layout); 136 | jDialog2Layout.setHorizontalGroup( 137 | jDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 138 | .add(0, 400, Short.MAX_VALUE) 139 | ); 140 | jDialog2Layout.setVerticalGroup( 141 | jDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 142 | .add(0, 300, Short.MAX_VALUE) 143 | ); 144 | 145 | org.jdesktop.layout.GroupLayout jDialog3Layout = new org.jdesktop.layout.GroupLayout(jDialog3.getContentPane()); 146 | jDialog3.getContentPane().setLayout(jDialog3Layout); 147 | jDialog3Layout.setHorizontalGroup( 148 | jDialog3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 149 | .add(0, 400, Short.MAX_VALUE) 150 | ); 151 | jDialog3Layout.setVerticalGroup( 152 | jDialog3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 153 | .add(0, 300, Short.MAX_VALUE) 154 | ); 155 | 156 | org.jdesktop.layout.GroupLayout jDialog4Layout = new org.jdesktop.layout.GroupLayout(jDialog4.getContentPane()); 157 | jDialog4.getContentPane().setLayout(jDialog4Layout); 158 | jDialog4Layout.setHorizontalGroup( 159 | jDialog4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 160 | .add(0, 400, Short.MAX_VALUE) 161 | ); 162 | jDialog4Layout.setVerticalGroup( 163 | jDialog4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 164 | .add(0, 300, Short.MAX_VALUE) 165 | ); 166 | 167 | org.jdesktop.layout.GroupLayout jDialog5Layout = new org.jdesktop.layout.GroupLayout(jDialog5.getContentPane()); 168 | jDialog5.getContentPane().setLayout(jDialog5Layout); 169 | jDialog5Layout.setHorizontalGroup( 170 | jDialog5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 171 | .add(0, 400, Short.MAX_VALUE) 172 | ); 173 | jDialog5Layout.setVerticalGroup( 174 | jDialog5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 175 | .add(0, 300, Short.MAX_VALUE) 176 | ); 177 | 178 | jFileChooser1.setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY); 179 | 180 | jTable1.setModel(new javax.swing.table.DefaultTableModel( 181 | new Object [][] { 182 | {null, null, null, null}, 183 | {null, null, null, null}, 184 | {null, null, null, null}, 185 | {null, null, null, null} 186 | }, 187 | new String [] { 188 | "Title 1", "Title 2", "Title 3", "Title 4" 189 | } 190 | )); 191 | jScrollPane2.setViewportView(jTable1); 192 | 193 | jTable2.setModel(new javax.swing.table.DefaultTableModel( 194 | new Object [][] { 195 | {null, null, null, null}, 196 | {null, null, null, null}, 197 | {null, null, null, null}, 198 | {null, null, null, null} 199 | }, 200 | new String [] { 201 | "Title 1", "Title 2", "Title 3", "Title 4" 202 | } 203 | )); 204 | jScrollPane3.setViewportView(jTable2); 205 | 206 | setClosable(true); 207 | setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE); 208 | setMaximizable(true); 209 | setResizable(true); 210 | org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(AgentRequests.class); 211 | setTitle(resourceMap.getString("title")); // NOI18N 212 | setToolTipText(resourceMap.getString("title")); // NOI18N 213 | setName("Peer2peer Trust Framework"); // NOI18N 214 | 215 | jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Sharing Details")); 216 | 217 | jLabel1.setText("Data Request Description"); 218 | 219 | jLabel2.setText("Select Region"); 220 | 221 | jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); 222 | jComboBox1.addItemListener(new java.awt.event.ItemListener() { 223 | public void itemStateChanged(java.awt.event.ItemEvent evt) { 224 | jComboBox1ItemStateChanged(evt); 225 | } 226 | }); 227 | 228 | jLabel3.setText("Select Distributor"); 229 | 230 | jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); 231 | 232 | jButton1.setText("Send Request"); 233 | jButton1.addActionListener(new java.awt.event.ActionListener() { 234 | public void actionPerformed(java.awt.event.ActionEvent evt) { 235 | jButton1ActionPerformed(evt); 236 | } 237 | }); 238 | 239 | org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); 240 | jPanel3.setLayout(jPanel3Layout); 241 | jPanel3Layout.setHorizontalGroup( 242 | jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 243 | .add(jPanel3Layout.createSequentialGroup() 244 | .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 245 | .add(jPanel3Layout.createSequentialGroup() 246 | .add(24, 24, 24) 247 | .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 248 | .add(jLabel2) 249 | .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 132, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 250 | .add(jLabel3)) 251 | .add(54, 54, 54) 252 | .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) 253 | .add(jComboBox2, 0, 229, Short.MAX_VALUE) 254 | .add(jComboBox1, 0, 229, Short.MAX_VALUE) 255 | .add(jTextField1))) 256 | .add(jPanel3Layout.createSequentialGroup() 257 | .add(170, 170, 170) 258 | .add(jButton1))) 259 | .addContainerGap(364, Short.MAX_VALUE)) 260 | ); 261 | jPanel3Layout.setVerticalGroup( 262 | jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 263 | .add(jPanel3Layout.createSequentialGroup() 264 | .addContainerGap() 265 | .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 266 | .add(jPanel3Layout.createSequentialGroup() 267 | .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 268 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) 269 | .add(jLabel2)) 270 | .add(jPanel3Layout.createSequentialGroup() 271 | .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 272 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) 273 | .add(jComboBox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) 274 | .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 275 | .add(jPanel3Layout.createSequentialGroup() 276 | .add(20, 20, 20) 277 | .add(jLabel3)) 278 | .add(jPanel3Layout.createSequentialGroup() 279 | .add(18, 18, 18) 280 | .add(jComboBox2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) 281 | .add(28, 28, 28) 282 | .add(jButton1) 283 | .addContainerGap(41, Short.MAX_VALUE)) 284 | ); 285 | 286 | org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); 287 | getContentPane().setLayout(layout); 288 | layout.setHorizontalGroup( 289 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 290 | .add(layout.createSequentialGroup() 291 | .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 292 | .addContainerGap()) 293 | ); 294 | layout.setVerticalGroup( 295 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 296 | .add(layout.createSequentialGroup() 297 | .add(28, 28, 28) 298 | .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 299 | .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 300 | ); 301 | 302 | getAccessibleContext().setAccessibleName(resourceMap.getString("title")); // NOI18N 303 | getAccessibleContext().setAccessibleDescription(resourceMap.getString("title")); // NOI18N 304 | getAccessibleContext().setAccessibleParent(this); 305 | 306 | pack(); 307 | }// </editor-fold>//GEN-END:initComponents 308 | 309 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed 310 | // TODO add your handling code here: 311 | 312 | if (jComboBox1.getSelectedIndex()==-1) { 313 | OptionHelper.showMessage("Please Select City"); 314 | return; 315 | 316 | } 317 | 318 | String distributorId=getUserId(jComboBox2.getSelectedItem().toString()); 319 | String fileDescr=jTextField1.getText(); 320 | 321 | if(fileDescr.trim().length()==0){ 322 | OptionHelper.showMessage("Please enter the file description."); 323 | return; 324 | } 325 | 326 | 327 | boolean success=new UserDAO().addAgentRequest(fileDescr, distributorId); 328 | if(success){ 329 | OptionHelper.showMessage("Request has been sent."); 330 | }else{ 331 | OptionHelper.showError("Error sending request !!","Error"); 332 | } 333 | 334 | 335 | }//GEN-LAST:event_jButton1ActionPerformed 336 | 337 | private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox1ItemStateChanged 338 | // TODO add your handling code here: 339 | }//GEN-LAST:event_jComboBox1ItemStateChanged 340 | 341 | public static int index = 0; 342 | 343 | // File srcPath = new File("E:/vidio songs/NEW SONGS"); 344 | 345 | /** 346 | * @param args the command line arguments 347 | */ 348 | public static void main(String args[]) { 349 | java.awt.EventQueue.invokeLater(new Runnable() { 350 | 351 | public void run() { 352 | try { 353 | 354 | new AgentRequests().setVisible(true); 355 | } catch (Exception ex) { 356 | Logger.getLogger(AgentRequests.class.getName()).log(Level.SEVERE, null, ex); 357 | } 358 | } 359 | }); 360 | } 361 | 362 | // Variables declaration - do not modify//GEN-BEGIN:variables 363 | private javax.swing.JButton jButton1; 364 | private javax.swing.JComboBox jComboBox1; 365 | private javax.swing.JComboBox jComboBox2; 366 | private javax.swing.JDialog jDialog1; 367 | private javax.swing.JDialog jDialog2; 368 | private javax.swing.JDialog jDialog3; 369 | private javax.swing.JDialog jDialog4; 370 | private javax.swing.JDialog jDialog5; 371 | private javax.swing.JFileChooser jFileChooser1; 372 | private javax.swing.JLabel jLabel1; 373 | private javax.swing.JLabel jLabel2; 374 | private javax.swing.JLabel jLabel3; 375 | private javax.swing.JPanel jPanel3; 376 | private javax.swing.JScrollPane jScrollPane2; 377 | private javax.swing.JScrollPane jScrollPane3; 378 | private javax.swing.JTable jTable1; 379 | private javax.swing.JTable jTable2; 380 | private javax.swing.JTextField jTextField1; 381 | // End of variables declaration//GEN-END:variables 382 | } 383 | --------------------------------------------------------------------------------