コード例 #1
0
  private void importReportFromStreamPerformed(AjaxRequestTarget target) {
    String xml = xmlEditorModel.getObject();
    if (StringUtils.isEmpty(xml)) {
      error(getString("PageNewReport.message.emptyXml"));
      target.add(getFeedbackPanel());

      return;
    }

    OperationResult result = new OperationResult(OPERATION_IMPORT_REPORT_XML);
    InputStream stream = null;
    try {

      setResponsePage(new PageReport(new ReportDto(Base64.encodeBase64(xml.getBytes()))));
    } catch (Exception ex) {
      result.recordFatalError("Couldn't import object.", ex);
      LoggingUtils.logException(LOGGER, "Error occured during xml import", ex);
    } finally {
      if (stream != null) {
        IOUtils.closeQuietly(stream);
      }
    }

    if (result.isSuccess()) {
      xmlEditorModel.setObject(null);
    }

    showResult(result);
    target.add(getFeedbackPanel());
  }
コード例 #2
0
ファイル: AutomationPage.java プロジェクト: eldieon/webanno
  private void update(AjaxRequestTarget target) {
    JCas jCas = null;
    try {
      CuratorUtil.updatePanel(
          target,
          automateView,
          curationContainer,
          mergeVisualizer,
          repository,
          annotationSelectionByUsernameAndAddress,
          curationSegment,
          annotationService,
          userRepository);

      jCas = repository.readCorrectionCas(bModel.getDocument());
    } catch (UIMAException e) {
      error(ExceptionUtils.getRootCauseMessage(e));
    } catch (ClassNotFoundException e) {
      error(e.getMessage());
    } catch (IOException e) {
      error(e.getMessage());
    } catch (BratAnnotationException e) {
      error(e.getMessage());
    }

    gotoPageTextField.setModelObject(getFirstSentenceNumber(jCas, bModel.getSentenceAddress()) + 1);
    gotoPageAddress = getSentenceAddress(jCas, gotoPageTextField.getModelObject());

    target.add(gotoPageTextField);
    target.add(automateView);
    target.add(numberOfPages);
  }
コード例 #3
0
  private void removeValue(AjaxRequestTarget target) {
    ValueWrapper wrapper = model.getObject();
    ItemWrapper propertyWrapper = wrapper.getItem();

    List<ValueWrapper> values = propertyWrapper.getValues();
    Component inputPanel = this.get(ID_VALUE_CONTAINER).get(ID_INPUT);

    switch (wrapper.getStatus()) {
      case ADDED:
        values.remove(wrapper);
        break;
      case DELETED:
        error("Couldn't delete already deleted item: " + wrapper.toString());
        target.add(((PageBase) getPage()).getFeedbackPanel());
      case NOT_CHANGED:
        wrapper.setStatus(ValueStatus.DELETED);
        break;
    }

    int count = countUsableValues(propertyWrapper);
    if (count == 0 && !hasEmptyPlaceholder(propertyWrapper)) {
      if (inputPanel instanceof ValueChoosePanel) {
        values.add(
            new ValueWrapper(propertyWrapper, new PrismReferenceValue(null), ValueStatus.ADDED));
      } else {
        values.add(
            new ValueWrapper(propertyWrapper, new PrismPropertyValue(null), ValueStatus.ADDED));
      }
    }
    ListView parent = findParent(ListView.class);
    target.add(parent.getParent());
  }
コード例 #4
0
  private void savePerformed(boolean raw, String operationName, AjaxRequestTarget target) {
    clearOldFeedback();

    OperationResult result = new OperationResult(operationName);

    if (!validateInput(raw)) {
      error(getString("pageImportObject.message.nullFile"));
      target.add(getFeedbackPanel());

      return;
    }
    InputStream stream = null;

    try {
      Task task = createSimpleTask(operationName);
      stream = getInputStream(raw);
      getModelService().importObjectsFromStream(stream, model.getObject(), task, result);

      result.recomputeStatus();
    } catch (Exception ex) {
      result.recordFatalError("Couldn't import file.", ex);
      LoggingUtils.logUnexpectedException(LOGGER, "Couldn't import file", ex);
    } finally {
      if (stream != null) {
        IOUtils.closeQuietly(stream);
      }
    }

    showResult(result);
    target.add(PageImportObject.this);
  }
コード例 #5
0
  private void importAccount(AjaxRequestTarget target, AccountContentDto row) {
    List<AccountContentDto> accounts = isAnythingSelected(target, row);
    if (accounts.isEmpty()) {
      return;
    }

    OperationResult result = new OperationResult(OPERATION_CREATE_USER_FROM_ACCOUNTS);
    for (AccountContentDto dto : accounts) {
      OperationResult subResult = result.createMinorSubresult(OPERATION_CREATE_USER_FROM_ACCOUNT);
      try {
        getModelService()
            .importFromResource(
                dto.getAccountOid(),
                createSimpleTask(OPERATION_CREATE_USER_FROM_ACCOUNT),
                subResult);
      } catch (Exception ex) {
        subResult.computeStatus(
            getString("pageContentAccounts.message.cantImportAccount", dto.getAccountOid()));
        LoggingUtils.logException(
            LOGGER,
            "Can't import account {},oid={}",
            ex,
            dto.getAccountName(),
            dto.getAccountOid());
      } finally {
        subResult.computeStatusIfUnknown();
      }
    }

    result.computeStatus();
    showResult(result);

    target.add(getFeedbackPanel());
    target.add(getTable());
  }
コード例 #6
0
ファイル: SearchForm.java プロジェクト: racheljones/ark
  @Override
  protected void onSearch(AjaxRequestTarget target) {
    target.add(feedbackPanel);

    // Set study in context
    Long studyId =
        (Long)
            SecurityUtils.getSubject()
                .getSession()
                .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID);
    // Get a list of all Fields for the Study in context
    Study study = iArkCommonService.getStudy(studyId);

    Upload searchUpload = getModelObject().getUpload();
    searchUpload.setStudy(study);
    searchUpload.setArkFunction(
        iArkCommonService.getArkFunctionByName(Constants.FUNCTION_KEY_VALUE_DATA_DICTIONARY));

    Collection<Upload> uploadCollection = iArkCommonService.searchUploads(searchUpload);

    if (uploadCollection != null && uploadCollection.size() == 0) {
      this.info("Uploads with the specified criteria does not exist in the system.");
      target.add(feedbackPanel);
    }

    getModelObject().setUploadCollection(uploadCollection);

    listView.removeAll();
    arkCrudContainerVO.getSearchResultPanelContainer().setVisible(true);
    target.add(arkCrudContainerVO.getSearchResultPanelContainer());
  }
コード例 #7
0
  public void updatePanel(AjaxRequestTarget aTarget, CurationContainer aCC)
      throws UIMAException, ClassNotFoundException, IOException, BratAnnotationException {
    JCas jCas = repository.readCurationCas(bModel.getDocument());

    final int sentenceAddress =
        getAddr(
            selectSentenceAt(jCas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset()));
    bModel.setSentenceAddress(sentenceAddress);

    final Sentence sentence = selectByAddr(jCas, Sentence.class, sentenceAddress);
    List<Sentence> followingSentences =
        selectFollowing(jCas, Sentence.class, sentence, bModel.getPreferences().getWindowSize());
    // Check also, when getting the last sentence address in the display window, if this is the
    // last sentence or the ONLY sentence in the document
    Sentence lastSentenceAddressInDisplayWindow =
        followingSentences.size() == 0
            ? sentence
            : followingSentences.get(followingSentences.size() - 1);
    if (curationView == null) {
      curationView = new SourceListView();
    }
    curationView.setCurationBegin(sentence.getBegin());
    curationView.setCurationEnd(lastSentenceAddressInDisplayWindow.getEnd());

    int ws = bModel.getPreferences().getWindowSize();
    Sentence fs =
        BratAjaxCasUtil.selectSentenceAt(
            jCas, bModel.getSentenceBeginOffset(), bModel.getSentenceEndOffset());
    int l = BratAjaxCasUtil.getLastSentenceAddressInDisplayWindow(jCas, getAddr(fs), ws);
    Sentence ls = (Sentence) selectByAddr(jCas, FeatureStructure.class, l);
    fSn = BratAjaxCasUtil.getSentenceNumber(jCas, fs.getBegin());
    lSn = BratAjaxCasUtil.getSentenceNumber(jCas, ls.getBegin());

    sentencesListView.addOrReplace(sentenceList);
    aTarget.add(sentencesListView);

    /*
     * corssSentAnnoView.addOrReplace(crossSentAnnoList); aTarget.add(corssSentAnnoView);
     */
    aTarget.add(suggestionViewPanel);
    if (annotate) {
      annotator.bratRender(aTarget, editor.getCas(bModel));
      annotator.bratSetHighlight(aTarget, bModel.getSelection().getAnnotation());

    } else {
      annotator.bratRenderLater(aTarget);
    }
    annotate = false;
    CuratorUtil.updatePanel(
        aTarget,
        suggestionViewPanel,
        aCC,
        annotator,
        repository,
        annotationSelectionByUsernameAndAddress,
        curationView,
        annotationService,
        userRepository);
  }
コード例 #8
0
  private void importReportFromFilePerformed(AjaxRequestTarget target) {
    OperationResult result = new OperationResult(OPERATION_IMPORT_REPORT);

    FileUploadField file =
        (FileUploadField)
            get(createComponentPath(ID_MAIN_FORM, ID_INPUT, ID_INPUT_FILE, ID_FILE_INPUT));
    final FileUpload uploadedFile = file.getFileUpload();
    if (uploadedFile == null) {
      error(getString("PageNewReport.message.nullFile"));
      target.add(getFeedbackPanel());

      return;
    }

    InputStream stream = null;
    File newFile = null;
    try {
      // Create new file
      MidPointApplication application = getMidpointApplication();
      WebApplicationConfiguration config = application.getWebApplicationConfiguration();
      File folder = new File(config.getImportFolder());
      if (!folder.exists() || !folder.isDirectory()) {
        folder.mkdir();
      }

      newFile = new File(folder, uploadedFile.getClientFileName());
      // Check new file, delete if it already exists
      if (newFile.exists()) {
        newFile.delete();
      }
      // Save file
      //            Task task = createSimpleTask(OPERATION_IMPORT_FILE);
      newFile.createNewFile();
      uploadedFile.writeTo(newFile);

      InputStreamReader reader = new InputStreamReader(new FileInputStream(newFile), "utf-8");
      //            reader.
      stream = new ReaderInputStream(reader, reader.getEncoding());
      byte[] reportIn = IOUtils.toByteArray(stream);

      setResponsePage(new PageReport(new ReportDto(Base64.encodeBase64(reportIn))));
    } catch (Exception ex) {
      result.recordFatalError("Couldn't import file.", ex);
      LoggingUtils.logException(LOGGER, "Couldn't import file", ex);
    } finally {
      if (stream != null) {
        IOUtils.closeQuietly(stream);
      }
      if (newFile != null) {
        FileUtils.deleteQuietly(newFile);
      }
    }

    showResult(result);
    target.add(getFeedbackPanel());
  }
コード例 #9
0
ファイル: PageInternals.java プロジェクト: mythoss/midpoint
 private void resetPerformed(AjaxRequestTarget target) {
   OperationResult result =
       new OperationResult(PageInternals.class.getName() + ".changeTimeReset");
   clock.resetOverride();
   model.reset();
   result.recordSuccess();
   showResult(result);
   target.add(getMainForm());
   target.add(getFeedbackPanel());
 }
コード例 #10
0
ファイル: PageCreatedReports.java プロジェクト: pstd/midpoint
  private void refreshTable(AjaxRequestTarget target) {
    Table panel = getReportOutputTable();

    ReportsStorage storage = getSessionStorage().getReports();
    storage.setReportOutputSearch(searchModel.getObject());
    storage.setReportOutputsPaging(null);
    panel.setCurrentPage(0);

    target.add((Component) panel);
    target.add(getFeedbackPanel());
  }
コード例 #11
0
  private void searchPerformed(AjaxRequestTarget target) {
    ObjectQuery query = createQuery();

    TablePanel panel = getTable();
    DataTable table = panel.getDataTable();
    AccountContentDataProvider provider = (AccountContentDataProvider) table.getDataProvider();
    provider.setQuery(query);
    table.setCurrentPage(0);

    target.add(panel);
    target.add(getFeedbackPanel());
  }
コード例 #12
0
 @Override
 protected void onUpdate(AjaxRequestTarget target) {
   updateState();
   MarkupContainer form = (MarkupContainer) get("saveResultsForm");
   Component saveResultsLink = form.get("saveResultsLink");
   Component addResultsLink = form.get("addResultsLink");
   Component subtractResultsLink = form.get("subtractResultsLink");
   Component intersectResultsLink = form.get("intersectResultsLink");
   target.add(addResultsLink);
   target.add(subtractResultsLink);
   target.add(saveResultsLink);
   target.add(intersectResultsLink);
 }
コード例 #13
0
  private void savePerformed(AjaxRequestTarget target) {
    ObjectViewDto dto = model.getObject();
    if (StringUtils.isEmpty(dto.getXml())) {
      error(getString("pageResourceEdit.message.emptyXml"));
      target.add(getFeedbackPanel());
      return;
    }

    Task task = createSimpleTask(OPERATION_SAVE_RESOURCE);
    OperationResult result = task.getResult();
    try {
      Holder<PrismObject<ResourceType>> objectHolder = new Holder<PrismObject<ResourceType>>(null);
      validateObject(dto.getXml(), objectHolder, false, result);

      if (result.isAcceptable()) {
        PrismObject<ResourceType> newResource = objectHolder.getValue();
        updateConnectorRef(newResource, task, result);

        if (!isEditing()) {
          // we're adding new resource
          ObjectDelta delta = ObjectDelta.createAddDelta(newResource);
          getModelService()
              .executeChanges(WebMiscUtil.createDeltaCollection(delta), null, task, result);
        } else {
          // we're editing existing resource
          PrismObject<ResourceType> oldResource = dto.getObject();
          ObjectDelta<ResourceType> delta = oldResource.diff(newResource);

          getModelService()
              .executeChanges(
                  WebMiscUtil.createDeltaCollection(delta),
                  ModelExecuteOptions.createRaw(),
                  task,
                  result);
        }

        result.computeStatus();
      }
    } catch (Exception ex) {
      LoggingUtils.logException(LOGGER, "Couldn't save resource", ex);
      result.recordFatalError("Couldn't save resource.", ex);
    }

    if (WebMiscUtil.isSuccessOrHandledError(result)) {
      showResultInSession(result);
      setResponsePage(PageResources.class);
    } else {
      showResult(result);
      target.add(getFeedbackPanel());
    }
  }
コード例 #14
0
  private void removeOwnerPerformed(AjaxRequestTarget target, AccountContentDto row) {
    List<AccountContentDto> accounts = isAnythingSelected(target, row);
    if (accounts.isEmpty()) {
      return;
    }

    for (AccountContentDto dto : accounts) {
      reloadOwnerChangeModel(dto.getAccountOid(), dto.getOwnerOid());
      ownerChangePerformed(target, null);
    }

    target.add(getTable());
    target.add(getFeedbackPanel());
  }
コード例 #15
0
  private void clearSearchPerformed(AjaxRequestTarget target) {
    searchModel.setObject(new AccountContentSearchDto());

    TablePanel panel = getTable();
    DataTable table = panel.getDataTable();
    AccountContentDataProvider provider = (AccountContentDataProvider) table.getDataProvider();
    provider.setQuery(null);

    ResourcesStorage storage = getSessionStorage().getResources();
    storage.setAccountContentSearch(searchModel.getObject());
    storage.setAccountContentPaging(null);
    panel.setCurrentPage(null);

    target.add(get(ID_SEARCH_FORM));
    target.add(panel);
  }
コード例 #16
0
ファイル: UserFormPanel.java プロジェクト: RobKuipers/ehour
  @Override
  protected boolean processFormSubmit(
      AjaxRequestTarget target, AdminBackingBean backingBean, AjaxEventType type) throws Exception {
    UserManageBackingBean userManageBackingBean = (UserManageBackingBean) backingBean;

    boolean eventHandled;

    try {
      User user = userManageBackingBean.getUser();
      eventHandled = false;

      if (type == USER_CREATED) {
        userService.persistNewUser(user, user.getPassword());
      } else if (type == USER_UPDATED) {
        userService.persistEditedUser(user);

        String password = user.getPassword();
        if (StringUtils.isNotBlank(password)) {
          userService.changePassword(user.getUsername(), password);
        }
      } else if (type == USER_DELETED) {
        deleteUser(userManageBackingBean);
      }
    } catch (ObjectNotUniqueException obnu) {
      backingBean.setServerMessage(obnu.getMessage());
      target.add(this);
      eventHandled = true;
    }

    return !eventHandled;
  }
コード例 #17
0
ファイル: UiValue.java プロジェクト: Evolveum/playground
  private void addValue(AjaxRequestTarget target) {
    FieldModel fieldModel = model.getObject().getField();
    fieldModel.addValue();

    ListView listView = findParent(ListView.class);
    target.add(listView.getParent());
  }
コード例 #18
0
  private void deleteDefinitionPerformed(
      AjaxRequestTarget target, AccessCertificationDefinitionType definition) {
    OperationResult result = new OperationResult(OPERATION_DELETE_DEFINITION);
    try {
      Task task = createSimpleTask(OPERATION_DELETE_DEFINITION);
      ObjectDelta<AccessCertificationDefinitionType> delta =
          ObjectDelta.createDeleteDelta(
              AccessCertificationDefinitionType.class, definition.getOid(), getPrismContext());
      getModelService()
          .executeChanges(WebComponentUtil.createDeltaCollection(delta), null, task, result);
    } catch (Exception ex) {
      result.recordPartialError("Couldn't delete campaign definition.", ex);
      LoggingUtils.logUnexpectedException(LOGGER, "Couldn't delete campaign definition", ex);
    }

    result.computeStatusIfUnknown();
    if (result.isSuccess()) {
      result.recordStatus(
          OperationResultStatus.SUCCESS, "The definition has been successfully deleted.");
    }

    getDefinitionsTable().clearCache();

    showResult(result);
    target.add(getFeedbackPanel(), getDefinitionsTable());
  }
コード例 #19
0
  public void toggleWithContent(final AjaxRequestTarget target, final TopologyNode node) {
    setHeader(target, node.getDisplayName());

    switch (node.getKind()) {
      case SYNCOPE:
        container.addOrReplace(getSyncopeFragment(pageRef));
        break;
      case CONNECTOR_SERVER:
        container.addOrReplace(getLocationFragment(node, pageRef));
        break;
      case FS_PATH:
        container.addOrReplace(getLocationFragment(node, pageRef));
        break;
      case CONNECTOR:
        container.addOrReplace(getConnectorFragment(node, pageRef));
        break;
      case RESOURCE:
        container.addOrReplace(getResurceFragment(node, pageRef));
        break;
      default:
        container.addOrReplace(getEmptyFragment());
    }

    target.add(container);

    this.toggle(target, true);
  }
コード例 #20
0
ファイル: PageCreatedReports.java プロジェクト: pstd/midpoint
  private void deleteSelectedConfirmedPerformed(
      AjaxRequestTarget target, List<ReportOutputType> objects) {
    OperationResult result = new OperationResult(OPERATION_DELETE);

    for (ReportOutputType output : objects) {
      WebModelUtils.deleteObject(ReportOutputType.class, output.getOid(), result, this);
    }
    result.computeStatusIfUnknown();

    ObjectDataProvider provider = getTableDataProvider();
    provider.clearCache();

    showResult(result);
    target.add((Component) getReportOutputTable());
    target.add(getFeedbackPanel());
  }
コード例 #21
0
    @Override
    protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
      try {
        Product product = (Product) form.getDefaultModelObject();

        if (product.getId() == 0) {
          product.setActive(true);

          productDataProvider.persist(product);
        } else {
          productDataProvider.merge(product);
        }

        ProductViewOrEditPanel.this.removeAll();
        ProductViewOrEditPanel.this.add(new ProductViewFragement().setOutputMarkupId(true));
      } catch (RuntimeException e) {
        LOGGER.warn(e.getMessage(), e);

        String[] messages = e.getMessage().split(": ");
        String message = messages[messages.length - 1];

        warn(message.substring(0, 1).toUpperCase() + message.substring(1));
      } finally {
        target.add(target.getPage());
      }
    }
コード例 #22
0
  private void updateAccountStatusPerformed(
      AjaxRequestTarget target, AccountContentDto dto, boolean enabled) {
    List<AccountContentDto> accounts = isAnythingSelected(target, dto);
    OperationResult result = new OperationResult(OPERATION_ADJUST_ACCOUNT_STATUS);

    if (accounts.isEmpty()) {
      return;
    }

    ActivationStatusType status =
        enabled ? ActivationStatusType.ENABLED : ActivationStatusType.DISABLED;

    for (AccountContentDto acc : accounts) {

      ObjectDelta delta =
          ObjectDelta.createModificationReplaceProperty(
              ShadowType.class,
              acc.getAccountOid(),
              new ItemPath(ShadowType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS),
              getPrismContext(),
              status);

      try {
        Task task = createSimpleTask(OPERATION_ADJUST_ACCOUNT_STATUS);
        getModelService()
            .executeChanges(WebMiscUtil.createDeltaCollection(delta), null, task, result);
      } catch (Exception e) {
        LoggingUtils.logException(LOGGER, "Couldn't enable/disable account(s) on resource", e);
        result.recordPartialError("Couldn't enable/disable account(s) on resource", e);
      }
    }
    result.recomputeStatus();
    showResult(result);
    target.add(getFeedbackPanel());
  }
コード例 #23
0
  /*
   * (non-Javadoc)
   * @see net.rrm.ehour.persistence.persistence.ui.common.ajax.AjaxAwareContainer#ajaxEventReceived(net.rrm.ehour.persistence.persistence.ui.common.ajax.AjaxEvent)
   */
  @Override
  @SuppressWarnings("unchecked")
  public boolean ajaxEventReceived(AjaxEvent ajaxEvent) {
    if (ajaxEvent.getEventType() == CommonAjaxEventType.SUBMIT_ERROR) {
      return processFormSubmitError(ajaxEvent.getTarget());
    } else if (ajaxEvent instanceof PayloadAjaxEvent) {
      PayloadAjaxEvent<AdminBackingBean> payloadEvent =
          (PayloadAjaxEvent<AdminBackingBean>) ajaxEvent;

      AdminBackingBean backingBean = payloadEvent.getPayload();
      AjaxEventType type = ajaxEvent.getEventType();
      AjaxRequestTarget target = ajaxEvent.getTarget();

      try {
        processFormSubmit(target, backingBean, type);

      } catch (Exception e) {
        logger.error("While trying to persist/delete", e);
        backingBean.setServerMessage(getLocalizer().getString("general.saveError", this));
        target.add(this);

        return false;
      }
    }

    return true;
  }
コード例 #24
0
ファイル: ListEventsPage.java プロジェクト: CSLD/CSLD
  public void filterChanged(
      boolean sort, boolean requiredLabelsChanged, boolean otherLabelsChanged) {
    // Re-render what is needed
    AjaxRequestTarget art = getRequestCycle().find(AjaxRequestTarget.class);

    art.add(eventsList);

    if (requiredLabelsChanged) {
      art.add(requiredLabelsWrapper);
      art.add(sidePanel.getRequiredLabelsWrapper());
    }

    if (otherLabelsChanged) {
      art.add(sidePanel);
    }
  }
コード例 #25
0
ファイル: Page3.java プロジェクト: naheedmk/fortressdemo2
 @Override
 public void onEvent(IEvent event) {
   // Page level SaveModelEvents triggered by button in the Page Detail Form:
   if (event.getPayload() instanceof SaveModelEvent) {
     SaveModelEvent modelEvent = (SaveModelEvent) event.getPayload();
     switch (modelEvent.getOperation()) {
       case ADD:
         add((Page3EO) modelEvent.getEntity());
         break;
       case UPDATE:
         modelChanged();
         break;
       case DELETE:
         prune();
         break;
       default:
         LOG.error("onEvent caught invalid operation");
         break;
     }
     AjaxRequestTarget target = ((SaveModelEvent) event.getPayload()).getAjaxRequestTarget();
     LOG.debug(".onEvent AJAX - Page3 - SaveModelEvent: " + target.toString());
   }
   // Page level AJAX events - replace TreeGrid:
   else if (event.getPayload() instanceof AjaxRequestTarget) {
     LOG.info("Page level AjaxRequestTarget Event Occurred");
     AjaxRequestTarget target = ((AjaxRequestTarget) event.getPayload());
     target.add(grid);
   }
 }
コード例 #26
0
 @Override
 protected void onDeleteSubmit(AjaxRequestTarget target, Form<?> form) {
   Application.getBean(FieldLanguagesValuesDao.class)
       .delete(getModelObject(), WebSession.getUserId());
   target.add(panel.listContainer);
   target.appendJavaScript("labelsInit();");
 }
コード例 #27
0
ファイル: AsyncUpdatePanel.java プロジェクト: pstd/midpoint
  protected void onUpdateError(AjaxRequestTarget target, Exception ex) {
    String message = "Error occurred while fetching data: " + ex.getMessage();
    Label errorLabel = new Label(ID_BODY, message);
    replace(errorLabel);

    target.add(this);
  }
コード例 #28
0
  private void deleteConfirmedPerformed(AjaxRequestTarget target) {
    List<AccountContentDto> selected = new ArrayList<AccountContentDto>();

    if (singleDelete != null) {
      selected.add(singleDelete);
    } else {
      selected = isAnythingSelected(target, null);
    }

    OperationResult result = new OperationResult(OPERATION_DELETE_ACCOUNT_FROM_RESOURCE);

    for (AccountContentDto acc : selected) {
      String accOid = acc.getAccountOid();

      try {
        Task task = createSimpleTask(OPERATION_DELETE_ACCOUNT_FROM_RESOURCE);

        ObjectDelta delta =
            ObjectDelta.createDeleteDelta(ShadowType.class, accOid, getPrismContext());
        getModelService()
            .executeChanges(WebMiscUtil.createDeltaCollection(delta), null, task, result);

      } catch (Exception e) {
        result.recordPartialError("Couldn't delete account from resource.", e);
        LoggingUtils.logException(LOGGER, "Couldn't delete account from resource", e);
      }
    }

    if (result.isUnknown()) {
      result.recomputeStatus("Error occurred during resource account deletion.");
    }

    if (result.isSuccess()) {
      result.recordStatus(
          OperationResultStatus.SUCCESS, "Selected accounts have been successfully deleted.");
    }

    AccountContentDataProvider provider =
        (AccountContentDataProvider) getTable().getDataTable().getDataProvider();
    provider.clearCache();

    TablePanel table = getTable();
    target.add(table);
    showResult(result);
    target.add(getFeedbackPanel());
  }
コード例 #29
0
 @Override
 protected void onNewSubmit(AjaxRequestTarget target, Form<?> f) {
   Fieldlanguagesvalues flv = new Fieldlanguagesvalues();
   flv.setLanguage_id(panel.language.getLanguage_id());
   this.setModelObject(flv);
   target.add(this);
   target.appendJavaScript("labelsInit();");
 }
コード例 #30
0
ファイル: HomePage.java プロジェクト: b-cuts/blogs
    private static void replace(AjaxRequestTarget target, Component component) {
      component.add(new DisplayNoneBehavior());

      target.prependJavaScript(
          "notify|jQuery('#" + component.getMarkupId() + "').slideUp(1000, notify);");
      target.add(component);
      target.appendJavaScript("jQuery('#" + component.getMarkupId() + "').slideDown(1000);");
    }