Пример #1
0
 public static void refreshSitesList() {
   JahiaContentManagementService.App.getInstance()
       .getRoot(
           Arrays.asList(sitesLocation),
           Arrays.asList("jnt:virtualsite"),
           null,
           null,
           GWTJahiaNode.DEFAULT_SITE_FIELDS,
           null,
           null,
           false,
           false,
           null,
           null,
           new BaseAsyncCallback<List<GWTJahiaNode>>() {
             public void onSuccess(List<GWTJahiaNode> sites) {
               sitesMap.clear();
               for (GWTJahiaNode site : sites) {
                 sitesMap.put(site.getUUID(), site);
               }
             }
           });
 }
Пример #2
0
  @Override
  protected void onTriggerClick(ComponentEvent ce) {
    super.onTriggerClick(ce);
    if (disabled || isReadOnly()) {
      return;
    }
    JahiaContentManagementService.App.getInstance()
        .getManagerConfiguration(
            configuration,
            new BaseAsyncCallback<GWTManagerConfiguration>() {
              public void onSuccess(GWTManagerConfiguration config) {
                PermissionsUtils.loadPermissions(config.getPermissions());
                final Window w = new Window();
                w.setLayout(new FitLayout());
                w.setId("JahiaGxtContentPickerWindow");
                final ContentPicker contentPicker =
                    new ContentPicker(
                        selectorOptions, getValue(), types, filters, mimeTypes, config, multiple);

                w.setHeading(Messages.get("label." + config.getName(), config.getName()));
                int windowHeight = com.google.gwt.user.client.Window.getClientHeight() - 10;

                w.setModal(true);
                w.setSize(900, windowHeight);
                w.setResizable(true);
                w.setMaximizable(true);
                w.setBodyBorder(false);

                final ButtonBar bar = new ButtonBar();
                bar.setAlignment(Style.HorizontalAlignment.CENTER);

                final Button ok =
                    new Button(
                        Messages.get("label.save"),
                        new SelectionListener<ButtonEvent>() {
                          public void componentSelected(ButtonEvent event) {
                            List<GWTJahiaNode> selection = contentPicker.getSelectedNodes();
                            setValue(selection);
                            w.hide();
                          }
                        });
                ok.setIcon(StandardIconsProvider.STANDARD_ICONS.engineButtonOK());
                bar.add(ok);

                contentPicker.setSaveButton(ok);
                if (getValue() == null || getValue().size() == 0) {
                  ok.setEnabled(false);
                }

                final Button cancel =
                    new Button(
                        Messages.get("label.cancel"),
                        new SelectionListener<ButtonEvent>() {
                          public void componentSelected(ButtonEvent event) {
                            w.hide();
                          }
                        });
                cancel.setIcon(StandardIconsProvider.STANDARD_ICONS.engineButtonCancel());

                bar.add(cancel);
                w.add(contentPicker);
                w.setBottomComponent(bar);
                w.show();
              }

              public void onApplicationFailure(Throwable throwable) {
                Log.error("Error while loading user permission", throwable);
              }
            });
  }