Example #1
0
  public void insert(final CursorPosition cursorAt, final String characters) {
    Assert.assertNotNull(cursorAt);

    final BlockToLineMapping block = findBlockFor(cursorAt.getLine());

    Assert.assertNotNull("failed to get block for line " + cursorAt.getLine(), block);

    block.textBlock.insert(block.line, cursorAt.getCharacter(), characters);
  }
 @Programmatic
 @Override
 public <T> List<T> allMatches(final Class<T> type, final T pattern, long... range) {
   Assert.assertTrue(
       "pattern not compatible with type", type.isAssignableFrom(pattern.getClass()));
   return allMatches(new QueryFindByPattern<T>(type, pattern, range));
 }
Example #3
0
  @Override
  public void build(final View view, final Axes axes) {
    Assert.assertEquals(view.getView(), view);

    final ActionContent actionContent = ((ActionContent) view.getContent());
    if (view.getSubviews().length == 0) {
      initialBuild(view, actionContent);
    } else {
      updateBuild(view, actionContent);
    }
  }
  @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);
    }
  }
  private ObjectSpecification loadSpecificationForSubstitutedClass(final Class<?> type) {
    Assert.assertNotNull(type);
    final String typeName = type.getName();

    final SpecificationCacheDefault specificationCache = getCache();
    synchronized (specificationCache) {
      final ObjectSpecification spec = specificationCache.get(typeName);
      if (spec != null) {
        return spec;
      }
      final ObjectSpecification specification = createSpecification(type);
      if (specification == null) {
        throw new IsisException("Failed to create specification for class " + typeName);
      }

      // put into the cache prior to introspecting, to prevent
      // infinite loops
      specificationCache.cache(typeName, specification);

      introspectIfRequired(specification);

      return specification;
    }
  }
Example #6
0
 public ViewRequirement(final Content content, int status) {
   Assert.assertNotNull(content);
   this.content = content;
   this.status = status;
   status = CLOSED;
 }