@Override
  public void display(
      Panel mainContainer,
      Panel facetContent,
      Panel headerPanel,
      Panel logoutPanel,
      Panel notificationPanel) {

    mainContainer.clear();
    facetContent.clear();
    bind();

    mainContainer.addStyleName("Border");
    mainContainer.add(this.display.getPublishContainer());
  }
 protected final void refreshInnerWidgetList(List data) {
   panel.clear();
   items.clear();
   view = newMasterView();
   view.setItems(data != null ? data : new ArrayList());
   panel.add(view);
 }
 @Override
 public void showError(String message, String cause) {
   currentDisplayer = null;
   displayerPanel.clear();
   displayerPanel.add(errorWidget);
   errorWidget.show(message, cause);
 }
 @Override
 public void displayErrors(List<String> messages) {
   errorPanel.clear();
   for (String message : messages) {
     addMessage(createLabel(message, "error"));
   }
 }
 @Override
 public void showDisplayer(Displayer displayer) {
   if (displayer != currentDisplayer) {
     displayerPanel.clear();
     displayerPanel.add(displayer);
     currentDisplayer = displayer;
   }
 }
  /** This is called in the unhappy event of there being errors. */
  public static void showBuilderErrors(
      BuilderResult results, Panel buildResults, ClientFactory clientFactory) {
    buildResults.clear();

    BuildPackageErrorsSimpleTable errorsTable = new BuildPackageErrorsSimpleTable(clientFactory);
    errorsTable.setRowData(results.getLines());
    errorsTable.setRowCount(results.getLines().size());
    buildResults.add(errorsTable);
  }
Exemple #7
0
  private void setupLoop() {
    // setup modules
    try {
      graphics = new GwtGraphics(root, config);
    } catch (Throwable e) {
      root.clear();
      root.add(new Label("Sorry, your browser doesn't seem to support WebGL"));
      return;
    }
    lastWidth = graphics.getWidth();
    lastHeight = graphics.getHeight();
    Gdx.app = this;
    Gdx.audio = new GwtAudio();
    Gdx.graphics = graphics;
    Gdx.gl20 = graphics.getGL20();
    Gdx.gl = graphics.getGLCommon();
    Gdx.files = new GwtFiles(preloader);
    this.input = new GwtInput(graphics.canvas);
    Gdx.input = this.input;
    this.net = new GwtNet();
    Gdx.net = this.net;

    // tell listener about app creation
    try {
      listener.create();
      listener.resize(graphics.getWidth(), graphics.getHeight());
    } catch (Throwable t) {
      error("GwtApplication", "exception: " + t.getMessage(), t);
      t.printStackTrace();
      throw new RuntimeException(t);
    }

    // setup rendering timer
    new Timer() {
      @Override
      public void run() {
        try {
          graphics.update();
          if (Gdx.graphics.getWidth() != lastWidth || Gdx.graphics.getHeight() != lastHeight) {
            GwtApplication.this.listener.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
            lastWidth = graphics.getWidth();
            lastHeight = graphics.getHeight();
            Gdx.gl.glViewport(0, 0, lastWidth, lastHeight);
          }
          for (int i = 0; i < runnables.size; i++) {
            runnables.get(i).run();
          }
          runnables.clear();
          listener.render();
          input.justTouched = false;
        } catch (Throwable t) {
          error("GwtApplication", "exception: " + t.getMessage(), t);
          throw new RuntimeException(t);
        }
      }
    }.scheduleRepeating((int) ((1f / config.fps) * 1000));
  }
  public void init(DataSetMetadata metadata, DataSetFilter filter, Listener listener) {
    this.metadata = metadata;
    this.filter = filter;
    this.listener = listener;

    addFilterButton.setVisible(true);
    addFilterPanel.setVisible(false);
    initNewFilterListBox();
    filterListPanel.clear();
  }
  private void doBuild(
      final Panel buildResults,
      final String statusOperator,
      final String statusValue,
      final boolean enableStatusSelector,
      final String categoryOperator,
      final String category,
      final boolean enableCategorySelector,
      final String customSelector) {
    buildResults.clear();

    final HorizontalPanel busy = new HorizontalPanel();
    busy.add(new Label(constants.ValidatingAndBuildingPackagePleaseWait()));
    busy.add(new Image(images.redAnime()));

    buildResults.add(busy);

    Scheduler scheduler = Scheduler.get();
    scheduler.scheduleDeferred(
        new Command() {
          public void execute() {
            RepositoryServiceFactory.getPackageService()
                .buildPackage(
                    conf.getUuid(),
                    true,
                    buildMode,
                    statusOperator,
                    statusValue,
                    enableStatusSelector,
                    categoryOperator,
                    category,
                    enableCategorySelector,
                    customSelector,
                    new GenericCallback<BuilderResult>() {
                      public void onSuccess(BuilderResult result) {
                        LoadingPopup.close();
                        if (result == null || !result.hasLines()) {
                          showSuccessfulBuild(buildResults);
                        } else {
                          showBuilderErrors(result, buildResults, clientFactory);
                        }
                      }

                      public void onFailure(Throwable t) {
                        buildResults.clear();
                        super.onFailure(t);
                      }
                    });
          }
        });
  }
Exemple #10
0
  void setupLoop() {
    // setup modules
    try {
      graphics = new GwtGraphics(root, config);
    } catch (Throwable e) {
      root.clear();
      root.add(getNoWebGLSupportWidget());
      return;
    }
    lastWidth = graphics.getWidth();
    lastHeight = graphics.getHeight();
    Gdx.app = this;
    Gdx.audio = new GwtAudio();
    Gdx.graphics = graphics;
    Gdx.gl20 = graphics.getGL20();
    Gdx.gl = Gdx.gl20;
    Gdx.files = new GwtFiles(preloader);
    this.input = new GwtInput(graphics.canvas);
    Gdx.input = this.input;
    this.net = new GwtNet();
    Gdx.net = this.net;
    this.clipboard = new GwtClipboard();
    updateLogLabelSize();

    // tell listener about app creation
    try {
      listener.create();
      listener.resize(graphics.getWidth(), graphics.getHeight());
    } catch (Throwable t) {
      error("GwtApplication", "exception: " + t.getMessage(), t);
      t.printStackTrace();
      throw new RuntimeException(t);
    }

    AnimationScheduler.get()
        .requestAnimationFrame(
            new AnimationCallback() {
              @Override
              public void execute(double timestamp) {
                try {
                  mainLoop();
                } catch (Throwable t) {
                  error("GwtApplication", "exception: " + t.getMessage(), t);
                  throw new RuntimeException(t);
                }
                AnimationScheduler.get().requestAnimationFrame(this, graphics.canvas);
              }
            },
            graphics.canvas);
  }
  @Override
  public void showEmpty(Displayer displayer) {
    currentDisplayer = null;
    VerticalPanel centeredPanel = new VerticalPanel();
    centeredPanel.setWidth("100%");
    centeredPanel.setHeight("100%");
    centeredPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    centeredPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    Label noDataLabel = new Label(DashboardConstants.INSTANCE.noData());
    centeredPanel.add(noDataLabel);

    displayerPanel.clear();
    displayerPanel.add(centeredPanel);
  }
  @Override
  public void showLoading(Displayer displayer) {
    currentDisplayer = null;
    VerticalPanel centeredPanel = new VerticalPanel();
    centeredPanel.setWidth("100%");
    centeredPanel.setHeight("100%");
    centeredPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    centeredPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    Image loadingIcon =
        new Image(DataSetClientResources.INSTANCE.images().loadingIcon().getSafeUri());
    loadingIcon.setTitle(DashboardConstants.INSTANCE.loading());
    loadingIcon.setAltText(DashboardConstants.INSTANCE.loading());
    centeredPanel.add(loadingIcon);

    displayerPanel.clear();
    displayerPanel.add(centeredPanel);
  }
  public GwtRenderingContext(Panel root, GwtAppConfiguration config)
      throws ParallaxRuntimeException {
    this.root = root;
    root.clear();

    Canvas canvasWidget = Canvas.createIfSupported();
    if (canvasWidget == null) throw new ParallaxRuntimeException("Canvas not supported");

    int width = root.getOffsetWidth();
    int height = root.getOffsetHeight();

    if (width == 0 || height == 0)
      new ParallaxRuntimeException("Width or Height of the Panel is 0");

    lastWidth = width;
    lastHeight = height;

    canvas = canvasWidget.getCanvasElement();
    root.add(canvasWidget);
    canvas.setWidth(width);
    canvas.setHeight(height);
    this.config = config;

    WebGLContextAttributes attributes = WebGLContextAttributes.create();
    attributes.setAntialias(config.antialiasing);
    attributes.setStencil(config.stencil);
    attributes.setAlpha(config.alpha);
    attributes.setPremultipliedAlpha(config.premultipliedAlpha);
    attributes.setPreserveDrawingBuffer(config.preserveDrawingBuffer);

    context = WebGLRenderingContext.getContext(canvas, attributes);
    context.viewport(0, 0, width, height);

    gl = new GwtGL20(context);

    renderer = new GLRenderer(gl, width, height);

    input = new GwtInput(canvas);

    addEventListeners();

    Window.addResizeHandler(this);
  }
  /**
   * This is called to display the success (and a download option).
   *
   * @param buildResults
   */
  private void showSuccessfulBuild(Panel buildResults) {
    buildResults.clear();
    VerticalPanel vert = new VerticalPanel();

    vert.add(
        new HTML(
            AbstractImagePrototype.create(images.greenTick()).getHTML()
                + "<i>"
                + constants.PackageBuiltSuccessfully()
                + " "
                + conf.getLastModified()
                + "</i>"));

    final String hyp = getDownloadLink(this.conf);

    HTML html =
        new HTML(
            "<a href='" + hyp + "' target='_blank'>" + constants.DownloadBinaryPackage() + "</a>");

    vert.add(html);

    buildResults.add(vert);
  }
 public void updateUi() {
   attachmentsPanel.clear();
   if (attachments.size() > 0) {
     for (int i = 0; i < attachments.size(); i++) {
       Attachment attachment = attachments.get(i);
       Panel attachmentPanel = new FlowPanel();
       attachmentPanel.setStyleName("file-uploaded");
       attachmentPanel.add(new HTML("<span class=\"file-icon\"/>"));
       attachmentPanel.add(new Anchor(attachment.getFilename(), attachment.getUrl()));
       // table.setHTML(i, 1, attachment.getDescription());
       attachmentPanel.add(
           new Label(
               "   ("
                   + String.valueOf(Math.round(Float.valueOf(attachment.getByteSize()) / 1024))
                   + " KB)"));
       // PersonLabel personLabel = new PersonLabel();
       // personLabel.setPerson(toPerson(attachment.getSubmitter()));
       // personLabel.setAsSelf(toPerson(attachment.getSubmitter()).equals(currenUser));
       // table.setWidget(i, 2, personLabel);
       // table.setHTML(i, 3, stringValueDateTime(attachment.getCreationDate()));
       attachmentsPanel.add(attachmentPanel);
     }
   }
 }
 @Override
 public void clearFilterStatus() {
   if (filterPanel != null) {
     filterPanel.clear();
   }
 }
Exemple #17
0
  /**
   * Re-renders the given entity.
   *
   * <p>
   *
   * @param entity the entity
   * @param context the context DOM element
   */
  protected void rerenderForm(final I_Entity entity, final Panel context) {

    context.clear();
    renderForm(entity, context);
  }
 public void showDisplayer(Widget w) {
   displayerPanel.clear();
   displayerPanel.add(w);
 }
  private void refreshEditor() {
    String key = factType + "." + field.getFieldName();
    String flType = sce.getFieldType(key);
    panel.clear();
    if (flType != null && flType.equals(SuggestionCompletionEngine.TYPE_NUMERIC)) {
      final TextBox box = editableTextBox(callback, field.getFieldName(), field.getExpected());
      box.addKeyPressHandler(new NumbericFilterKeyPressHandler(box));
      panel.add(box);
    } else if (flType != null && flType.equals(SuggestionCompletionEngine.TYPE_BOOLEAN)) {
      String[] c = new String[] {"true", "false"};
      panel.add(
          new EnumDropDown(
              field.getExpected(),
              new DropDownValueChanged() {
                public void valueChanged(String newText, String newValue) {
                  callback.valueChanged(newValue);
                }
              },
              DropDownData.create(c)));
    } else if (flType != null && flType.equals(SuggestionCompletionEngine.TYPE_DATE)) {
      final DatePickerTextBox datePicker = new DatePickerTextBox(field.getExpected());
      String m = ((Constants) GWT.create(Constants.class)).ValueFor0(field.getFieldName());
      datePicker.setTitle(m);
      datePicker.addValueChanged(
          new ValueChanged() {
            public void valueChanged(String newValue) {
              field.setExpected(newValue);
            }
          });

      panel.add(datePicker);
    } else {
      String[] enums = sce.getDataEnumList(key);
      if (enums != null) {
        // GUVNOR-1324: Java enums are of type TYPE_COMPARABLE whereas Guvnor enums are not.
        // The distinction here controls whether the EXPECTED value is handled as a true
        // Java enum or a literal with a selection list (i.e. Guvnor enum)
        String dataType = sce.getFieldType(key);
        if (dataType.equals(SuggestionCompletionEngine.TYPE_COMPARABLE)) {
          field.setNature(FieldData.TYPE_ENUM);
        } else {
          field.setNature(FieldData.TYPE_LITERAL);
        }

        panel.add(
            new EnumDropDown(
                field.getExpected(),
                new DropDownValueChanged() {
                  public void valueChanged(String newText, String newValue) {
                    callback.valueChanged(newValue);
                  }
                },
                DropDownData.create(enums)));

      } else {
        if (field.getExpected() != null
            && field.getExpected().length() > 0
            && field.getNature() == FieldData.TYPE_UNDEFINED) {
          if (field.getExpected().charAt(0) == '=') {
            field.setNature(FieldData.TYPE_VARIABLE);
          } else {
            field.setNature(FieldData.TYPE_LITERAL);
          }
        }
        if (field.getNature() == FieldData.TYPE_UNDEFINED && isThereABoundVariableToSet() == true) {
          Image clickme = new Image(images.edit());
          clickme.addClickHandler(
              new ClickHandler() {

                public void onClick(ClickEvent event) {
                  showTypeChoice((Widget) event.getSource(), field);
                }
              });
          panel.add(clickme);
        } else if (field.getNature() == FieldData.TYPE_VARIABLE) {
          panel.add(variableEditor());
        } else {
          panel.add(editableTextBox(callback, field.getFieldName(), field.getExpected()));
        }
      }
    }
  }
 @Override
 public void clearErrors() {
   errorPanel.clear();
   errorPanel.setVisible(false);
 }
  /** The permissions panel. */
  private Widget doPermsPanel(final Map<String, List<String>> perms, final Panel vp) {
    vp.clear();

    for (Map.Entry<String, List<String>> perm : perms.entrySet()) {
      if (perm.getKey().equals("admin")) { // NON-NLS
        HorizontalPanel h = new HorizontalPanel();
        h.add(new HTML("<b>" + constants.ThisUserIsAnAdministrator() + "</b>")); // NON-NLS
        Button del = new Button(constants.RemoveAdminRights());

        del.addClickHandler(
            new ClickHandler() {
              public void onClick(ClickEvent w) {
                if (Window.confirm(constants.AreYouSureYouWantToRemoveAdministratorPermissions())) {
                  perms.remove("admin"); // NON-NLS
                  doPermsPanel(perms, vp);
                }
              }
            });
        h.add(del);
        vp.add(h);
      } else {
        final String permType = perm.getKey();
        final List<String> permList = perm.getValue();

        Grid g = new Grid(permList.size() + 1, 3);
        g.setWidget(0, 0, new HTML("<b>[" + permType + "] for:</b>")); // NON-NLS

        for (int i = 0; i < permList.size(); i++) {
          final String p = permList.get(i);
          ImageButton del =
              new ImageButton(
                  images.deleteItemSmall(),
                  constants.RemovePermission(),
                  new ClickHandler() {
                    public void onClick(ClickEvent w) {
                      if (Window.confirm(constants.AreYouSureYouWantToRemovePermission0(p))) {
                        permList.remove(p);
                        if (permList.size() == 0) {
                          perms.remove(permType);
                        }
                        doPermsPanel(perms, vp);
                      }
                    }
                  });

          g.setWidget(i + 1, 1, new SmallLabel(p));
          g.setWidget(i + 1, 2, del);
        }

        vp.add(g);
      }
    }

    // now to be able to add...
    ImageButton newPermission =
        new ImageButton(
            images.newItem(),
            constants.AddANewPermission(),
            createClickHandlerForNewPersmissionImageButton(perms, vp));
    vp.add(newPermission);
    return vp;
  }
 private void setWidgetAsExample(Widget widget) {
   exampleArea.clear();
   exampleArea.add(widget);
 }