示例#1
0
 private void setAdsNameList() {
   List<Ads> adslist = new ArrayList<Ads>();
   adslist.addAll(loadAds());
   jComboBoxAds.removeAllItems();
   if (adslist != null && !adslist.isEmpty()) {
     for (Ads one : adslist) {
       jComboBoxAds.addItem(new ComboItem(one.getTitle(), "" + one.getId()));
     }
   } else {
     jComboBoxAds.addItem(new String("No items"));
   }
 }
示例#2
0
 private void deleteAds() {
   if (_ads != null && _ads.getId() > 0) {
     AdsIntf adsBc = AdsImpl.getInstance();
     adsBc.deleteAds(_ads);
   }
   setAdsNameList();
 }
示例#3
0
 private void saveUpdateAds(Ads ads) {
   setAllFildsToAds();
   AdsIntf adsBc = AdsImpl.getInstance();
   if (ads != null && ads.getId() <= 0) {
     adsBc.saveAds(_ads);
   } else {
     adsBc.updateAds(_ads);
   }
   setAdsNameList();
 }
示例#4
0
 private void newAds() {
   jTextFieldAdsTitle.setText("");
   jTextAreaAdsMessage.setText("");
   jTextFieldAdress.setText("");
   jTextFieldPhoneNumber.setText("");
   jTextFieldYoutubeUrl.setText("");
   jTextFieldwww.setText("");
   jLabelImegaesPath.setText("");
   _ads.setId(0);
 }
示例#5
0
 private void setAdstoComponents(Ads ads) {
   if (ads != null) {
     jTextFieldAdsTitle.setText(ads.getTitle());
     jTextAreaAdsMessage.setText(ads.getDescription());
     jTextFieldAdress.setText(ads.getMapAddress());
     jTextFieldPhoneNumber.setText(ads.getPhoneNumber());
     jTextFieldYoutubeUrl.setText(ads.getYoutubeVideoUrl());
     jTextFieldwww.setText(ads.getWWW());
     jLabelImegaesPath.setText(ads.getFileUploadInput());
   }
 }
示例#6
0
 private void setAllFildsToAds() {
   _ads.setTitle(jTextFieldAdsTitle.getText() != null ? jTextFieldAdsTitle.getText() : "");
   _ads.setDescription(jTextAreaAdsMessage.getText() != null ? jTextAreaAdsMessage.getText() : "");
   _ads.setMapAddress(jTextFieldAdress.getText() != null ? jTextFieldAdress.getText() : "");
   _ads.setFileUploadInput(jLabelImegaesPath.getText() != null ? jLabelImegaesPath.getText() : "");
   _ads.setYoutubeVideoUrl(
       jTextFieldYoutubeUrl.getText() != null ? jTextFieldYoutubeUrl.getText() : "");
   _ads.setPhoneNumber(
       jTextFieldPhoneNumber.getText() != null ? jTextFieldPhoneNumber.getText() : "");
   if (jTextFieldwww.getText() != null
       && jTextFieldwww.getText().length() > 0
       && !jTextFieldwww.getText().toLowerCase().contains("www.")) {
     _ads.setWWW("www." + jTextFieldwww.getText());
   } else {
     _ads.setWWW(jTextFieldwww.getText());
   }
 }
示例#7
0
 private String getImagesName(File[] selectedFiles) {
   StringBuffer filesName = null;
   StringBuffer filesPath = null;
   if (selectedFiles.length > 0) {
     filesName = new StringBuffer();
     filesPath = new StringBuffer();
     File[] fileList = selectedFiles;
     filesName.append(fileList[0].getName());
     filesPath.append(fileList[0].getAbsolutePath());
     for (int i = 1; i < fileList.length; i++) {
       filesName.append(", " + fileList[i].getName());
       filesPath.append(", " + fileList[i].getAbsolutePath());
     }
     _ads.setImagePath(filesPath.toString());
   }
   return filesName.toString();
 }