Example #1
0
 public void actionPerformed(ActionEvent e) {
   // This if statement prevents the the program from searching the records when no parameters
   // had been entered( because that would be pointless)
   if (((searchTextfield[0].getText().equalsIgnoreCase("enter Search Parameter"))
           || (searchTextfield[0].getText().equalsIgnoreCase("")))
       && ((searchTextfield[1].getText().equalsIgnoreCase("enter Search Parameter"))
           || (searchTextfield[1].getText().equalsIgnoreCase("")))
       && ((searchTextfield[2].getText().equalsIgnoreCase("enter Search Parameter"))
           || (searchTextfield[2].getText().equalsIgnoreCase("")))
       && ((searchTextfield[3].getText().equalsIgnoreCase("enter Search Parameter"))
           || (searchTextfield[3].getText().equalsIgnoreCase("")))
       && ((searchTextfield[4].getText().equalsIgnoreCase("enter Search Parameter"))
           || (searchTextfield[4].getText().equalsIgnoreCase("")))
       && ((searchTextfield[5].getText().equalsIgnoreCase("enter Search Parameter"))
           || (searchTextfield[5].getText().equalsIgnoreCase("")))
       && ((searchTextfield[6].getText().equalsIgnoreCase("enter Search Parameter"))
           || (searchTextfield[6].getText().equalsIgnoreCase("")))) {
   }
   // If a search parameters has been entered, then the records will be searched, reloaded back
   // to the GUI, and the buttons will be disabled.
   // The buttons are disabled because it is one of the limitations of the program
   else {
     Classes.search();
     Classes.makeSearchArrayIndexesLookNicer();
     reloadArrayValuesToGUI();
     Classes.EnableSortButtons(false);
   }
 }
Example #2
0
 private List<Class<?>> gatherClasses() {
   ArrayList<Class<?>> result = new ArrayList<Class<?>>();
   List<Classes> classeses =
       fTestClass.getAnnotatedFieldValues(fInstance, SuiteClasses2.class, Classes.class);
   for (Classes each : classeses) result.addAll(each.get());
   return result;
 }
Example #3
0
 public void actionPerformed(ActionEvent e) {
   // The searchTextfields will be reset
   for (int i = 0; i < 7; i++) {
     searchTextfield[i].setText("enter Search Parameter");
   }
   // arrayIndexes will be reset
   Classes.resetArrayIndexes();
   reloadArrayValuesToGUI();
   // the sorting buttons will be enabled again
   Classes.EnableSortButtons(true);
 }
  @Test
  public void createClass() throws Exception {

    Map<String, String> KillarneyClasses = new HashMap<String, String>();
    KillarneyClasses.put("ClassName", "Sports and GT");
    KillarneyClasses.put("ClassCode", "S&GT");
    KillarneyClasses.put("ClassName", "V8 Masters");
    KillarneyClasses.put("ClassCode", "V8M");

    Classes class1 = ClassesFactory.createClass(KillarneyClasses);
    Assert.assertEquals("S&GT", class1.getClassCode());
  }
  @Test
  public void updateClass() throws Exception {
    Map<String, String> KillarneyClasses = new HashMap<String, String>();
    KillarneyClasses.put("ClassName", "Sports and GT");
    KillarneyClasses.put("ClassCode", "S&GT");
    KillarneyClasses.put("ClassName", "V8 Masters");
    KillarneyClasses.put("ClassCode", "V8M");
    Classes class1 = ClassesFactory.createClass(KillarneyClasses);

    Classes class2 =
        new Classes.Builder(class1.getClassCode()).copy(class1).classCode("MV8").build();

    Assert.assertEquals("S&GT", class1.getClassCode());
    Assert.assertEquals("MV8", class2.getClassCode());
  }
Example #6
0
 @SuppressWarnings({"unchecked", "rawtypes"})
 @Override
 public boolean apply(Class input) {
   if (Function.class.isAssignableFrom(input) && Ats.from(input).has(ErrorMessages.class)) {
     try {
       ErrorMessages annote = Ats.from(input).get(ErrorMessages.class);
       Function<Class, String> errorFunction =
           (Function<Class, String>) Classes.builder(input).newInstance();
       ConcurrentMap<Class, String> errorMap =
           new MapMaker()
               .expireAfterAccess(60, TimeUnit.SECONDS)
               .makeComputingMap(errorFunction);
       classErrorMessages.put(annote.value(), errorMap);
       return true;
     } catch (UndeclaredThrowableException ex) {
       LOG.error(ex, ex);
       return false;
     }
   } else {
     Discovery discovery = Ats.from(ErrorMessageDiscovery.class).get(Discovery.class);
     LOG.error(
         "Annotated Discovery supplied class argument that does not conform to one of: value()="
             + discovery.value()
             + " (assignable types) or annotations()="
             + discovery.annotations());
     return false;
   }
 }
Example #7
0
  /**
   * Adds an error if there is a misplaced annotations on {@code type}. Scoping annotations are not
   * allowed on abstract classes or interfaces.
   */
  public static void checkForMisplacedScopeAnnotations(
      Class<?> type, Object source, Errors errors) {
    if (Classes.isConcrete(type)) {
      return;
    }

    Class<? extends Annotation> scopeAnnotation = findScopeAnnotation(errors, type);
    if (scopeAnnotation != null) {
      errors.withSource(type).scopeAnnotationOnAbstractType(scopeAnnotation, type, source);
    }
  }
Example #8
0
 private T newContextObject() {
   try {
     if (type.isInterface()) {
       return (T) Classes.newDynamicProxy(type);
     } else {
       return (T) type.newInstance();
     }
   } catch (Exception anExc) {
     throw new XmlReadingException(anExc);
   }
 }
Example #9
0
 /**
  * Prints a summary of the specified exception, without stack trace. This method is invoked when a
  * non-fatal (and somewhat expected) error occured, for example {@link
  * java.io.FileNotFoundException} when the file were specified in argument.
  *
  * @param exception An exception with a message describing the user's error.
  * @since 2.3
  */
 public void printSummary(final Exception exception) {
   final String type = Classes.getShortClassName(exception);
   String message = exception.getLocalizedMessage();
   if (message == null) {
     message = Vocabulary.format(VocabularyKeys.NO_DETAILS_$1, type);
   } else {
     err.print(type);
     err.print(": ");
   }
   err.println(message);
   err.flush();
 }
 public boolean isEqualsOnly(final Node node) {
   final Class<?> propertyType = node.getType();
   if (propertyType != null) {
     if (propertyType.getAnnotation(ObjectDiffEqualsOnlyType.class) != null) {
       return true;
     }
     if (equalsOnlyTypes.contains(propertyType)) {
       return true;
     }
     if (Classes.isSimpleType(propertyType)) {
       return true;
     }
   }
   if (node.isEqualsOnly()) {
     return true;
   }
   if (equalsOnlyProperties.contains(node.getPropertyPath())) {
     return true;
   }
   return false;
 }
Example #11
0
  public void run() {
    InstField instField = new InstField();
    instField.run();

    StaticField.run();

    IntMath.run();
    FloatMath.run();
    Compare.run();

    Monitor.run();
    Switch.run();
    Array.run();
    Classes.run();
    Goto.run();
    MethodCall.run();
    Throw.run();

    try {
      UnresTest1.run();
    } catch (VerifyError ve) {
      System.out.println("Caught: " + ve);
    }
    try {
      UnresTest1.run();
    } catch (VerifyError ve) {
      System.out.println("Caught (retry): " + ve);
    }

    try {
      UnresTest2.run();
    } catch (VerifyError ve) {
      System.out.println("Caught: " + ve);
    } catch (Throwable th) {
      // We and the RI throw ClassNotFoundException, but that isn't declared so javac
      // won't let us try to catch it.
      th.printStackTrace();
    }
    InternedString.run();
  }
public class AppConstants {

  public interface URLS {
    //		public static final String BASE_URL =
    // "https://www.smarthumanoid.com/consultant/services/api.php";
    public static final String MEDIA_BASE_URL =
        "https://www.smarthumanoid.com/consultant/services/file_upload.php";
    public static final String UPLOAD_URL = "expense_image_upload.php";

    /*
     * Testing Environment
     */
    public static final String BASE_URL =
        "http://www.netdoers.com/projects/caprofessional/services/query.php";
    public static final String ANSWER_URL =
        "http://www.netdoers.com/projects/caprofessional/services/query_answer.php";
    public static final String TICKER_URL =
        "http://www.netdoers.com/projects/caprofessional/services/ticker.php";
    public static final String NOTIFICATION_URL =
        "http://www.netdoers.com/projects/caprofessional/services/notification.php";
    public static final String REGISTERED_TO_SERVER_URL =
        "http://www.netdoers.com/projects/caprofessional/services/user_device.php";
    public static final String GET_DATA_URL =
        "http://netdoers.com/projects/caprofessional/services/api.php";
    public static final String SET_DEFAULT_BATCH =
        "http://netdoers.com/projects/caprofessional/services/set_default_batch.php";
  }

  public interface RESPONSES {
    public interface LoginResponse {
      public static String STATUS = "success";
      public static String VID = "user_id";
      public static String USERNAME = "******";
      public static String LINFO = "info";
    }

    public interface QueryResponse {

      public static String QSTATUS = "success";
      public static String QUID = "question_id";
      public static String QRES = "info";
    }

    public interface TimeTableResponse {
      public static String TSTATUS = "success";
      public static String TUID = "batch";
      public static String TINFO = "info";
    }
  }

  public static final String NETWORK_NOT_AVAILABLE = "Network not available";
  public static final String IMAGE_DIRECTORY_PATH =
      Environment.getExternalStorageDirectory().getPath() + "/CA";
  public static final String IMAGE_DIRECTORY_PATH_DATA =
      Classes.getApplication().getApplicationContext().getFilesDir().getAbsolutePath();
  public static final String EXTENSION = ".png";
  public static final String GCM_SENDER_ID = "494660405194";

  public static final String FLURRY_API_KEY = "Y5BQCVGT87TN84GQ5FSR";

  public static final boolean DEBUG = false;

  //	public static final String fontStyle = "fonts/Georgia.ttf";
  public static final String fontStyle = "fonts/RobotoCondensedRegular.ttf";

  public static final String res =
      "{\"success\":true,\"tables\":{\"service\":[\"1\",\"2\"],\"expense\":[\"1\",\"2\"],\"expense_image\":[\"1\",\"2\",\"3\",\"4\"],\"service_audio\":[\"1\",\"2\",\"3\"],\"location\":[\"1\",\"2\"]},\"lov\":{\"bank\":[\"ICICI\",\"HDFC\"],\"location\":[\"Lilavati\",\"Rehja\"],\"expense_category\":[\"Food Expense\",\"Office Expense\",\"Bill Payment\",\"Stationary\"]\"patient_type\":[\"Regular\",\"Occasional\"],\"payment_mode\":[\"Net Banking\",\"Cash\",\"Online Transfer\",\"Cheque\"],\"procedure\":[\"Procedure 1\",\"Procedure 2\"],\"referred_by\":[\"Jaykishan Parikh\",\"Mahendra Nagar\"],\"start_time\":[\"Morning\",\"Evening\"],\"surgery_level\":[\"Level 1\",\"Level 2\"],\"team_member\":[\"Rakesh Pratap\",\"Milan Shah\"],\"ward\":[\"General Ward\",\"Emergency Ward\"]}}";

  public static final String vendorPro =
      "[{\"pid\":\"175\",\"project\":\"Philips\",\"company\":\"Philips\"},{\"pid\":\"149\",\"project\":\"Vodafone UP\",\"company\":\"Vodafone\"},{\"pid\":\"148\",\"project\":\"Bajaj Allianz UP Phase 2\",\"company\":\"Bajaj Allianz\"},{\"pid\":\"142\",\"project\":\"Philips MP\",\"company\":\"Philips\"},{\"pid\":\"128\",\"project\":\"HDFC\",\"company\":\"HDFC\"},{\"pid\":\"122\",\"project\":\"Hindustan Unilever\",\"company\":\"Hindustan Unilever\"},{\"pid\":\"83\",\"project\":\"Makers-Raymond\",\"company\":\"Makers-Raymond\"},{\"pid\":\"79\",\"project\":\"HDFC\",\"company\":\"HDFC\"},{\"pid\":\"56\",\"project\":\"Vodafone\",\"company\":\"Vodafone\"},{\"pid\":\"50\",\"project\":\"CASA_Sarita\",\"company\":\"HDFC\"},{\"pid\":\"36\",\"project\":\"Vodafone\",\"company\":\"Vodafone\"},{\"pid\":\"35\",\"project\":\"Gold Loan_Sukirti\",\"company\":\"HDFC\"},{\"pid\":\"30\",\"project\":\"Gold Loan_Sarita\",\"company\":\"HDFC\"}]";
  public static final String preImg =
      "[{\"project\":\"Gold Loan_Sarita\",\"work_title\":\"Wall Painting\",\"image\":\"http:\\/\\/adwallz.co\\/admin\\/images\\/projects\\/allworks\\/1295257286DSC06495.JPG\",\"address\":\"HDFC Bank,Unnao\",\"city\":\"UNNAO\",\"state\":\"Uttar Pradesh\",\"size\":\"15.00 x 11.50\"},{\"project\":\"Gold Loan_Sarita\",\"work_title\":\"Wall Painting\",\"image\":\"http:\\/\\/adwallz.co\\/admin\\/images\\/projects\\/allworks\\/1295257396DSC06496.JPG\",\"address\":\"Unnao ,Near Lucknow Road.\",\"city\":\"UNNAO\",\"state\":\"Uttar Pradesh\",\"size\":\"26.00 x 8.50\"}]";
  public static final String proListByVendor =
      "[{\"pid\":\"148\",\"project_name\":\"Bajaj Allianz UP Phase 2\",\"client_name\":\"Bajaj Allianz\"},{\"pid\":\"50\",\"project_name\":\"CASA_Sarita\",\"client_name\":\"HDFC\"},{\"pid\":\"30\",\"project_name\":\"Gold Loan_Sarita\",\"client_name\":\"HDFC\"},{\"pid\":\"35\",\"project_name\":\"Gold Loan_Sukirti\",\"client_name\":\"HDFC\"},{\"pid\":\"79\",\"project_name\":\"HDFC\",\"client_name\":\"HDFC\"},{\"pid\":\"128\",\"project_name\":\"HDFC\",\"client_name\":\"HDFC\"},{\"pid\":\"122\",\"project_name\":\"Hindustan Unilever\",\"client_name\":\"Hindustan Unilever\"},{\"pid\":\"83\",\"project_name\":\"Makers-Raymond\",\"client_name\":\"Makers-Raymond\"},{\"pid\":\"175\",\"project_name\":\"Philips\",\"client_name\":\"Philips\"},{\"pid\":\"142\",\"project_name\":\"Philips MP\",\"client_name\":\"Philips\"},{\"pid\":\"36\",\"project_name\":\"Vodafone\",\"client_name\":\"Vodafone\"},{\"pid\":\"56\",\"project_name\":\"Vodafone\",\"client_name\":\"Vodafone\"},{\"pid\":\"149\",\"project_name\":\"Vodafone UP\",\"client_name\":\"Vodafone\"}]";
  public static final String projectsByVendorToAdd =
      "[{\"pid\":\"148\",\"project_name\":\"Bajaj Allianz UP Phase 2\",\"client_name\":\"Bajaj Allianz\"},{\"pid\":\"50\",\"project_name\":\"CASA_Sarita\",\"client_name\":\"HDFC\"},{\"pid\":\"30\",\"project_name\":\"Gold Loan_Sarita\",\"client_name\":\"HDFC\"},{\"pid\":\"35\",\"project_name\":\"Gold Loan_Sukirti\",\"client_name\":\"HDFC\"},{\"pid\":\"79\",\"project_name\":\"HDFC\",\"client_name\":\"HDFC\"},{\"pid\":\"128\",\"project_name\":\"HDFC\",\"client_name\":\"HDFC\"},{\"pid\":\"122\",\"project_name\":\"Hindustan Unilever\",\"client_name\":\"Hindustan Unilever\"},{\"pid\":\"83\",\"project_name\":\"Makers-Raymond\",\"client_name\":\"Makers-Raymond\"},{\"pid\":\"175\",\"project_name\":\"Philips\",\"client_name\":\"Philips\"},{\"pid\":\"142\",\"project_name\":\"Philips MP\",\"client_name\":\"Philips\"},{\"pid\":\"36\",\"project_name\":\"Vodafone\",\"client_name\":\"Vodafone\"},{\"pid\":\"56\",\"project_name\":\"Vodafone\",\"client_name\":\"Vodafone\"},{\"pid\":\"149\",\"project_name\":\"Vodafone UP\",\"client_name\":\"Vodafone\"}]";
  public static final String paintingType = "[\"highway\",\"wall\",\"shop\"]";
}
 protected String resourceKey() {
   return Classes.simpleName(RangeValidator.class);
 }
Example #14
0
 public void actionPerformed(ActionEvent e) {
   Classes.ResetRecords();
   reloadArrayValuesToGUI();
 }
Example #15
0
 public void actionPerformed(ActionEvent e) {
   Classes.sortArray(movieReviewRating);
   reloadArrayValuesToGUI();
 }
Example #16
0
 public void actionPerformed(ActionEvent e) {
   Classes.sortArray(movieReleaseYear);
   reloadArrayValuesToGUI();
 }
Example #17
0
 public void actionPerformed(ActionEvent e) {
   Classes.sortArray(movieDirector);
   reloadArrayValuesToGUI();
 }
Example #18
0
 public void actionPerformed(ActionEvent e) {
   Classes.sortArray(IDNumber);
   reloadArrayValuesToGUI();
 }
Example #19
0
 public ContextMutator(Class<?> aFor, Class<T> aWith, String aTagName) {
   method = Classes.getMutatorMethod(aFor, aWith.getSimpleName(), aTagName);
 }
Example #20
0
  public GUI() {
    // ===============================================loads data from savefiles (textfiles)
    Classes.LoadData();
    // =========================================== resets the arrayIndexes array so that the the GUI
    // will first show the records according to IDNumber
    Classes.resetArrayIndexes();
    // =========================================== Redeclaring GUI Components (this is part of GUI
    // Syntax for some reason)
    // =========================================== This also gives text to those GUI Components
    search = new JButton("search");
    clearSearchParameters = new JButton("clear Parameters");
    help = new JButton("Help");
    resetDatabase = new JButton("Reset Database");
    messageToUser = new JLabel("");
    emptyLabel = new JLabel[3];
    newRecordButton = new JButton(" New Record");
    editRecordButton = new JButton(" Edit Record");
    deleteRecordButton = new JButton("Delete Record");

    searchTextfield = new JTextField[7];
    fieldNames = new JButton[7];
    textfield = new JTextField[6][100];
    indexes = new JLabel[100];
    RecordsFieldButtons = new JPanel();
    scrollPane = new JScrollPane();

    emptyLabel[0] = new JLabel("");
    emptyLabel[1] = new JLabel("");
    emptyLabel[2] = new JLabel("");
    fieldNames[0] = new JButton("ID#");
    fieldNames[1] = new JButton("Movie Name");
    fieldNames[2] = new JButton("Movie Length");
    fieldNames[3] = new JButton("Movie Director");
    fieldNames[4] = new JButton("Movie Rating");
    fieldNames[5] = new JButton("Movie Release Year");
    fieldNames[6] = new JButton("Movie Review" + "Rating");
    // =========================================== All the searchTextfields will be preset to the
    // text "enter Search Parameter"
    for (int x = 0; x < 7; x++) {
      searchTextfield[x] = new JTextField("enter Search Parameter");
    }
    // =========================================== This for loop attaches the correct array value to
    // the GUI Components
    for (int x = 0; x < 7; x++) {
      for (int y = 0; y < 100; y++) {
        switch (x) {
          case 0:
            // =============================== This checks if the value of IDNumber[xxx] is blank
            // (which is noted by a -1)
            // =============================== If it is, then it will set the text of its
            // corresponding Textfield to blank
            if (IDNumber[arrayIndexes[y]] == -1) {
              indexes[y] = new JLabel("");
            } else {
              indexes[y] = new JLabel(Integer.toString(IDNumber[arrayIndexes[y]]));
            }
            break;
          case 1:
            // =============================== This checks if the value of movieName[xxx] is blank
            // (which is noted by a "null")
            // =============================== If it is, then it will set the text of its
            // corresponding Textfield to blank
            if (movieName[arrayIndexes[y]].equals("null") == true) {
              textfield[x - 1][y] = new JTextField("");
            } else {
              textfield[x - 1][y] = new JTextField(movieName[arrayIndexes[y]]);
            }
            break;
          case 2:
            // =============================== This checks if the value of movieLength[xxx] is blank
            // (which is noted by a -1)
            // =============================== If it is, then it will set the text of its
            // corresponding Textfield to blank
            if (movieLength[arrayIndexes[y]] == -1) {
              textfield[x - 1][y] = new JTextField("");
            } else {
              textfield[x - 1][y] =
                  new JTextField(Integer.toString(movieLength[arrayIndexes[y]]) + " minutes");
            }
            break;
          case 3:
            // =============================== This checks if the value of movieDirector[xxx] is
            // blank (which is noted by a "null")
            // =============================== If it is, then it will set the text of its
            // corresponding Textfield to blank
            if (movieDirector[arrayIndexes[y]].equals("null") == true) {
              textfield[x - 1][y] = new JTextField("");
            } else {
              textfield[x - 1][y] = new JTextField(movieDirector[arrayIndexes[y]]);
            }
            break;
          case 4:
            // =============================== This checks if the value of movieRating[xxx] is blank
            // (which is noted by a "null") or if it is unavailable "N/A"
            // =============================== If it is, then it will set the text of its
            // corresponding Textfield to blank
            if ((movieRating[arrayIndexes[y]].equals("null") == true)
                || (movieRating[arrayIndexes[y]].equals("N/A") == true)) {
              textfield[x - 1][y] = new JTextField("");
            } else {
              textfield[x - 1][y] = new JTextField(movieRating[arrayIndexes[y]]);
            }
            break;
          case 5:
            // =============================== This checks if the value of movieReleaseYear[xxx] is
            // blank (which is noted by a -1)
            // =============================== If it is, then it will set the text of its
            // corresponding Textfield to blank
            if (movieReleaseYear[arrayIndexes[y]] == -1) {
              textfield[x - 1][y] = new JTextField("");
            } else {
              textfield[x - 1][y] =
                  new JTextField(Integer.toString(movieReleaseYear[arrayIndexes[y]]));
            }
            break;
          case 6:
            // =============================== This checks if the value of movieReviewRating[xxx] is
            // blank (which is noted by a -0.1)
            // =============================== If it is, then it will set the text of its
            // corresponding Textfield to blank
            if (movieReviewRating[arrayIndexes[y]] == -0.1) {
              textfield[x - 1][y] = new JTextField("");
            } else {
              textfield[x - 1][y] =
                  new JTextField(Double.toString(movieReviewRating[arrayIndexes[y]]));
            }
            break;
        }
        // =============================== This disables the ability for the all the textfields to
        // be edited.
        if ((x <= 6) && (x >= 1)) {
          textfield[x - 1][y].setEditable(false);
        }
      }
    }
    // ======================================= Makes the layout of the panel (gridlayout)
    RecordsFieldButtons.setLayout(new GridLayout(103, 7));
    // ======================================= adds the GUI components to the GUI
    RecordsFieldButtons.add(newRecordButton);
    RecordsFieldButtons.add(editRecordButton);
    RecordsFieldButtons.add(deleteRecordButton);
    // RecordsFieldButtons.add(messageToUser);
    // RecordsFieldButtons.add(emptyLabel[0]);
    // RecordsFieldButtons.add(emptyLabel[1]);
    // RecordsFieldButtons.add(emptyLabel[2]);
    RecordsFieldButtons.add(search);
    RecordsFieldButtons.add(clearSearchParameters);
    RecordsFieldButtons.add(resetDatabase);
    RecordsFieldButtons.add(help);

    // ======================================= places the searchTextfield onto the GUI
    for (int x = 0; x < 7; x++) {
      RecordsFieldButtons.add(searchTextfield[x]);
    }
    // ======================================= places the fieldnames onto the GUI. (the fieldnames
    // are also the buttons for sort)
    for (int x = 0; x < 7; x++) {
      // fieldNames[x].setLineWrap(true);
      RecordsFieldButtons.add(fieldNames[x]);
    }
    // ======================================= places the rest of the array values( textfields) onto
    // the GUI
    for (int y = 0; y < 100; y++) {
      for (int x = 0; x < 7; x++) {
        if (x == 0) {
          RecordsFieldButtons.add(indexes[y]);
        } else {
          RecordsFieldButtons.add(textfield[x - 1][y]);
        }
      }
    }
    // ======================================= changes the color of the fields names to orange
    // ======================================= the point of this is to give a separation between the
    // arrayvalues and the function buttons
    for (int i = 0; i < 7; i++) {
      fieldNames[i].setBackground(Color.ORANGE);
    }
    // ======================================= adds actions to all the GUI Components( if any)
    fieldNames[0].addActionListener(new whenUserClickIDNumberButton());
    fieldNames[1].addActionListener(new whenUserClickMovieNameButton());
    fieldNames[2].addActionListener(new whenUserClickMovieLengthButton());
    fieldNames[3].addActionListener(new whenUserClickMovieDirectorButton());
    fieldNames[4].addActionListener(new whenUserClickMovieRatingButton());
    fieldNames[5].addActionListener(new whenUserClickMovieReleaseYearButton());
    fieldNames[6].addActionListener(new whenUserClickMovieReviewButton());
    search.addActionListener(new whenUserClickSearchButton());
    clearSearchParameters.addActionListener(new whenUserClickClearParametersButton());
    help.addActionListener(new helpFunction());
    resetDatabase.addActionListener(new whenUserClicksResetDatabse());
    newRecordButton.addActionListener(new whenUserClicksNewButton());
    editRecordButton.addActionListener(new whenUserClicksEditButton());
    deleteRecordButton.addActionListener(new whenUserClicksDeleteButton());
    JFrame frame = new JFrame("Movie Database");
    frame.addWindowListener(new whenUserClicksXOnTheCornerOfWindow());
    frame.setResizable(true);
    frame.add(new JScrollPane(RecordsFieldButtons));
    frame.setSize(100, 100);
    frame.setVisible(true);
    frame.pack();
  }
Example #21
0
 private void installClasses(Classes cs) {
   for (Enumeration e = cs.getElements(); e.hasMoreElements(); ) {
     installClass(new CgenNode((Class_) e.nextElement(), CgenNode.NotBasic, this));
   }
 }
  /**
   * Manipulates the map once available. This callback is triggered when the map is ready to be
   * used. This is where we can add markers or lines, add listeners or move the camera. In this
   * case, we just add a marker near Sydney, Australia. If Google Play services is not installed on
   * the device, the user will be prompted to install it inside the SupportMapFragment. This method
   * will only be triggered once the user has installed Google Play services and returned to the
   * app.
   */
  @Override
  public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
    if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)
        == PackageManager.PERMISSION_GRANTED) {
      mMap.setMyLocationEnabled(true);
    }
    mMap.setOnMarkerDragListener(
        new GoogleMap.OnMarkerDragListener() {
          @Override
          public void onMarkerDragStart(Marker marker) {}

          @Override
          public void onMarkerDrag(Marker marker) {}

          @Override
          public void onMarkerDragEnd(Marker marker) {
            LatLng latlng = marker.getPosition();
            double lat = latlng.latitude;
            double lon = latlng.longitude;
            // Add the lat and long to the student in database
            Firebase.setAndroidContext(getApplicationContext());
            Student currentStudent = null;
            if (getApplication() != null) {
              currentStudent = ((MyApplication) getApplication()).getStudent();
            }
            // Go to the current student in the firebase databse
            Firebase ref =
                new Firebase(
                    "https://purduescheduler.firebaseio.com/Students/" + currentStudent.getId());
            // Go to the current student's home location in the firebase data
            Firebase scheduleRef = ref.child("HomeLocation");
            HashMap<String, Double> homelocation = new HashMap<String, Double>();
            homelocation.put("Latitude", lat);
            homelocation.put("Longitude", lon);
            // Put all of the classes in the database for the students
            scheduleRef.setValue(homelocation);

            currentStudent.setLatitude(lat);
            currentStudent.setLongitude(lon);
          }
        });
    // Set the view to Purdue University and move the camera
    LatLng purdueUni = new LatLng(40.427976, -86.915479);
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(purdueUni, 15));

    mMap.setInfoWindowAdapter(
        new GoogleMap.InfoWindowAdapter() {

          @Override
          public View getInfoWindow(Marker arg0) {
            return null;
          }

          @Override
          public View getInfoContents(Marker marker) {

            LinearLayout info = new LinearLayout(MapsActivity.this);
            info.setOrientation(LinearLayout.VERTICAL);

            TextView snippet = new TextView(MapsActivity.this);
            snippet.setTextColor(Color.BLACK);
            snippet.setText(marker.getSnippet());

            // info.addView(title);
            info.addView(snippet);

            return info;
          }
        });

    Date date = new Date();
    String currDay = (String) android.text.format.DateFormat.format("EEEE", date);

    String dayLetter = getLetter(currDay);

    final Student currentStudent = ((MyApplication) getApplication()).getStudent();
    ArrayList<Classes> currentStudentClasses = new ArrayList<Classes>();
    currentStudentClasses = currentStudent.getSchedule();

    ArrayList<HashMap<String, Object>> markers = new ArrayList();
    for (Classes specClass : currentStudentClasses) {
      if (specClass.getDays().contains(dayLetter)) {
        if (specClass.getLatitude() != null) {
          boolean alreadyThere = false;
          int whereAt = 0;
          for (int i = 0; i < markers.size(); i++) {
            if (specClass.getLatitude().equals(markers.get(i).get("Latitude"))
                && specClass.getLongitude().equals(markers.get(i).get("Longitude"))) {
              alreadyThere = true;
              whereAt = i;
              break;
            }
          }
          if (alreadyThere) {
            ArrayList<HashMap<String, String>> classes =
                (ArrayList) markers.get(whereAt).get("Classes");
            HashMap<String, String> currentClass = new HashMap();
            currentClass.put(
                "Class",
                "Class: "
                    + specClass.getMajor()
                    + " "
                    + specClass.getCourseNum()
                    + "\n"
                    + specClass.getLocation());
            currentClass.put("StartTime", specClass.getStartTime());
            classes.add(currentClass);
            markers.get(whereAt).put("Classes", classes);
          } else {
            HashMap<String, Object> marker = new HashMap();
            marker.put("Latitude", specClass.getLatitude());
            marker.put("Longitude", specClass.getLongitude());
            ArrayList<HashMap<String, String>> classes = new ArrayList();
            HashMap<String, String> currentClass = new HashMap();
            currentClass.put(
                "Class",
                "Class: "
                    + specClass.getMajor()
                    + " "
                    + specClass.getCourseNum()
                    + "\n"
                    + specClass.getLocation());
            currentClass.put("StartTime", specClass.getStartTime());
            classes.add(currentClass);
            marker.put("Classes", classes);
            markers.add(marker);
          }
        }
      }
    }

    for (int i = 0; i < markers.size(); i++) {
      HashMap<String, Object> currentMarker = markers.get(i);
      ArrayList<HashMap<String, String>> classes = (ArrayList) currentMarker.get("Classes");
      sortMarkers(classes);
      System.out.println(classes);
      String currentSnippet = "";
      int j = 0;
      while (j < classes.size() - 1) {
        currentSnippet += classes.get(j).get("Class") + "\n";
        j++;
      }
      currentSnippet += classes.get(j).get("Class");
      mMap.addMarker(
          new MarkerOptions()
              .position(
                  new LatLng(
                      Double.parseDouble((String) currentMarker.get("Latitude")),
                      Double.parseDouble((String) currentMarker.get("Longitude"))))
              .title("")
              .snippet(currentSnippet));
    }

    if (currentStudent.getLatitude() != 0) {
      Marker homeMarker =
          mMap.addMarker(
              new MarkerOptions()
                  .position(new LatLng(currentStudent.getLatitude(), currentStudent.getLongitude()))
                  .title("Home")
                  .snippet("Home")
                  .draggable(true)
                  .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
    }
  }
Example #23
0
 private Class<?>[] getTestClasses() {
   Classes annotation = this.testClass.getAnnotation(Classes.class);
   return (annotation != null ? annotation.value() : EMPTY_CLASS_ARRAY);
 }
Example #24
0
 public Property(Class<T> clazz) throws Exception {
   this(Classes.of(clazz));
 }
Example #25
0
 private Resources() {
   Classes.instantiationNotAllowed();
 }