id
stringlengths 36
36
| text
stringlengths 1
1.25M
|
---|---|
3627e4a2-b517-4184-b3b9-e6ff57e6fee3 | public int getDay(){
DateFormat dateFormat = new SimpleDateFormat("dd");
Date date = new Date();
return Integer.parseInt(dateFormat.format(date));
} |
36c16863-a1f4-4cc8-8a7f-42b7efbf7492 | public int getYear(){
DateFormat dateFormat = new SimpleDateFormat("yyyy");
Date date = new Date();
return Integer.parseInt(dateFormat.format(date));
} |
27ae140a-ce3d-43eb-8b87-14cc34d88096 | ClubDoors(){
super("Club Doors"); //Title name
this.setup(); // Setup the GUI
// Make a startup class to quickly veryfy the database IP
new Startup();
} |
d969f367-31ef-460b-a5c8-e5bd58714287 | public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
new ClubDoors();
} |
ed28c4b3-78d4-402d-a26d-ec0965ffb3d2 | public final void setup(){
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(640,480);
setVisible(true);
setResizable(true);
getContentPane().add(this.mainPanel);
//MainPanel
this.mainPanel.errorLabel.setVisible(false);
this.mainPanel.fiveButton.addActionListener(this);
this.mainPanel.tenButton.addActionListener(this);
this.mainPanel.twentyButton.addActionListener(this);
this.mainPanel.gameButton.addActionListener(this);
this.mainPanel.managerButton.addActionListener(this);
this.mainPanel.compButton.addActionListener(this);
this.mainPanel.doorButton.addActionListener(this);
this.mainPanel.hotelButton.addActionListener(this);
this.mainPanel.reportsButton.addActionListener(this);
this.mainPanel.one.addActionListener(this);
this.mainPanel.two.addActionListener(this);
this.mainPanel.three.addActionListener(this);
this.mainPanel.four.addActionListener(this);
this.mainPanel.five.addActionListener(this);
this.mainPanel.six.addActionListener(this);
this.mainPanel.seven.addActionListener(this);
this.mainPanel.eight.addActionListener(this);
this.mainPanel.nine.addActionListener(this);
this.mainPanel.zero.addActionListener(this);
this.mainPanel.clearButton.addActionListener(this);
//ReportsPanel
this.reportsPanel.backButton.addActionListener(this);
this.reportsPanel.zButton.addActionListener(this);
this.reportsPanel.dateButton.addActionListener(this);
//PassFrame
this.passFrame.one.addActionListener(this);
this.passFrame.two.addActionListener(this);
this.passFrame.three.addActionListener(this);
this.passFrame.four.addActionListener(this);
this.passFrame.five.addActionListener(this);
this.passFrame.six.addActionListener(this);
this.passFrame.seven.addActionListener(this);
this.passFrame.eight.addActionListener(this);
this.passFrame.nine.addActionListener(this);
this.passFrame.zero.addActionListener(this);
this.passFrame.clearButton.addActionListener(this);
this.passFrame.submitButton.addActionListener(this);
this.passFrame.cancelButton.addActionListener(this);
//DateFrame
this.dateFrame.cancelButton.addActionListener(this);
this.dateFrame.submitButton.addActionListener(this);
this.setupDates();
this.dateFrame.reset();
} |
2f6b999e-44e6-435e-a802-2947b1355143 | public final void setupDates(){
DateFormat dateFormat = new SimpleDateFormat("yyyy");
Date date = new Date();
int cYear = Integer.parseInt(dateFormat.format(date));
ArrayList years = new ArrayList();
for(int i=cYear-5; i<=cYear+5; i++){
this.dateFrame.yearBox.addItem(i);
this.dateFrame.yearBoxTo.addItem(i);
}
} |
ffc1d383-ba55-4cdc-97d7-14b5cacb1b64 | public void actionPerformed(ActionEvent e) {
// Whenever anything happens clear the error
this.mainPanel.errorLabel.setVisible(false);
//MainPanel
if(e.getSource() == mainPanel.fiveButton){
this.printAddClear("$5");
}
if(e.getSource() == mainPanel.tenButton){
this.printAddClear("$10");
}
if(e.getSource() == mainPanel.twentyButton){
this.printAddClear("$20");
}
if(e.getSource() == mainPanel.gameButton){
this.printAddClear("G-Tix");
}
if(e.getSource() == mainPanel.managerButton){
this.printAddClear("Mgr Comp");
}
if(e.getSource() == mainPanel.compButton){
this.printAddClear("Comp Pass");
}
if(e.getSource() == mainPanel.doorButton){
this.printAddClear("Comp");
}
if(e.getSource() == mainPanel.hotelButton){
this.printAddClear("Hotel");
}
if(e.getSource() == mainPanel.clearButton){
this.mainPanel.clear();
}
if(e.getSource() == mainPanel.reportsButton){
this.passFrame.setVisible(true);
}
//ReportsPanel
if(e.getSource() == reportsPanel.backButton){
getContentPane().remove(reportsPanel);
getContentPane().add(mainPanel);
}
if(e.getSource() == reportsPanel.zButton){
this.printZ();
}
if(e.getSource() == reportsPanel.dateButton){
this.dateFrame.setVisible(true);
}
//PassFrame
if(e.getSource() == passFrame.cancelButton){
this.passFrame.clear();
this.passFrame.setVisible(false);
}
if(e.getSource() == passFrame.clearButton){
this.passFrame.clear();
}
if(e.getSource() == passFrame.submitButton){
if(this.passFrame.checkPass()){
this.passFrame.clear();
this.passFrame.setVisible(false);
getContentPane().remove(mainPanel);
getContentPane().add(reportsPanel);
}else{
new ClubException("Invalid Password",
"The password you entered is incorrect.");
this.passFrame.clear();
}
}
//DateFrame
if(e.getSource() == dateFrame.cancelButton){
this.dateFrame.reset();
this.dateFrame.setVisible(false);
}
if(e.getSource() == dateFrame.submitButton){
this.printDate();
}
//Numbers
if(e.getSource() == mainPanel.one){this.mainPanel.add(1);}
if(e.getSource() == mainPanel.two){this.mainPanel.add(2);}
if(e.getSource() == mainPanel.three){this.mainPanel.add(3);}
if(e.getSource() == mainPanel.four){this.mainPanel.add(4);}
if(e.getSource() == mainPanel.five){this.mainPanel.add(5);}
if(e.getSource() == mainPanel.six){this.mainPanel.add(6);}
if(e.getSource() == mainPanel.seven){this.mainPanel.add(7);}
if(e.getSource() == mainPanel.eight){this.mainPanel.add(8);}
if(e.getSource() == mainPanel.nine){this.mainPanel.add(9);}
if(e.getSource() == mainPanel.zero){this.mainPanel.add(0);}
if(e.getSource() == passFrame.one){this.passFrame.add(1);}
if(e.getSource() == passFrame.two){this.passFrame.add(2);}
if(e.getSource() == passFrame.three){this.passFrame.add(3);}
if(e.getSource() == passFrame.four){this.passFrame.add(4);}
if(e.getSource() == passFrame.five){this.passFrame.add(5);}
if(e.getSource() == passFrame.six){this.passFrame.add(6);}
if(e.getSource() == passFrame.seven){this.passFrame.add(7);}
if(e.getSource() == passFrame.eight){this.passFrame.add(8);}
if(e.getSource() == passFrame.nine){this.passFrame.add(9);}
if(e.getSource() == passFrame.zero){this.passFrame.add(0);}
//Repaint and validate after everything, just to be safe
getContentPane().repaint();
getContentPane().validate();
} |
f85e32d9-416d-4acf-9dfc-5a4fb4de0486 | public void printReceipt(String s){
try{
for(int i=1; i<=this.mainPanel.getNum(); i++){
this.receiptPrinter.print(s);
}
} catch(Exception ex){
this.mainPanel.errorLabel.setVisible(true);
}
} |
5eb77df6-477c-4194-bf48-6250e3c76076 | public void printZ(){
try{
this.zPrinter.print(
this.cons.mysql.getAdmissions(),
this.cons.mysql.lastZ());
this.cons.mysql.resetZ();
} catch(Exception ex){
new ClubException("Error Selecting from Database",
ex.toString());
}
} |
ef04e830-6b7e-4ab5-a0a9-95a5672eb550 | public void printDate(){
try{
this.datePrinter.print(
this.cons.mysql.getRangeAdmissions(
this.dateFrame.getFrom(),
this.dateFrame.getTo()),
this.dateFrame.getFromTo());
} catch(Exception ex){
new ClubException("Error Selecting from Database",
ex.toString());
}
} |
620ad992-4f7e-44a4-8783-68acb291fd97 | public void addToDatabase(String s){
try{
for(int i=1; i<=this.mainPanel.getNum(); i++){
this.cons.mysql.update("INSERT INTO tbl_admissions "
+ "(type, month, day, year, z, date) VALUES "
+ "('" + s // the given type
+ "', "+ this.cons.mysql.getMonth() // month
+ ", " + this.cons.mysql.getDay() // day
+ ", " + this.cons.mysql.getYear() // year
+ ", 0" // has it been z'd yet (0=no)
+ ", CURDATE())"); //The current date
}
} catch(Exception ex){
this.mainPanel.errorLabel.setVisible(true);
}
} |
1eb3b8d7-e947-43a3-9220-148c0116614b | public void printAddClear(String s){
this.printReceipt(s);
this.addToDatabase(s);
this.mainPanel.clear();
} |
eda02ca9-4fc4-4aa4-9cbd-69353a725fa7 | public ReportsPanel() {
initComponents();
} |
d71faa5b-d955-4169-8312-7244ec97cb1d | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
backButton = new javax.swing.JButton();
zButton = new javax.swing.JButton();
dateButton = new javax.swing.JButton();
setBackground(new java.awt.Color(255, 255, 255));
setMaximumSize(new java.awt.Dimension(640, 480));
setMinimumSize(new java.awt.Dimension(640, 480));
setPreferredSize(new java.awt.Dimension(640, 480));
backButton.setBackground(new java.awt.Color(0, 0, 0));
backButton.setFont(new java.awt.Font("Tahoma", 0, 14));
backButton.setForeground(new java.awt.Color(255, 255, 255));
backButton.setText("Back");
backButton.setName("backButton"); // NOI18N
zButton.setBackground(new java.awt.Color(0, 0, 0));
zButton.setFont(new java.awt.Font("Tahoma", 0, 18));
zButton.setForeground(new java.awt.Color(255, 255, 255));
zButton.setText("Z");
zButton.setName("zButton"); // NOI18N
dateButton.setBackground(new java.awt.Color(0, 0, 0));
dateButton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
dateButton.setForeground(new java.awt.Color(255, 255, 255));
dateButton.setText("Date Range");
dateButton.setName("dateButton"); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(zButton, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(dateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(347, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(dateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(zButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 289, Short.MAX_VALUE)
.addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents |
fcfffda0-5910-4368-ab32-8307b7348f5e | public PassFrame() {
initComponents();
} |
93d30065-0bba-492b-abb2-ec5f60b8a1f1 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
one = new javax.swing.JButton();
five = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
eight = new javax.swing.JButton();
submitButton = new javax.swing.JButton();
seven = new javax.swing.JButton();
four = new javax.swing.JButton();
clearButton = new javax.swing.JButton();
nine = new javax.swing.JButton();
passField = new javax.swing.JPasswordField();
passLebal = new javax.swing.JLabel();
three = new javax.swing.JButton();
two = new javax.swing.JButton();
zero = new javax.swing.JButton();
six = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(255, 255, 255));
one.setBackground(new java.awt.Color(0, 0, 0));
one.setFont(new java.awt.Font("Tahoma", 0, 24));
one.setForeground(new java.awt.Color(255, 255, 255));
one.setText("1");
one.setName("one"); // NOI18N
five.setBackground(new java.awt.Color(0, 0, 0));
five.setFont(new java.awt.Font("Tahoma", 0, 24));
five.setForeground(new java.awt.Color(255, 255, 255));
five.setText("5");
five.setName("five"); // NOI18N
cancelButton.setBackground(new java.awt.Color(0, 0, 0));
cancelButton.setFont(new java.awt.Font("Tahoma", 0, 14));
cancelButton.setForeground(new java.awt.Color(255, 255, 255));
cancelButton.setText("Cancel");
cancelButton.setName("cancelButton"); // NOI18N
eight.setBackground(new java.awt.Color(0, 0, 0));
eight.setFont(new java.awt.Font("Tahoma", 0, 24));
eight.setForeground(new java.awt.Color(255, 255, 255));
eight.setText("8");
eight.setName("eight"); // NOI18N
submitButton.setBackground(new java.awt.Color(0, 0, 0));
submitButton.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
submitButton.setForeground(new java.awt.Color(255, 255, 255));
submitButton.setText("Submit");
submitButton.setName("submitButton"); // NOI18N
seven.setBackground(new java.awt.Color(0, 0, 0));
seven.setFont(new java.awt.Font("Tahoma", 0, 24));
seven.setForeground(new java.awt.Color(255, 255, 255));
seven.setText("7");
seven.setName("seven"); // NOI18N
four.setBackground(new java.awt.Color(0, 0, 0));
four.setFont(new java.awt.Font("Tahoma", 0, 24));
four.setForeground(new java.awt.Color(255, 255, 255));
four.setText("4");
four.setName("four"); // NOI18N
clearButton.setBackground(new java.awt.Color(0, 0, 0));
clearButton.setFont(new java.awt.Font("Tahoma", 0, 24));
clearButton.setForeground(new java.awt.Color(255, 255, 255));
clearButton.setText("Clear");
clearButton.setName("clearButton"); // NOI18N
nine.setBackground(new java.awt.Color(0, 0, 0));
nine.setFont(new java.awt.Font("Tahoma", 0, 24));
nine.setForeground(new java.awt.Color(255, 255, 255));
nine.setText("9");
nine.setName("nine"); // NOI18N
passField.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
passField.setName("passField"); // NOI18N
passLebal.setFont(new java.awt.Font("Tahoma", 0, 14));
passLebal.setText("Please enter the manager password below:");
passLebal.setName("passLebal"); // NOI18N
three.setBackground(new java.awt.Color(0, 0, 0));
three.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
three.setForeground(new java.awt.Color(255, 255, 255));
three.setText("3");
three.setName("three"); // NOI18N
two.setBackground(new java.awt.Color(0, 0, 0));
two.setFont(new java.awt.Font("Tahoma", 0, 24));
two.setForeground(new java.awt.Color(255, 255, 255));
two.setText("2");
two.setName("two"); // NOI18N
zero.setBackground(new java.awt.Color(0, 0, 0));
zero.setFont(new java.awt.Font("Tahoma", 0, 24));
zero.setForeground(new java.awt.Color(255, 255, 255));
zero.setText("0");
zero.setName("zero"); // NOI18N
six.setBackground(new java.awt.Color(0, 0, 0));
six.setFont(new java.awt.Font("Tahoma", 0, 24));
six.setForeground(new java.awt.Color(255, 255, 255));
six.setText("6");
six.setName("six"); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(zero, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(clearButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(one, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(two, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(three, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(four, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(five, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(six, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(seven, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(eight, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(nine, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(120, 120, 120)
.addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(passLebal, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 303, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(passField, javax.swing.GroupLayout.DEFAULT_SIZE, 486, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(submitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(37, 37, 37))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(submitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(passLebal)
.addGap(18, 18, 18)
.addComponent(passField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(seven, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(eight, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(nine, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(four, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(five, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(six, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(one, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(three, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(two, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(zero, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(41, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents |
ab6ab5ef-fb29-47ce-9dde-d679f835ef39 | public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PassFrame().setVisible(true);
}
});
} |
c3f2dd1a-66e2-4899-982f-76841bbb90b7 | public void run() {
new PassFrame().setVisible(true);
} |
4b9d1e4f-a348-45c6-a650-66c341c4cb44 | public void clear(){
this.passField.setText("");
} |
6836f0fe-74fe-4e47-84d0-026aa72bf723 | public boolean checkPass(){
return this.get().equals("8008"); //CURRENT PASSWORD
} |
d59eb5aa-58b2-4320-8664-ab97ecaa9626 | public void add(int i){
this.passField.setText(this.get() + Integer.toString(i));
} |
50d41c22-8ae0-4ee9-8e3c-b10641dc08ef | public String get(){
return new String(this.passField.getPassword());
} |
02aff542-a056-465f-a9ee-2eeb77032b23 | public int print(Graphics g, PageFormat pf, int page)
throws PrinterException {
Graphics2D g2d = (Graphics2D)g;
g2d.translate(pf.getImageableX(), pf.getImageableY());
// Draw in the x boundaries of 10 and 190
// Draw in the y boundaries of 10 and 990
g2d.setFont(new Font("Tahoma", Font.PLAIN, 14));
g.drawString("Centerfolds Boston - Range", 12, 14);
g2d.setFont(new Font("Tahoma", Font.PLAIN, 12)); //Reset size
g.drawString("-----------------------------------------", 10, 21);
g.drawString("Range: " + this.fromTo, 10, 40);
g.drawString("Current Time: " + this.geTime(), 10, 60);
g.drawString("Current Date: " + this.getDate(), 10, 80);
g.drawString("-----------------------------------------", 10, 100);
g.drawString("$5 Admissions:", 10, 120);
g.drawString(Integer.toString(this.five), 170, 120);
g.drawString("$10 Admissions:", 10, 140);
g.drawString(Integer.toString(this.ten), 170, 140);
g.drawString("$20 Admissions:", 10, 160);
g.drawString(Integer.toString(this.twenty), 170, 160);
g.drawString("Game Admissions:", 10, 180);
g.drawString(Integer.toString(this.game), 170, 180);
g.drawString("Mgr Admissions:", 10, 200);
g.drawString(Integer.toString(this.mgr), 170, 200);
g.drawString("Comp Pass Admissions:", 10, 220);
g.drawString(Integer.toString(this.comp), 170, 220);
g.drawString("Door Comp Admissions:", 10, 240);
g.drawString(Integer.toString(this.door), 170, 240);
g.drawString("Hotel Admissions:", 10, 260);
g.drawString(Integer.toString(this.hotel), 170, 260);
g.drawString("-----------------------------------------", 10, 280);
g.drawString("Total $:", 10, 300);
g.drawString("$" + Integer.toString(this.calcTotal()), 165, 300);
g.drawString("Total Admissions:", 10, 320);
g.drawString(Integer.toString(this.calcAdmissions()), 170, 320);
return PAGE_EXISTS;
} |
0a4cf37e-d251-4399-87dd-3e607b546312 | public void print(int[] adm, String fromTo){
this.fromTo = fromTo;
this.five = adm[0];
this.ten = adm[1];
this.twenty = adm[2];
this.game = adm[3];
this.mgr = adm[4];
this.comp = adm[5];
this.door = adm[6];
this.hotel = adm[7];
PrinterJob job = PrinterJob.getPrinterJob();
PageFormat pf = new PageFormat();
Paper paper = new Paper();
paper.setImageableArea(0, 0, 200, 1000);
pf.setPaper(paper);
Book book = new Book();
book.append(this, pf);
job.setPageable(book);
try {
job.print();
} catch (Exception ex) {
new ClubException("Error Printing", ex.toString());
}
} |
81494269-a368-4c61-8062-c887bf56b772 | public int getNumberOfPages() {
throw new UnsupportedOperationException("Not supported yet.");
} |
004e0022-e288-4b6b-b6eb-ecd2bd8ab71d | public PageFormat getPageFormat(int pageIndex)
throws IndexOutOfBoundsException {
throw new UnsupportedOperationException("Not supported yet.");
} |
0e421665-5109-4703-b1b8-1c5705ea41cb | public Printable getPrintable(int pageIndex)
throws IndexOutOfBoundsException {
throw new UnsupportedOperationException("Not supported yet.");
} |
add258a5-a9d6-44a3-9c5a-19fbf3de9eb3 | public int calcTotal(){
int total = 0;
for(int i=1; i<=this.five; i++){
total+=5;
}
for(int i=1; i<=this.ten; i++){
total+=10;
}
for(int i=1; i<=this.twenty; i++){
total+=20;
}
return total;
} |
4ba0ffd3-3c64-4d31-8021-794d150eb794 | public int calcAdmissions(){
return this.five + this.ten + this.twenty + this.game + this.mgr
+ this.comp + this.door + this.hotel;
} |
fc562ff7-143c-40b9-8562-98487a550cb9 | private String getDate() {
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
Date date = new Date();
return dateFormat.format(date);
} |
5cc9ca2d-f8c5-4910-bde5-cdf7fa6bfc00 | private String geTime() {
DateFormat dateFormat = new SimpleDateFormat("hh:mm:ss a");
Date date = new Date();
return dateFormat.format(date);
} |
dcb66254-b250-41b7-95d5-9acb86b1356d | public Constants(){} |
cd0645c4-ed5e-45ca-aede-19f5fadea033 | public String getIP(){
return this.algos.getIP(this.startupURL);
} |
587f0129-419e-4097-ab43-e292221eb195 | public int print(Graphics g, PageFormat pf, int page)
throws PrinterException {
Graphics2D g2d = (Graphics2D)g;
g2d.translate(pf.getImageableX(), pf.getImageableY());
// Draw in the x boundaries of 10 and 190
// Draw in the y boundaries of 10 and 990
g2d.setFont(new Font("Tahoma", Font.PLAIN, 14));
g.drawString("Centerfolds Boston - Z", 30, 14);
g2d.setFont(new Font("Tahoma", Font.PLAIN, 12)); //Reset size
g.drawString("-----------------------------------------", 10, 21);
g.drawString("Last: " + this.time, 10, 40);
g.drawString("Current Time: " + this.geTime(), 10, 60);
g.drawString("Current Date: " + this.getDate(), 10, 80);
g.drawString("-----------------------------------------", 10, 100);
g.drawString("$5 Admissions:", 10, 120);
g.drawString(Integer.toString(this.five), 170, 120);
g.drawString("$10 Admissions:", 10, 140);
g.drawString(Integer.toString(this.ten), 170, 140);
g.drawString("$20 Admissions:", 10, 160);
g.drawString(Integer.toString(this.twenty), 170, 160);
g.drawString("Game Admissions:", 10, 180);
g.drawString(Integer.toString(this.game), 170, 180);
g.drawString("Mgr Admissions:", 10, 200);
g.drawString(Integer.toString(this.mgr), 170, 200);
g.drawString("Comp Pass Admissions:", 10, 220);
g.drawString(Integer.toString(this.comp), 170, 220);
g.drawString("Door Comp Admissions:", 10, 240);
g.drawString(Integer.toString(this.door), 170, 240);
g.drawString("Hotel Admissions:", 10, 260);
g.drawString(Integer.toString(this.hotel), 170, 260);
g.drawString("-----------------------------------------", 10, 280);
g.drawString("Total $:", 10, 300);
g.drawString("$" + Integer.toString(this.calcTotal()), 165, 300);
g.drawString("Total Admissions:", 10, 320);
g.drawString(Integer.toString(this.calcAdmissions()), 170, 320);
return PAGE_EXISTS;
} |
a544df38-7dac-40ba-b037-a9079258c8e0 | public void print(int[] adm, String time){
this.time = time;
this.five = adm[0];
this.ten = adm[1];
this.twenty = adm[2];
this.game = adm[3];
this.mgr = adm[4];
this.comp = adm[5];
this.door = adm[6];
this.hotel = adm[7];
PrinterJob job = PrinterJob.getPrinterJob();
PageFormat pf = new PageFormat();
Paper paper = new Paper();
paper.setImageableArea(0, 0, 200, 1000);
pf.setPaper(paper);
Book book = new Book();
book.append(this, pf);
job.setPageable(book);
try {
job.print();
} catch (Exception ex) {
new ClubException("Error Printing", ex.toString());
}
} |
ff5eeeea-6503-4e99-b4c5-628eb532ca2b | public int getNumberOfPages() {
throw new UnsupportedOperationException("Not supported yet.");
} |
c5e4e087-2d83-4ad6-b6ba-7b2f604bc15f | public PageFormat getPageFormat(int pageIndex)
throws IndexOutOfBoundsException {
throw new UnsupportedOperationException("Not supported yet.");
} |
49875111-b3bb-4f78-8561-4ebf954fad95 | public Printable getPrintable(int pageIndex)
throws IndexOutOfBoundsException {
throw new UnsupportedOperationException("Not supported yet.");
} |
ad886281-d6e3-4147-94f8-fa2616ae43b5 | public int calcTotal(){
int total = 0;
for(int i=1; i<=this.five; i++){
total+=5;
}
for(int i=1; i<=this.ten; i++){
total+=10;
}
for(int i=1; i<=this.twenty; i++){
total+=20;
}
return total;
} |
ca7c072a-c341-444d-b032-66267ca55c36 | public int calcAdmissions(){
return this.five + this.ten + this.twenty + this.game + this.mgr
+ this.comp + this.door + this.hotel;
} |
f748f61c-0457-4c51-bf9b-3983d76df045 | private String getDate() {
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
Date date = new Date();
return dateFormat.format(date);
} |
d9e9f5b3-0848-4f92-89c8-1fe2cf554ec0 | private String geTime() {
DateFormat dateFormat = new SimpleDateFormat("hh:mm:ss a");
Date date = new Date();
return dateFormat.format(date);
} |
a8cb9ed6-ed77-4161-8992-7bb7b100af7e | public DateFrame() {
initComponents();
} |
cb726458-0189-4456-9541-885648de2a24 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
monthBox = new javax.swing.JComboBox();
dayBox = new javax.swing.JComboBox();
yearBox = new javax.swing.JComboBox();
submitButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
yearBoxTo = new javax.swing.JComboBox();
dayBoxTo = new javax.swing.JComboBox();
monthBoxTo = new javax.swing.JComboBox();
fromLabel = new javax.swing.JLabel();
toLabel = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(255, 255, 255));
monthBox.setFont(new java.awt.Font("Tahoma", 0, 18));
monthBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }));
monthBox.setName("monthBox"); // NOI18N
dayBox.setFont(new java.awt.Font("Tahoma", 0, 18));
dayBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "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" }));
dayBox.setName("dayBox"); // NOI18N
yearBox.setFont(new java.awt.Font("Tahoma", 0, 18));
yearBox.setName("yearBox"); // NOI18N
submitButton.setBackground(new java.awt.Color(0, 0, 0));
submitButton.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
submitButton.setForeground(new java.awt.Color(255, 255, 255));
submitButton.setText("Sumbit");
submitButton.setName("submitButton"); // NOI18N
cancelButton.setBackground(new java.awt.Color(0, 0, 0));
cancelButton.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
cancelButton.setForeground(new java.awt.Color(255, 255, 255));
cancelButton.setText("Cancel");
cancelButton.setName("cancelButton"); // NOI18N
yearBoxTo.setFont(new java.awt.Font("Tahoma", 0, 18));
yearBoxTo.setName("yearBoxTo"); // NOI18N
dayBoxTo.setFont(new java.awt.Font("Tahoma", 0, 18));
dayBoxTo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "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" }));
dayBoxTo.setName("dayBoxTo"); // NOI18N
monthBoxTo.setFont(new java.awt.Font("Tahoma", 0, 18));
monthBoxTo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }));
monthBoxTo.setName("monthBoxTo"); // NOI18N
fromLabel.setFont(new java.awt.Font("Tahoma", 0, 14));
fromLabel.setText("From:");
fromLabel.setName("fromLabel"); // NOI18N
toLabel.setFont(new java.awt.Font("Tahoma", 0, 14));
toLabel.setText("To:");
toLabel.setName("toLabel"); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(fromLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE)
.addComponent(monthBox, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(dayBox, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(yearBox, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(toLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 68, Short.MAX_VALUE)
.addComponent(monthBoxTo, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(dayBoxTo, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(yearBoxTo, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(60, 60, 60))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(316, Short.MAX_VALUE)
.addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(submitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(115, 115, 115))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(monthBox, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dayBox, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(yearBox, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fromLabel))
.addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(monthBoxTo, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dayBoxTo, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(yearBoxTo, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(toLabel))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(submitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents |
7a0fc3a4-7aa7-43fa-8c53-7016452e2ff0 | public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DateFrame().setVisible(true);
}
});
} |
e2dc4ca5-7890-425b-bdcb-1645a07dacc8 | public void run() {
new DateFrame().setVisible(true);
} |
fe749603-a803-4629-8545-9025a1d957a6 | public void reset(){
this.monthBox.setSelectedIndex(0);
this.dayBox.setSelectedIndex(0);
this.yearBox.setSelectedIndex(5);
this.monthBoxTo.setSelectedIndex(0);
this.dayBoxTo.setSelectedIndex(0);
this.yearBoxTo.setSelectedIndex(5);
} |
58bdc3f3-99f2-4e8b-b1b4-36d83a2c772c | public String getFromTo(){
String fMonth =
Integer.toString(this.monthBox.getSelectedIndex() + 1);
String fDay = this.dayBox.getSelectedItem().toString();
String fYear = this.yearBox.getSelectedItem().toString();
String tMonth =
Integer.toString(this.monthBoxTo.getSelectedIndex() + 1);
String tDay = this.dayBoxTo.getSelectedItem().toString();
String tYear = this.yearBoxTo.getSelectedItem().toString();
return fMonth + "/" + fDay + "/" + fYear + " - "
+ tMonth + "/" + tDay + "/" + tYear;
} |
5e916070-5bc6-4812-a88a-b3ee44fe66df | public int[] getFrom(){
int month = this.monthBox.getSelectedIndex() + 1;
int day =
Integer.parseInt(this.dayBox.getSelectedItem().toString());
int year =
Integer.parseInt(this.yearBox.getSelectedItem().toString());
return new int[]{month, day, year};
} |
c0ca33c0-fc5b-47bb-860f-4fbc5864334c | public int[] getTo(){
int month = this.monthBoxTo.getSelectedIndex() + 1;
int day =
Integer.parseInt(this.dayBoxTo.getSelectedItem().toString());
int year =
Integer.parseInt(this.yearBoxTo.getSelectedItem().toString());
return new int[]{month, day, year};
} |
192cfa4b-66f5-4d8b-95f9-8f8bc2c9bd1d | Algorithms(){} |
245f8838-9a58-43a5-8434-ebfba5d3845e | public boolean isIP(String s){
// Make an ArrayList splitting the string up based off of . and :
ArrayList<String> alist =
new ArrayList<String>(Arrays.asList(s.split("[.:]+")));
if(alist.size() != 5){ // If the string wasn't a long enough IP
return false;
}
try{
for(int i=0; i<alist.size(); i++){
// Throws and error if it wasn't a number
int n = Integer.parseInt(alist.get(i));
// If the IP range is <0 or >255
if((n < 0 || n > 255) && i != alist.size()-1){
return false;
}
// If the section is the last in the alist (the port)
// and is out of bounds
if(i == alist.size()-1 && (n < 0 || n > 65535)){
return false;
}
}
} catch(Exception ex){
// Means the user put in letters not numbers
return false;
}
return true;
} |
cc15d384-b07e-44c1-a638-59b79b30e7a2 | public String getIP(String s){
String ip = "";
try{
File file = new File(s);
BufferedReader reader = new BufferedReader(new FileReader(file));
ip = reader.readLine(); // Only one line
} catch(Exception ex){
new ClubException("Error Reading IP", ex.toString());
}
return ip;
} |
d55b2d43-d34d-4d0a-bfe4-d1edaeab26b2 | public MainPanel() {
initComponents();
} |
475c84e6-fe74-4f6b-9f6b-3ce9a1eafe61 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
fiveButton = new javax.swing.JButton();
tenButton = new javax.swing.JButton();
twentyButton = new javax.swing.JButton();
gameButton = new javax.swing.JButton();
managerButton = new javax.swing.JButton();
compButton = new javax.swing.JButton();
doorButton = new javax.swing.JButton();
numField = new javax.swing.JTextField();
reportsButton = new javax.swing.JButton();
errorLabel = new javax.swing.JLabel();
seven = new javax.swing.JButton();
eight = new javax.swing.JButton();
nine = new javax.swing.JButton();
four = new javax.swing.JButton();
five = new javax.swing.JButton();
six = new javax.swing.JButton();
one = new javax.swing.JButton();
two = new javax.swing.JButton();
three = new javax.swing.JButton();
zero = new javax.swing.JButton();
clearButton = new javax.swing.JButton();
numLabel = new javax.swing.JLabel();
hotelButton = new javax.swing.JButton();
setBackground(new java.awt.Color(255, 255, 255));
setMaximumSize(new java.awt.Dimension(640, 480));
setMinimumSize(new java.awt.Dimension(640, 480));
fiveButton.setBackground(new java.awt.Color(0, 0, 0));
fiveButton.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
fiveButton.setForeground(new java.awt.Color(255, 255, 255));
fiveButton.setText("$5");
fiveButton.setName("fiveButton"); // NOI18N
tenButton.setBackground(new java.awt.Color(0, 0, 0));
tenButton.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
tenButton.setForeground(new java.awt.Color(255, 255, 255));
tenButton.setText("$10");
tenButton.setName("tenButton"); // NOI18N
twentyButton.setBackground(new java.awt.Color(0, 0, 0));
twentyButton.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
twentyButton.setForeground(new java.awt.Color(255, 255, 255));
twentyButton.setText("$20");
twentyButton.setName("twentyButton"); // NOI18N
gameButton.setBackground(new java.awt.Color(0, 0, 0));
gameButton.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
gameButton.setForeground(new java.awt.Color(255, 255, 255));
gameButton.setText("G-Tix");
gameButton.setName("gameButton"); // NOI18N
managerButton.setBackground(new java.awt.Color(0, 0, 0));
managerButton.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
managerButton.setForeground(new java.awt.Color(255, 255, 255));
managerButton.setText("Mgr comp"); // NOI18N
managerButton.setName("managerButton"); // NOI18N
compButton.setBackground(new java.awt.Color(0, 0, 0));
compButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
compButton.setForeground(new java.awt.Color(255, 255, 255));
compButton.setText("Comp Pass"); // NOI18N
compButton.setName("compButton"); // NOI18N
doorButton.setBackground(new java.awt.Color(0, 0, 0));
doorButton.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
doorButton.setForeground(new java.awt.Color(255, 255, 255));
doorButton.setText("Comp");
doorButton.setName("doorButton"); // NOI18N
numField.setName("numField"); // NOI18N
reportsButton.setBackground(new java.awt.Color(0, 0, 0));
reportsButton.setFont(new java.awt.Font("Tahoma", 3, 18)); // NOI18N
reportsButton.setForeground(new java.awt.Color(255, 255, 255));
reportsButton.setText("Reports");
reportsButton.setName("reportsButton"); // NOI18N
errorLabel.setFont(new java.awt.Font("Tahoma", 0, 10));
errorLabel.setForeground(new java.awt.Color(255, 0, 0));
errorLabel.setText("Number of prints may not exceed 20");
errorLabel.setName("errorLabel"); // NOI18N
seven.setBackground(new java.awt.Color(0, 0, 0));
seven.setForeground(new java.awt.Color(255, 255, 255));
seven.setText("7");
seven.setName("seven"); // NOI18N
eight.setBackground(new java.awt.Color(0, 0, 0));
eight.setForeground(new java.awt.Color(255, 255, 255));
eight.setText("8");
eight.setName("eight"); // NOI18N
nine.setBackground(new java.awt.Color(0, 0, 0));
nine.setForeground(new java.awt.Color(255, 255, 255));
nine.setText("9");
nine.setName("nine"); // NOI18N
four.setBackground(new java.awt.Color(0, 0, 0));
four.setForeground(new java.awt.Color(255, 255, 255));
four.setText("4");
four.setName("four"); // NOI18N
five.setBackground(new java.awt.Color(0, 0, 0));
five.setForeground(new java.awt.Color(255, 255, 255));
five.setText("5");
five.setName("five"); // NOI18N
six.setBackground(new java.awt.Color(0, 0, 0));
six.setForeground(new java.awt.Color(255, 255, 255));
six.setText("6");
six.setName("six"); // NOI18N
one.setBackground(new java.awt.Color(0, 0, 0));
one.setForeground(new java.awt.Color(255, 255, 255));
one.setText("1");
one.setName("one"); // NOI18N
two.setBackground(new java.awt.Color(0, 0, 0));
two.setForeground(new java.awt.Color(255, 255, 255));
two.setText("2");
two.setName("two"); // NOI18N
three.setBackground(new java.awt.Color(0, 0, 0));
three.setForeground(new java.awt.Color(255, 255, 255));
three.setText("3");
three.setName("three"); // NOI18N
zero.setBackground(new java.awt.Color(0, 0, 0));
zero.setForeground(new java.awt.Color(255, 255, 255));
zero.setText("0");
zero.setName("zero"); // NOI18N
clearButton.setBackground(new java.awt.Color(0, 0, 0));
clearButton.setForeground(new java.awt.Color(255, 255, 255));
clearButton.setText("Clear");
clearButton.setName("clearButton"); // NOI18N
numLabel.setFont(new java.awt.Font("Tahoma", 0, 14));
numLabel.setText("#");
numLabel.setName("numLabel"); // NOI18N
hotelButton.setBackground(new java.awt.Color(0, 0, 0));
hotelButton.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
hotelButton.setForeground(new java.awt.Color(255, 255, 255));
hotelButton.setText("Hotel");
hotelButton.setName("hotelButton"); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(seven, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(eight, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(nine, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(four, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(five, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(six, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(errorLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(zero, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(clearButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(one, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(two, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(three, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(26, 26, 26)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(doorButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(gameButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(fiveButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(hotelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(managerButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(tenButton, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(reportsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(compButton, javax.swing.GroupLayout.Alignment.TRAILING, 0, 0, Short.MAX_VALUE)
.addComponent(twentyButton, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addComponent(numLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(numField)))
.addGap(38, 38, 38))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(numLabel)
.addComponent(numField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(seven, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(eight, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(nine, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(four, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(five, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(six, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(one, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(two, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(three, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(zero, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(17, 17, 17)
.addComponent(errorLabel))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(fiveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(16, 16, 16)
.addComponent(gameButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(twentyButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tenButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(compButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(managerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(doorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hotelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(reportsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(110, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents |
fd01775e-a780-401b-a2f8-0dabfc1d736e | public void clear(){
this.numField.setText("");
} |
74e9d1bf-2673-41c7-86a4-9cac2dd3cc9f | public void add(int i){
this.numField.setText(this.get() + Integer.toString(i));
} |
81f11a85-e42f-4099-82ba-d0f4281abe33 | public String get(){
return this.numField.getText();
} |
cff26d8a-d516-4ab0-8b2f-1f4a9ece6b51 | public int getNum() throws Exception{
if(this.get().equals("")){return 1;}
int i = Integer.parseInt(this.get());
if(i>20){
throw new Exception();
}else{
return i;
}
} |
49a31316-923a-482f-b3f9-36fa0cff3dc2 | public int print(Graphics g, PageFormat pf, int page)
throws PrinterException {
Graphics2D g2d = (Graphics2D)g;
g2d.translate(pf.getImageableX(), pf.getImageableY());
// Draw in the x boundaries of 10 and 190
// Draw in the y boundaries of 10 and 990
g2d.setFont(new Font("Tahoma", Font.PLAIN, 22));
g.drawString("Centerfolds Boston", 10, 20);
g2d.setFont(new Font("Tahoma", Font.PLAIN, 12)); //Reset size
g.drawString("-----------------------------------------", 10, 35);
g2d.setFont(new Font("Tahoma", Font.PLAIN, 14)); //Reset size
g.drawString("Time: " + this.geTime(), 10, 75);
g.drawString("Date: " + this.getDate(), 10, 115);
g2d.setFont(new Font("Tahoma", Font.PLAIN, 12)); //Reset size
g.drawString("-----------------------------------------", 10, 155);
g2d.setFont(new Font("Tahoma", Font.PLAIN, 32)); //Reset size
g.drawString(this.type, 10, 210);
return PAGE_EXISTS;
} |
6fd06137-974a-40df-9b40-ce41bf5e4e5e | public void print(String s){
this.type = s;
PrinterJob job = PrinterJob.getPrinterJob();
PageFormat pf = new PageFormat();
Paper paper = new Paper();
paper.setImageableArea(0, 0, 200, 1000);
pf.setPaper(paper);
Book book = new Book();
book.append(this, pf);
job.setPageable(book);
try {
job.print();
} catch (Exception ex) {
new ClubException("Error Printing", ex.toString());
}
} |
887aaa1d-d0c1-407c-8c42-994dac500902 | public int getNumberOfPages() {
throw new UnsupportedOperationException("Not supported yet.");
} |
34fbb39a-a2b3-4dd1-bd50-cd6f1528c760 | public PageFormat getPageFormat(int pageIndex)
throws IndexOutOfBoundsException {
throw new UnsupportedOperationException("Not supported yet.");
} |
ff4f8ee5-3bfe-4cc2-828c-09f9a2f6b0a9 | public Printable getPrintable(int pageIndex)
throws IndexOutOfBoundsException {
throw new UnsupportedOperationException("Not supported yet.");
} |
0d620e9d-2254-4271-b86b-c0d1afd33e80 | private String getDate() {
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
Date date = new Date();
return dateFormat.format(date);
} |
0a579bff-5c48-4443-9901-e4327da6f70a | private String geTime() {
DateFormat dateFormat = new SimpleDateFormat("hh:mm:ss a");
Date date = new Date();
return dateFormat.format(date);
} |
a93caf7b-d33c-4f92-9d79-f0af65720e8d | Startup(){
if (Desktop.isDesktopSupported()) {
this.desktop = Desktop.getDesktop();
}
this.verifyFile();
// If the file is there, start connecting to the server
this.connect();
} |
44dfd5b7-cc6b-4661-956d-e978ae91b752 | private void verifyFile(){
if(this.file.exists()){
// Move forwards...
}else{
// Tell the error and ask to setup the file
this.setup();
}
} |
2432aa00-c0c6-41cc-92cf-295d64b04e05 | public void setup(){
Object[] options = {"Browse", "Build"};
int i = JOptionPane.showOptionDialog(null,
"There has been an error locating the startup file."
+ "\nPlease select below either 'Browse' to navigate to"
+ " the correct file"
+ "\nor 'Build' to provide the program with information to"
+ " rebuild the file.",
"Error locating startup file",
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
null, options, options[0]);
switch(i){
case 0:
this.browse(); // Find the file
break;
case 1:
this.rebuild(); // Rebuild the file
break;
case -1:
// If the close button is pressed
System.exit(0);
break;
default:
// Should never really happen - defensive programming
new ClubException("Error setting up the startup file",
"This should never happen");
break;
}
this.verifyFile(); // Double check it's actually there
} |
b0d80b19-ac4a-44a7-ae1b-63cdbaac7a46 | public void browse(){
JFileChooser fc = new JFileChooser();
fc.showOpenDialog(null);
File browse = fc.getSelectedFile();
try{
FileReader in = new FileReader(browse);
FileWriter out = new FileWriter(this.file);
int c;
while((c=in.read()) != -1){
out.write(c);
}
in.close();
out.close();
} catch(Exception ex){
new ClubException("Error Reading File", ex.toString());
}
} |
aca82cc7-e633-4a9b-8575-6d51eec48371 | public void rebuild(){
try{
String s = JOptionPane.showInputDialog(null,
"What is the MySQL database IP address?"
+ "\nDefault: 127.0.0.1:3306",
"IP Address",
JOptionPane.QUESTION_MESSAGE);
if(this.cons.algos.isIP(s)){
this.makeFile(s);
}else{
JOptionPane.showMessageDialog(null,
"This is not a proper IP address."
+ "\nPlease try the format: ###.###.###.###:####");
this.rebuild();
}
} catch(Exception ex){
// If they click cancel, or there is another major error
this.setup();
}
} |
b64e7587-3a93-4028-aafc-603e420c4bfb | public void makeFile(String s){
Writer output;
File outputFile = new File(this.cons.startupURL);
try{
output = new BufferedWriter(new FileWriter(outputFile));
output.write(s);
output.close();
JOptionPane.showMessageDialog(null,
"The file has been sucessfully made.");
} catch(Exception ex){
new ClubException("Error Writing File", ex.toString());
}
} |
2e3474b3-4c20-4dd6-8ca1-dfd7d2d31e1f | private void connect(){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection(
"jdbc:mysql://"+this.cons.getIP()+"/clubdoors",
"club_user","club_password");
} catch(Exception ex){
new ClubException("Error Connecting to Database", ex.toString());
}
} |
4edcb522-d493-41c9-ae6c-1880d20a90ee | public ClubException(){
this.type = "";
this.msg = "";
this.checkResponse(this.giveMessage());
} |
3a70e77b-71ed-4ade-b2e6-18a2158f6b16 | public ClubException(String type, String msg){
this.type = type;
this.msg = msg;
this.checkResponse(this.giveMessage());
} |
244cac68-68d6-459f-943e-09e627b17aaa | public int giveMessage(){
JFrame frame = new JFrame();
Object[] options = {"Ok"};
return JOptionPane.showOptionDialog(null, "Error Message:\n"+this.msg,
type,
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
null, options, options[0]);
} |
4e96197d-2a71-4705-9096-729d6eaba0ad | public void checkResponse(int i){
switch(i){
case 0:
break; // Moves on...
case -1:
// If the close button is pressed
System.exit(0);
break;
default:
// Should never really happen - defensive programming
new ClubException("Error during startup file setup",
"This should never happen");
break;
}
} |
e778a8b3-c625-46a7-8d51-c16c1f26139c | @Test
public void testCreateUndoManager() throws Exception {
UndoManagerFactory undoManagerFactory = new UndoManagerFactoryImpl();
undoManagerFactory.createUndoManager(new DocumentImpl(), 1);
} |
8f20ae05-9c2a-4f56-a9fb-7cae25e5aa4a | @Test(expected = IllegalArgumentException.class)
public void testCreateUndoManagerNullDocument() throws Exception {
UndoManagerFactory undoManagerFactory = new UndoManagerFactoryImpl();
undoManagerFactory.createUndoManager(null, 1);
} |
b8b39978-b539-4a0f-ae34-2575a6a4d7ac | @Test(expected = IllegalArgumentException.class)
public void testCreateUndoManagerZeroBuffer() throws Exception {
UndoManagerFactory undoManagerFactory = new UndoManagerFactoryImpl();
undoManagerFactory.createUndoManager(new DocumentImpl(), 0);
} |
659b6fbc-493f-4c72-8e8f-603f5df75ed2 | @Test
public void testDocumentChange() throws Exception {
UndoManagerFactory undoManagerFactory = new UndoManagerFactoryImpl();
ChangeFactory changeFactory = new ChangeFactoryImpl();
Document document = new DocumentImpl();
UndoManager undoManager = undoManagerFactory.createUndoManager(document, 2);
Assert.assertFalse(undoManager.canUndo());
Assert.assertFalse(undoManager.canRedo());
Change change1 = changeFactory.createInsertion(1, "Test Change1", 0, 1);
change1.apply(document);
Change change2 = changeFactory.createInsertion(2, "Test Change2", 1, 2);
change2.apply(document);
undoManager.registerChange(change1);
undoManager.registerChange(change2);
Assert.assertTrue(undoManager.canUndo());
Assert.assertFalse(undoManager.canRedo());
System.out.println("Undoing and redoing starts here----------------------------------------------");
undoManager.undo();
Assert.assertTrue(undoManager.canRedo());
undoManager.undo();
undoManager.redo();
undoManager.redo();
System.out.println("Registering new change ------------------------------------------------------");
Change change3 = changeFactory.createInsertion(3, "Test Change3", 2, 3);
change3.apply(document);
undoManager.registerChange(change3);
Assert.assertTrue(undoManager.canUndo());
Assert.assertTrue(undoManager.canUndo());
Assert.assertFalse(undoManager.canRedo());
System.out.println("Undoing and redoing starts here----------------------------------------------");
undoManager.undo();
Assert.assertTrue(undoManager.canRedo());
undoManager.undo();
undoManager.redo();
undoManager.redo();
} |
263788b4-cd77-441d-ad83-90cb5c989412 | public void delete(int pos, String s); |
2d594767-dbe6-432d-b541-759ac554e261 | public void insert(int pos, String s); |
47bf9363-ac36-4d0b-b7ff-5bd4bd2df35a | public void setDot(int pos); |
677c942c-7eb1-496f-8e4c-c05ef08413d5 | private ChangeType(final String changeType) {
type = changeType;
} |
e2b82102-80bc-4727-a63d-3f2ac9d3383a | public String getType() {
return type;
} |
f80b758d-45cb-415b-929f-3c7853ba2ac3 | public void registerChange(Change change); |
b5842f95-04c2-4189-a87f-c973a79a0d1c | public boolean canUndo(); |
d75b88c7-025b-4efa-89c9-27d3e98ef00e | public void undo(); |
f5842755-7ae2-422b-805d-68c71343bc3c | public boolean canRedo(); |
81a8365c-17b2-4f7c-8056-0d83f68aeb6d | public void redo(); |
207bdbad-f01f-4b4e-b158-96503cae2696 | public Change createDeletion(int pos, String s, int oldDot, int newDot); |
ade43d6e-5ec7-4517-b391-c595043dc55d | public Change createInsertion(int pos, String s, int oldDot, int newDot); |
f7be6d84-8270-46a7-ae60-157c185090b2 | public String getType(); |
541d19b1-22ce-4952-80f3-839110f2f366 | public void apply(Document doc); |
8b13bd70-767f-4f60-a825-1cca9f8e4d4f | public void revert(Document doc); |
5e1db082-2fc1-4e7f-b5a5-d341bda0b883 | public UndoManager createUndoManager(Document doc, int bufferSize); |
7c632e7a-6b27-4a88-8a9a-2817e763c291 | @Override
public void delete(final int pos, final String s) {
System.out.println("Deleting in document: " + s);
} |
e623b6e0-76c2-48b0-988d-1110df312ea0 | @Override
public void insert(final int pos, final String s) {
System.out.println("Inserting in document: " + s);
} |
122d8a4b-7dfc-41b4-9810-ba1cba6b3e74 | @Override
public void setDot(final int pos) {
System.out.println("Setting dot at: " + pos);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.