示例#1
0
 private HtmlInputText buildInputTextField(CustomButtonNode parent) {
   HtmlInputText text = new HtmlInputText();
   text.setStyle("margin-left:" + (parent.getOffset() + 5) + "px;");
   text.addValueChangeListener(
       new ValueChangeListener() {
         public void processValueChange(ValueChangeEvent e) throws AbortProcessingException {
           valueChanged(e);
         }
       });
   text.setPartialSubmit(true);
   return text;
 }
示例#2
0
 // returns the current value pair contained in the panelgroup
 public String getCurrentPanelChildValue(int childIndex) {
   Object obj = currentPanel.getChildren().get(childIndex);
   String returnStr = "";
   if (obj instanceof HtmlSelectOneMenu) {
     HtmlSelectOneMenu menu = (HtmlSelectOneMenu) obj;
     returnStr = menu.getValue().toString();
   } else if (obj instanceof HtmlInputText) {
     HtmlInputText text = (HtmlInputText) obj;
     returnStr = text.getValue().toString();
   } else if (obj instanceof HtmlOutputText) {
     HtmlOutputText text = (HtmlOutputText) obj;
     returnStr = text.getValue().toString();
   }
   return returnStr;
 }
  public String action_clear() {
    txtNombre.setValue(null);
    btnSave.setDisabled(false);
    btnDelete.setDisabled(true);
    btnModify.setDisabled(true);
    btnClear.setDisabled(false);

    return "";
  }
 public String action_commandLink() {
   try {
     SabAutor sabAutorr = DelegadoNegocioVista.getSabAutor(idAutor);
     if (sabAutorr.getNombre() != null) {
       txtNombre.setValue(sabAutorr.getNombre());
       btnModify.setDisabled(false);
       btnSave.setDisabled(true);
       btnDelete.setDisabled(false);
       btnModify.setDisabled(false);
       btnClear.setDisabled(false);
     } else {
       throw new Exception(FacesUtils.getMensaje("error.autor.no.encontrado"));
     }
   } catch (Exception e) {
     mensaje.addErrorMessage(e.getMessage());
   }
   return "";
 }
示例#5
0
文件: AddSitePage.java 项目: IQSS/dvn
  public String createScholarDataverse() {
    String dataversetype = dataverseType;

    String name = (String) dataverseName.getValue();
    String alias = (String) dataverseAlias.getValue();
    String strAffiliation = (String) affiliation.getValue();
    String strShortDescription = (String) shortDescription.getValue();
    Long userId = getVDCSessionBean().getLoginBean().getUser().getId();

    if (validateClassificationCheckBoxes()) {
      vdcService.createScholarDataverse(
          userId, firstName, lastName, name, strAffiliation, alias, dataversetype);
      VDC createdScholarDataverse = vdcService.findScholarDataverseByAlias(alias);
      saveClassifications(createdScholarDataverse);

      //  add default values to the VDC table and commit/set the vdc bean props
      createdScholarDataverse.setDisplayNetworkAnnouncements(
          getVDCRequestBean().getCurrentVdcNetwork().isDisplayAnnouncements());
      createdScholarDataverse.setDisplayAnnouncements(
          getVDCRequestBean().getCurrentVdcNetwork().isDisplayVDCAnnouncements());
      // on create if description is blank uncheck display flag
      if (strShortDescription.isEmpty()) {
        createdScholarDataverse.setDisplayAnnouncements(false);
      }
      createdScholarDataverse.setAnnouncements(
          getVDCRequestBean().getCurrentVdcNetwork().getDefaultVDCAnnouncements());
      createdScholarDataverse.setDisplayNewStudies(
          getVDCRequestBean().getCurrentVdcNetwork().isDisplayVDCRecentStudies());
      createdScholarDataverse.setAboutThisDataverse(
          getVDCRequestBean().getCurrentVdcNetwork().getDefaultVDCAboutText());
      createdScholarDataverse.setContactEmail(
          getVDCSessionBean().getLoginBean().getUser().getEmail());
      createdScholarDataverse.setDvnDescription(strShortDescription);
      createdScholarDataverse.setAnnouncements(
          strShortDescription); // also set default dv home page description from the the DVN home
                                // page short description
      VDCNetwork vdcNetwork;
      if (selectSubNetworkId != null && selectSubNetworkId > 0) {
        vdcNetwork = vdcNetworkService.findById(selectSubNetworkId);
        createdScholarDataverse.setVdcNetwork(vdcNetwork);
      } else {
        vdcNetwork = vdcNetworkService.findRootNetwork();
        createdScholarDataverse.setVdcNetwork(vdcNetwork);
      }
      // Set default template to subnet's default template
      Template template = vdcNetwork.getDefaultTemplate();
      createdScholarDataverse.setDefaultTemplate(template);

      vdcService.edit(createdScholarDataverse);

      String hostUrl = PropertyUtil.getHostUrl();
      VDCUser creator =
          userService.findByUserName(getVDCSessionBean().getLoginBean().getUser().getUserName());
      String toMailAddress = getVDCSessionBean().getLoginBean().getUser().getEmail();
      String siteAddress = hostUrl + "/dvn/dv/" + createdScholarDataverse.getAlias();

      mailService.sendAddSiteNotification(toMailAddress, name, siteAddress);

      // Refresh User object in LoginBean so it contains the user's new role of VDC administrator.
      getVDCSessionBean().getLoginBean().setUser(creator);
      getVDCRenderBean().getFlash().put("successMessage", "Your new dataverse has been created!");
      return "/site/AddSiteSuccessPage?faces-redirect=true&vdcId="
          + createdScholarDataverse.getId();
    } else {
      return null;
    }
  }