Skip to content

Commit

Permalink
UI
Browse files Browse the repository at this point in the history
  • Loading branch information
vbankov committed Dec 20, 2014
1 parent b9bc1d5 commit 07d9f53
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Java RMI Election App
###Assignment for "Distributed Systems & Web Services" Class (323-300400)

ICSD MSc Course,
University of the Aegean
(c) 2014, MIT License
2 changes: 1 addition & 1 deletion build/built-jar.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Sun, 14 Dec 2014 00:54:58 +0200
#Sat, 20 Dec 2014 17:46:31 +0200


C\:\\Users\\vasilis\\Desktop\\MSc\\323-300400\ DistSys-WebServ\\Homework\\RMI\\repo\\java-rmi=
Binary file modified build/classes/ElectionServer.class
Binary file not shown.
Binary file modified dist/Election.jar
Binary file not shown.
8 changes: 5 additions & 3 deletions src/ElectionClientUI.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License
*
* Copyright 2014 vasilis.
* Copyright 2014 Vasilis Bankov, George Peppas, Maria Theodoraki.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -380,16 +380,18 @@ private void voteBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST
System.out.println("iCanVoteForSure status is "+iCanVoteForSure);
voteBtn.setEnabled(iCanVoteForSure);
if(iCanVoteForSure==true){
statusLabel.setText("Your vote was casted");
statusLabel.setText("Your vote was successfully casted!");
voteWasCasted = this.theElection.vote(iAmVoter, selectedCandidate);
ElectionClientUI.voteRight = this.theElection.canVote(voterID);
voteBtn.setEnabled(ElectionClientUI.voteRight);
}else{
statusLabel.setText("Oops! The Server actively denied your vote");
}
} catch (RemoteException | SQLException ex) {
Logger.getLogger(ElectionClientUI.class.getName()).log(Level.SEVERE, null, ex);
}
}else{
statusLabel.setText("Oops! It seems that you can not vote");
}
}//GEN-LAST:event_voteBtnActionPerformed

Expand Down
12 changes: 6 additions & 6 deletions src/ElectionServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.List;
import org.apache.derby.drda.NetworkServerControl;
import SecurityController.PasswordHandler;
import java.util.Collections;

public class ElectionServer {
private static final String DB_CONNECTION = "jdbc:derby://localhost:1527/DBElection";
Expand All @@ -48,11 +49,13 @@ public static void initializeDB() throws SQLException, UnknownHostException, Exc
stmt.execute(emptyTableCands);
// the candidates list is
List<String> listCandidates = new ArrayList<>();
listCandidates.add("Goofy");
listCandidates.add("Donald Duck");
listCandidates.add("Duffy Duck");
listCandidates.add("Goofy");
listCandidates.add("Mickey Mouse");
listCandidates.add("Pluto");
listCandidates.add("Uncle Scrooge");
// shuffle the list
Collections.shuffle(listCandidates);
// populate db with candidates
try{
conn.setAutoCommit(false);
Expand Down Expand Up @@ -111,11 +114,8 @@ public static void main (String args[]) throws RemoteException, SQLException, Ex
// bind election to registry
registry.rebind(name, newElection);

// shout out
// things shoulb be awesome now. inform the humans
System.out.println("Election service started: \tRMI magic happens on port 18300");




} // main
} // ElectionServer

0 comments on commit 07d9f53

Please sign in to comment.