1. Stephen McKamey
  2. duel

Issues

Issue #1 new

Transitive view parts aren't propagated to child views

Stephen McKamey
repo owner created an issue

This doesn't appear to work on the server-side:

{{{

!duel

<view name="A"> <call view="B"> <part name="header">HEADER</part> <part>CONTENT</part> <part name="footer">FOOTER</part> </call>

<view name="B"> <call view="C"> <part name="header"><part name="header" /></part> <part><part /></part> <part name="footer"><part name="footer" /></part> </call>

<view name="C"> <h1><part name="header" /></h1> <p><part /></p> <h4><part name="footer" /></h4>

}}}

The calling A's parts aren't passed all the way down into C. B consumes them and passes its own placeholder parts down into C.

The root of the problem seems to be in B's generated init() method and the nested part classes:

{{{

!java

public B(DuelPart... parts) {
    super(parts);
}

// ...

@Override
protected void init() {
    this.addPart(new part_2());
    this.view_3 = new C(new part_4(), new part_5(), new part_6());
}

private DuelView view_3;

private class part_4 extends DuelPart {

    @Override
    public String getPartName() {
        return "header";
    }

    @Override
    protected void render(DuelContext context, Object data, int index, int count, String key) throws IOException {
        this.renderPart(context, "header", data, index, count, key);
    }

    private class part_2 extends DuelPart {

        @Override
        public String getPartName() {
            return "header";
        }

        @Override
        protected void render(DuelContext context, Object data, int index, int count, String key) throws IOException {
        }
    }

    @Override
    protected void init() {
        this.addPart(new part_2());
    }
}

}}}

C is only ever shown the placeholder parts from B, and B's placeholder parts have no link to A's parts which were passed into B's constructor.

Comments (1)

  1. Log in to comment