コード例 #1
0
 public XViewer() {
   doubleBuffering =
       IsisContext.getConfiguration().getBoolean(Properties.PROPERTY_BASE + "double-buffer", true);
   showExplorationMenuByDefault =
       IsisContext.getConfiguration()
           .getBoolean(Properties.PROPERTY_BASE + "exploration.show", true);
   overlayView = CLEAR_OVERLAY;
   redrawArea = new Bounds();
 }
コード例 #2
0
  public void init() {
    if (updateNotifier == null) {
      throw new NullPointerException("No update notifier set for " + this);
    }
    if (rootView == null) {
      throw new NullPointerException("No root view set for " + this);
    }

    insets = new Insets(0, 0, 0, 0);

    spy = new InteractionSpy(new SpyWindow());

    keyboardManager = new KeyboardManager(this);
    final InteractionHandler interactionHandler =
        new InteractionHandler(this, feedbackManager, keyboardManager, spy);
    renderingArea.addMouseMotionListener(interactionHandler);
    renderingArea.addMouseListener(interactionHandler);
    renderingArea.addKeyListener(interactionHandler);

    if (IsisContext.getConfiguration()
        .getBoolean(Properties.PROPERTY_BASE + "show-mouse-spy", false)) {
      spy.open();
    }

    setKeyboardFocus(rootView);

    APPLICATION_OPTIONS = new ApplicationOptions(listener);
  }
コード例 #3
0
 @Override
 public void saveOpenObjects() {
   final List<ObjectAdapter> objects = new ArrayList<ObjectAdapter>();
   for (final View view : rootView.getSubviews()) {
     final Content content = view.getContent();
     if (content instanceof ObjectContent) {
       objects.add(((ObjectContent) content).getAdapter());
     }
   }
   IsisContext.getUserProfileLoader().saveSession(objects);
 }
コード例 #4
0
  private View createFieldView(
      final View view,
      final Axes axes,
      final ObjectAdapter object,
      final int fieldNumber,
      final ObjectAssociation field) {
    if (field == null) {
      throw new NullPointerException();
    }

    if (field.isOneToOneAssociation()) {
      IsisContext.getPersistenceSession().resolveField(object, field);
    }

    final Content content1 = Toolkit.getContentFactory().createFieldContent(field, object);
    final View fieldView = subviewDesign.createView(content1, axes, fieldNumber);
    return fieldView;
  }
コード例 #5
0
  @Override
  public void build(final View view, final Axes axes) {
    Assert.assertEquals("ensure the view is the complete decorated view", view.getView(), view);

    final Content content = view.getContent();
    final ObjectAdapter object = ((ObjectContent) content).getObject();

    LOG.debug("build view " + view + " for " + object);

    final ObjectSpecification spec = object.getSpecification();
    final Filter<ObjectAssociation> filter =
        ObjectAssociationFilters.dynamicallyVisible(
            IsisContext.getAuthenticationSession(), object, where);
    final List<ObjectAssociation> flds = spec.getAssociations(filter);

    if (view.getSubviews().length == 0) {
      initialBuild(view, axes, object, flds);
    } else {
      updateBuild(view, axes, object, flds);
    }
  }
コード例 #6
0
  @Override
  public void process(final Request request) {
    final TableBlock tableBlock = (TableBlock) request.getBlockContent();
    final String id = request.getOptionalProperty(OBJECT);
    final String fieldName = request.getRequiredProperty(FIELD);
    final String linkView = request.getOptionalProperty(LINK_VIEW);
    String className = request.getOptionalProperty(CLASS);
    className = className == null ? "" : " class=\"" + className + "\"";
    RequestContext context = request.getContext();
    final ObjectAdapter object = context.getMappedObjectOrVariable(id, tableBlock.getElementName());
    final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
    if (field == null) {
      throw new ScimpiException(
          "No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
    }
    request.appendHtml("<td" + className + ">");
    if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
      final ObjectAdapter fieldReference = field.get(object);
      final String source =
          fieldReference == null ? "" : context.mapObject(fieldReference, Scope.REQUEST);
      final String name = request.getOptionalProperty(RESULT_NAME, fieldName);
      context.addVariable(name, Request.getEncoder().encoder(source), Scope.REQUEST);

      if (linkView != null) {
        final String linkId = context.mapObject(object, Scope.REQUEST);
        final String linkName = request.getOptionalProperty(LINK_NAME, RequestContext.RESULT);
        final String linkObject = request.getOptionalProperty(LINK_OBJECT, linkId);
        request.appendHtml(
            "<a href=\""
                + linkView
                + "?"
                + linkName
                + "="
                + linkObject
                + context.encodedInteractionParameters()
                + "\">");
      } else if (tableBlock.getlinkView() != null) {
        String linkObjectInVariable = tableBlock.getElementName();
        final String linkId = (String) context.getVariable(linkObjectInVariable);
        request.appendHtml(
            "<a href=\""
                + tableBlock.getlinkView()
                + "?"
                + tableBlock.getlinkName()
                + "="
                + linkId
                + context.encodedInteractionParameters()
                + "\">");
      }
      request.pushNewBuffer();
      request.processUtilCloseTag();
      final String buffer = request.popBuffer();
      if (buffer.trim().length() == 0) {
        request.appendAsHtmlEncoded(fieldReference == null ? "" : fieldReference.titleString());
      } else {
        request.appendHtml(buffer);
      }
      if (linkView != null) {
        request.appendHtml("</a>");
      }
    } else {
      request.skipUntilClose();
    }
    request.appendHtml("</td>");
  }
コード例 #7
0
 @Override
 protected int getPort() {
   return IsisContext.getConfiguration().getInteger(PORT, DEFAULT_PORT);
 }