Search in sources :

Example 1 with GuidedDecisionTableRenderer

use of org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableRenderer in project drools-wb by kiegroup.

the class GuidedDecisionTableViewImpl method makeHeaderCaption.

private Group makeHeaderCaption() {
    final Group g = GWT.create(Group.class);
    final double captionWidth = ((GuidedDecisionTableRenderer) renderer).getHeaderCaptionWidth();
    final GuidedDecisionTableTheme theme = (GuidedDecisionTableTheme) renderer.getTheme();
    final Rectangle r = theme.getBaseRectangle(GuidedDecisionTableTheme.ModelColumnType.CAPTION);
    r.setWidth(captionWidth);
    r.setHeight(HEADER_CAPTION_HEIGHT);
    final MultiPath border = theme.getBodyGridLine();
    border.M(0.5, HEADER_CAPTION_HEIGHT + 0.5);
    border.L(0.5, 0.5);
    border.L(captionWidth + 0.5, 0.5);
    border.L(captionWidth + 0.5, HEADER_CAPTION_HEIGHT + 0.5);
    border.L(0.5, HEADER_CAPTION_HEIGHT + 0.5);
    final Text caption = theme.getHeaderText();
    caption.setText(model.getTableName());
    caption.setX(captionWidth / 2);
    caption.setY(HEADER_CAPTION_HEIGHT / 2);
    // Clip Caption Group
    final BoundingBox bb = new BoundingBox(0, 0, captionWidth + border.getStrokeWidth(), HEADER_CAPTION_HEIGHT + 0.5);
    final IPathClipper clipper = getPathClipper(bb);
    g.setPathClipper(clipper);
    clipper.setActive(true);
    g.add(r);
    g.add(caption);
    g.add(border);
    return g;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) MultiPath(com.ait.lienzo.client.core.shape.MultiPath) IPathClipper(com.ait.lienzo.client.core.shape.IPathClipper) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) GuidedDecisionTableTheme(org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableTheme) Text(com.ait.lienzo.client.core.shape.Text) GuidedDecisionTableRenderer(org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableRenderer)

Example 2 with GuidedDecisionTableRenderer

use of org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableRenderer in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerPresenterTest method makeDecisionTable.

private GuidedDecisionTableView.Presenter makeDecisionTable() {
    final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
    final GuidedDecisionTableView dtView = mock(GuidedDecisionTableView.class);
    final GuidedDecisionTableRenderer renderer = mock(GuidedDecisionTableRenderer.class);
    final GridData dtData = new BaseGridData();
    when(dtPresenter.getView()).thenReturn(dtView);
    when(dtPresenter.getAccess()).thenReturn(mock(GuidedDecisionTablePresenter.Access.class));
    when(dtPresenter.getModel()).thenReturn(mock(GuidedDecisionTable52.class));
    when(dtView.getModel()).thenReturn(dtData);
    when(dtView.getRenderer()).thenReturn(renderer);
    when(renderer.getHeaderCaptionWidth()).thenReturn(200.0);
    return dtPresenter;
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) GuidedDecisionTableRenderer(org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableRenderer)

Aggregations

GuidedDecisionTableRenderer (org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableRenderer)2 Group (com.ait.lienzo.client.core.shape.Group)1 IPathClipper (com.ait.lienzo.client.core.shape.IPathClipper)1 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 Rectangle (com.ait.lienzo.client.core.shape.Rectangle)1 Text (com.ait.lienzo.client.core.shape.Text)1 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1 GuidedDecisionTableTheme (org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableTheme)1 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)1 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)1