Пример #1
0
  @Action
  public Task remove() {
    ConfirmationDialog dialog = module.objectBuilderFactory().newObject(ConfirmationDialog.class);
    dialog.setRemovalMessage(
        i18n.text(
            attachments.getSelectedRows().length > 1
                ? WorkspaceResources.attachments
                : WorkspaceResources.attachment));
    dialogs.showOkCancelHelpDialog(this, dialog, i18n.text(StreamflowResources.confirmation));

    if (dialog.isConfirmed()) {
      final List<AttachmentDTO> removedAttachments = new ArrayList<AttachmentDTO>();
      for (int i : attachments.getSelectedRows()) {
        removedAttachments.add(
            attachmentsModel.getEventList().get(attachments.convertRowIndexToModel(i)));
      }

      return new CommandTask() {
        @Override
        public void command() throws Exception {

          for (AttachmentDTO removedAttachment : removedAttachments) {
            attachmentsModel.removeAttachment(removedAttachment);
          }
        }
      };
    } else return null;
  }
Пример #2
0
 @org.jdesktop.application.Action(block = COMPONENT)
 public Task remove() throws IOException, ResourceException {
   ConfirmationDialog dialog = module.objectBuilderFactory().newObject(ConfirmationDialog.class);
   dialog.setRemovalMessage(((ContactDTO) contacts.getSelectedValue()).name().get());
   dialogs.showOkCancelHelpDialog(this, dialog, i18n.text(StreamflowResources.confirmation));
   if (dialog.isConfirmed()) {
     return new CommandTask() {
       @Override
       public void command() throws Exception {
         model.removeElement(getContactsList().getSelectedIndex());
       }
     };
   } else return null;
 }
  public CaseTypeDetailView(
      @Service ApplicationContext context,
      @Uses final CaseTypeDetailModel model,
      @Structure Module module) {
    this.model = model;
    valueBinder = module.objectBuilderFactory().newObject(ValueBinder.class);

    FormLayout layout = new FormLayout("150dlu, 2dlu, 350", "pref, pref, pref, pref, pref, pref");
    setLayout(layout);
    setMaximumSize(new Dimension(Short.MAX_VALUE, 50));
    DefaultFormBuilder builder = new DefaultFormBuilder(layout, this);

    ownerName = new StreamflowSelectableLabel();

    builder.append(new JLabel(" "));
    builder.nextLine();

    builder.appendSeparator(i18n.text(AdministrationResources.casetype_separator));

    builder.nextLine();

    builder.append(
        i18n.text(AdministrationResources.owner_name_label),
        valueBinder.bind("ownerName", ownerName));
    builder.nextLine();

    ownerId = new StreamflowSelectableLabel();

    builder.append(
        i18n.text(AdministrationResources.owner_id_label), valueBinder.bind("ownerId", ownerId));

    builder.nextLine();
    builder.append(new JLabel(" "));
    builder.nextLine();

    builder.appendSeparator(i18n.text(AdministrationResources.casetype_id_separator));

    builder.nextLine();

    caseTypeId = new StreamflowSelectableLabel();

    builder.append(i18n.text(AdministrationResources.id_label), valueBinder.bind("id", caseTypeId));

    new RefreshWhenShowing(this, this);
  }
Пример #4
0
  public APIRouter(
      @Uses Context context,
      @Structure Module module,
      @Service AuthenticationFilterService filterService,
      @Service AvailabilityService availabilityService)
      throws Exception {
    super(context);
    this.factory = module.objectBuilderFactory();
    this.filterService = filterService;

    Restlet cqr =
        factory.newObjectBuilder(CommandQueryRestlet.class).use(getContext()).newInstance();

    Filter availabilityFilter =
        factory
            .newObjectBuilder(AvailabilityFilter.class)
            .use(getContext(), cqr, availabilityService)
            .newInstance();
    Filter authenticationFilter =
        factory
            .newObjectBuilder(AuthenticationFilter.class)
            .use(getContext(), availabilityFilter, this.filterService)
            .newInstance();
    Filter noCacheFilter = new NoCacheFilter(context, authenticationFilter);
    Filter performanceLoggingFilter = new PerformanceLoggingFilter(context, noCacheFilter);

    attachDefault(new ExtensionMediaTypeFilter(getContext(), performanceLoggingFilter));

    // Events
    attach(
        "/events/domain",
        new ExtensionMediaTypeFilter(
            getContext(), createServerResourceFinder(DomainEventsServerResource.class)),
        Template.MODE_STARTS_WITH);
    attach(
        "/events/application",
        new ExtensionMediaTypeFilter(
            getContext(), createServerResourceFinder(ApplicationEventsServerResource.class)),
        Template.MODE_STARTS_WITH);

    // Admin resources
    Router adminRouter = new Router(getContext());
    adminRouter.attach("/entity", createServerResourceFinder(EntitiesResource.class));
    adminRouter.attach("/entity/{identity}", createServerResourceFinder(EntityResource.class));
    adminRouter.attach(
        "/query",
        new PerformanceLoggingFilter(context, createServerResourceFinder(SPARQLResource.class)),
        Template.MODE_STARTS_WITH);
    adminRouter.attach("/index", createServerResourceFinder(IndexResource.class));
    adminRouter.attach("/console", createServerResourceFinder(ConsoleServerResource.class));
    adminRouter.attach("/search", createServerResourceFinder(SolrSearchServerResource.class));
    adminRouter.attach("/log", LoggingServerResource.class);
    attach("/admin/tools", new ExtensionMediaTypeFilter(getContext(), adminRouter));

    {
      Directory dir = new Directory(getContext(), "clap://thread/static/admin/");
      dir.setIndexName("index.html");
      attach("/admin/", dir);
    }

    {
      Directory dir = new Directory(getContext(), "clap://thread/static/crystal/");
      dir.setIndexName("index.html");
      attach("/statistics/", dir);
    }

    // Version info
    Directory directory = new Directory(getContext(), "clap://thread/static/");
    directory.setListingAllowed(true);
    attach(
        "/static",
        factory
            .newObjectBuilder(AuthenticationFilter.class)
            .use(getContext(), directory, this.filterService)
            .newInstance());
  }