Skip to content

Commit

Permalink
Enhancement to add new options of diagonals and antidiagonals #996 (#…
Browse files Browse the repository at this point in the history
…1224)

Added support for diagonal and antidiagonal lines in various formats including ROM, PDF, HTML, PPTX, DOCX, and ODP. Implemented diagonal border lines using PNG images and diagonal draw lines in ODP. Added color support for antidiagonal lines in PDF, PPTX, DOCX, and ODP. Fixed issues with cell background and diagonal lines appearing at the same time. Also added diagonal and antidiagonal lines in proprietary Actuate format (PPT). Note that XLS and ODT formats are currently unsupported.

* bgi image embedded - discussion #1175
* enhancement of background images with embedded images (discussion #1175)
* enhancement of background images with embedded images (discussion #1175)
* Comments added and test comments removed (#1175)
* Correction of comments and typo (#1175)
* Enhancement to add diagonal and antidiagonal to the BIRT border options (#996)
* Fix of built issue (#996)
* correction of the test class for the line count properties of diagonal and antidiagonal
* fix issues on report "ir_io_test.rptdesign" and added output comment of the test class
* changed complex validation report "ir_io_test.rptdesign" at the end to verify whether the simple standard reports are correct
* Fix issue of missing test reports and added dependencies on "ModelTest"-launch
* Resolve issue of engine test case if report not reachable
  • Loading branch information
speckyspooky committed Apr 11, 2023
1 parent 2c8d136 commit 9037f90
Show file tree
Hide file tree
Showing 79 changed files with 4,719 additions and 1,277 deletions.
Expand Up @@ -312,6 +312,8 @@ BordersPage.Tooltip.Left=Left Border
BordersPage.Tooltip.None=None
BordersPage.Tooltip.Right=Right Border
BordersPage.Tooltip.Top=Top Border
BordersPage.Tooltip.Diagonal=Diagonal
BordersPage.Tooltip.Antidiagonal=Antidiagonal
BordersPage.text.Preview=Preview:
BordersPage.Trans.SelectBorder=Select Border
BordersPage.Trans.UnSelectBorder=Unselect Border
Expand Down
Expand Up @@ -39,6 +39,15 @@ public static void refreshBorderData(int[] data, int style, int width, int color
* always lose; then compare the width, greater win; if width is equal, compare
* the style, less win; or keep the original. This is the part 1 of the
* algorithm.
*
* @param data border data array
* @param style border style of cell
* @param width border width of cell
* @param color border color of cell
* @param rowIndex row index cell
* @param colIndex column index of cell
* @param type 0, 1 type of bottom-, top-attribute from row or cell (0: row,
* 1: cell)
*/
public static void refreshBorderData(int[] data, int style, int width, int color, int rowIndex, int colIndex,
int type) {
Expand Down
Expand Up @@ -14,14 +14,17 @@

package org.eclipse.birt.report.designer.internal.ui.views.attributes.page;

import java.util.List;

import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.BorderColorDescriptorProvider;
import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.BorderStyleDescriptorProvider;
import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.BorderToggleDescriptorProvider;
import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.BorderWidthDescriptorProvider;
import org.eclipse.birt.report.designer.internal.ui.views.attributes.section.BorderSection;
import org.eclipse.birt.report.designer.nls.Messages;
import org.eclipse.birt.report.model.api.StyleHandle;
import org.eclipse.birt.report.model.api.CellHandle;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
import org.eclipse.birt.report.model.elements.interfaces.IStyleModel;
import org.eclipse.swt.widgets.Composite;

/**
Expand All @@ -41,7 +44,7 @@ public class BordersPage extends ResetAttributePage {
@Override
public void buildUI(Composite parent) {
super.buildUI(parent);
container.setLayout(WidgetUtil.createGridLayout(1, 15));
container.setLayout(org.eclipse.birt.report.designer.internal.ui.util.WidgetUtil.createGridLayout(1, 15));

// BorderStyleDescriptorProvider styleProvider = new
// BorderStyleDescriptorProvider( );
Expand Down Expand Up @@ -86,18 +89,25 @@ public void buildUI(Composite parent) {
// BorderDescriptorProvider[]{
// styleProvider, colorProvider, widthProvider
// };
//
providers = new BorderToggleDescriptorProvider[] {
new BorderToggleDescriptorProvider(StyleHandle.BORDER_TOP_STYLE_PROP),
new BorderToggleDescriptorProvider(StyleHandle.BORDER_BOTTOM_STYLE_PROP),
new BorderToggleDescriptorProvider(StyleHandle.BORDER_LEFT_STYLE_PROP),
new BorderToggleDescriptorProvider(StyleHandle.BORDER_RIGHT_STYLE_PROP) };
//
// TogglesSection borderSection = new TogglesSection( container,
// LABEL_BORDER );
// borderSection.setProviders( providers );
// borderSection.setGridPlaceholder( 4, true );
// addSection( PageSectionId.BORDERS_BORDER_STYLE, borderSection );

// diagonal and antidiagonal buttons only added on cell object (cell handle)
if (input != null && ((List<?>) input).size() >= 1 && ((List<?>) input).get(0) instanceof CellHandle) {
providers = new BorderToggleDescriptorProvider[] {
new BorderToggleDescriptorProvider(IStyleModel.BORDER_TOP_STYLE_PROP),
new BorderToggleDescriptorProvider(IStyleModel.BORDER_BOTTOM_STYLE_PROP),
new BorderToggleDescriptorProvider(IStyleModel.BORDER_LEFT_STYLE_PROP),
new BorderToggleDescriptorProvider(IStyleModel.BORDER_RIGHT_STYLE_PROP),
new BorderToggleDescriptorProvider(IStyleModel.BORDER_DIAGONAL_STYLE_PROP),
new BorderToggleDescriptorProvider(IStyleModel.BORDER_ANTIDIAGONAL_STYLE_PROP)
};

} else {
providers = new BorderToggleDescriptorProvider[] {
new BorderToggleDescriptorProvider(IStyleModel.BORDER_TOP_STYLE_PROP),
new BorderToggleDescriptorProvider(IStyleModel.BORDER_BOTTOM_STYLE_PROP),
new BorderToggleDescriptorProvider(IStyleModel.BORDER_LEFT_STYLE_PROP),
new BorderToggleDescriptorProvider(IStyleModel.BORDER_RIGHT_STYLE_PROP) };
}

borderSection = new BorderSection(LABEL_BORDER, container, true);
BorderStyleDescriptorProvider styleProvider = new BorderStyleDescriptorProvider();
Expand Down
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.elements.ReportDesignConstants;
import org.eclipse.birt.report.model.api.metadata.IChoiceSet;
import org.eclipse.birt.report.model.elements.interfaces.IStyleModel;

public class BorderColorDescriptorProvider extends BorderDescriptorProvider {

Expand All @@ -40,28 +41,42 @@ public String getDisplayName() {

@Override
public Object load() {
String value = getLocalStringValue(StyleHandle.BORDER_LEFT_COLOR_PROP);
String value = getLocalStringValue(IStyleModel.BORDER_LEFT_COLOR_PROP);
if (!"".equals(value)) //$NON-NLS-1$
{
this.indexText = value;
return value;
}

value = getLocalStringValue(StyleHandle.BORDER_RIGHT_COLOR_PROP);
value = getLocalStringValue(IStyleModel.BORDER_RIGHT_COLOR_PROP);
if (!"".equals(value)) //$NON-NLS-1$
{
this.indexText = value;
return value;
}

value = getLocalStringValue(StyleHandle.BORDER_TOP_COLOR_PROP);
value = getLocalStringValue(IStyleModel.BORDER_TOP_COLOR_PROP);
if (!"".equals(value)) //$NON-NLS-1$
{
this.indexText = value;
return value;
}

value = getLocalStringValue(StyleHandle.BORDER_BOTTOM_COLOR_PROP);
value = getLocalStringValue(IStyleModel.BORDER_BOTTOM_COLOR_PROP);
if (!"".equals(value)) //$NON-NLS-1$
{
this.indexText = value;
return value;
}

value = getLocalStringValue(IStyleModel.BORDER_DIAGONAL_COLOR_PROP);
if (!"".equals(value)) //$NON-NLS-1$
{
this.indexText = value;
return value;
}

value = getLocalStringValue(IStyleModel.BORDER_ANTIDIAGONAL_COLOR_PROP);
if (!"".equals(value)) //$NON-NLS-1$
{
this.indexText = value;
Expand All @@ -79,28 +94,40 @@ public void setIndex(Object index) {
@Override
public void save(Object value) throws SemanticException {
this.indexText = value == null ? "" : value; //$NON-NLS-1$
if (((Boolean) styleMap.get(StyleHandle.BORDER_TOP_STYLE_PROP)).booleanValue()) {
save(StyleHandle.BORDER_TOP_COLOR_PROP, value);
if ((styleMap.get(IStyleModel.BORDER_TOP_STYLE_PROP)).booleanValue()) {
save(IStyleModel.BORDER_TOP_COLOR_PROP, value);
} else {
save(IStyleModel.BORDER_TOP_COLOR_PROP, null);
}

if ((styleMap.get(IStyleModel.BORDER_BOTTOM_STYLE_PROP)).booleanValue()) {
save(IStyleModel.BORDER_BOTTOM_COLOR_PROP, value);
} else {
save(IStyleModel.BORDER_BOTTOM_COLOR_PROP, null);
}

if ((styleMap.get(IStyleModel.BORDER_LEFT_STYLE_PROP)).booleanValue()) {
save(IStyleModel.BORDER_LEFT_COLOR_PROP, value);
} else {
save(StyleHandle.BORDER_TOP_COLOR_PROP, null);
save(IStyleModel.BORDER_LEFT_COLOR_PROP, null);
}

if (((Boolean) styleMap.get(StyleHandle.BORDER_BOTTOM_STYLE_PROP)).booleanValue()) {
save(StyleHandle.BORDER_BOTTOM_COLOR_PROP, value);
if ((styleMap.get(IStyleModel.BORDER_RIGHT_STYLE_PROP)).booleanValue()) {
save(IStyleModel.BORDER_RIGHT_COLOR_PROP, value);
} else {
save(StyleHandle.BORDER_BOTTOM_COLOR_PROP, null);
save(IStyleModel.BORDER_RIGHT_COLOR_PROP, null);
}

if (((Boolean) styleMap.get(StyleHandle.BORDER_LEFT_STYLE_PROP)).booleanValue()) {
save(StyleHandle.BORDER_LEFT_COLOR_PROP, value);
if ((styleMap.get(IStyleModel.BORDER_DIAGONAL_STYLE_PROP)).booleanValue()) {
save(IStyleModel.BORDER_DIAGONAL_COLOR_PROP, value);
} else {
save(StyleHandle.BORDER_LEFT_COLOR_PROP, null);
save(IStyleModel.BORDER_DIAGONAL_COLOR_PROP, null);
}

if (((Boolean) styleMap.get(StyleHandle.BORDER_RIGHT_STYLE_PROP)).booleanValue()) {
save(StyleHandle.BORDER_RIGHT_COLOR_PROP, value);
if (styleMap.get(IStyleModel.BORDER_ANTIDIAGONAL_STYLE_PROP).booleanValue()) {
save(IStyleModel.BORDER_ANTIDIAGONAL_COLOR_PROP, value);
} else {
save(StyleHandle.BORDER_RIGHT_COLOR_PROP, null);
save(IStyleModel.BORDER_ANTIDIAGONAL_COLOR_PROP, null);
}
}

Expand Down
Expand Up @@ -19,20 +19,22 @@
import org.eclipse.birt.report.designer.util.DEUtil;
import org.eclipse.birt.report.model.api.GroupElementHandle;
import org.eclipse.birt.report.model.api.GroupPropertyHandle;
import org.eclipse.birt.report.model.api.StyleHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.elements.interfaces.IStyleModel;

public abstract class BorderDescriptorProvider extends AbstractDescriptorProvider {

protected Object input;

protected HashMap styleMap = new HashMap();
protected HashMap<String, Boolean> styleMap = new HashMap();

public BorderDescriptorProvider() {
styleMap.put(StyleHandle.BORDER_LEFT_STYLE_PROP, Boolean.FALSE);
styleMap.put(StyleHandle.BORDER_RIGHT_STYLE_PROP, Boolean.FALSE);
styleMap.put(StyleHandle.BORDER_TOP_STYLE_PROP, Boolean.FALSE);
styleMap.put(StyleHandle.BORDER_BOTTOM_STYLE_PROP, Boolean.FALSE);
styleMap.put(IStyleModel.BORDER_LEFT_STYLE_PROP, Boolean.FALSE);
styleMap.put(IStyleModel.BORDER_RIGHT_STYLE_PROP, Boolean.FALSE);
styleMap.put(IStyleModel.BORDER_TOP_STYLE_PROP, Boolean.FALSE);
styleMap.put(IStyleModel.BORDER_BOTTOM_STYLE_PROP, Boolean.FALSE);
styleMap.put(IStyleModel.BORDER_DIAGONAL_STYLE_PROP, Boolean.FALSE);
styleMap.put(IStyleModel.BORDER_ANTIDIAGONAL_STYLE_PROP, Boolean.FALSE);
}

public void setStyleProperty(String style, Boolean value) {
Expand All @@ -47,7 +49,7 @@ public void setInput(Object input) {
protected String getLocalStringValue(String property) {
GroupElementHandle handle = null;
if (input instanceof List) {
handle = DEUtil.getGroupElementHandle((List) input);
handle = DEUtil.getGroupElementHandle((List<?>) input);
}
if (handle == null) {
return ""; //$NON-NLS-1$
Expand All @@ -64,7 +66,7 @@ protected String getLocalStringValue(String property) {
protected String getStringValue(String property) {
GroupElementHandle handle = null;
if (input instanceof List) {
handle = DEUtil.getGroupElementHandle((List) input);
handle = DEUtil.getGroupElementHandle((List<?>) input);
}
if (handle == null) {
return ""; //$NON-NLS-1$
Expand All @@ -81,26 +83,28 @@ protected String getStringValue(String property) {
protected String getDisplayValue(String property) {
GroupElementHandle handle = null;
if (input instanceof List) {
handle = DEUtil.getGroupElementHandle((List) input);
handle = DEUtil.getGroupElementHandle((List<?>) input);
}
if (handle == null) {
return ""; //$NON-NLS-1$
}
if (getLocalStringValue(property).equals("")) {
String value = handle.getPropertyHandle(property).getStringValue();
if (value == null) {
value = ""; //$NON-NLS-1$
String value = "";
if (handle.getPropertyHandle(property) != null) {
value = handle.getPropertyHandle(property).getStringValue();
if (value == null) {
value = ""; //$NON-NLS-1$
}
}
return value;
} else {
return ""; //$NON-NLS-1$
}
return ""; //$NON-NLS-1$
}

protected String getDefaultStringValue(String property) {
GroupElementHandle handle = null;
if (input instanceof List) {
handle = DEUtil.getGroupElementHandle((List) input);
handle = DEUtil.getGroupElementHandle((List<?>) input);
}
if (handle == null) {
return ""; //$NON-NLS-1$
Expand All @@ -113,9 +117,8 @@ protected String getDefaultStringValue(String property) {
value = ""; //$NON-NLS-1$
}
return value;
} else {
return ""; //$NON-NLS-1$
}
return ""; //$NON-NLS-1$
}

protected void save(String property, Object value) throws SemanticException {
Expand All @@ -124,7 +127,7 @@ protected void save(String property, Object value) throws SemanticException {
if (input instanceof GroupElementHandle) {
groupElementHandle = (GroupElementHandle) input;
} else if (input instanceof List) {
groupElementHandle = DEUtil.getGroupElementHandle((List) input);
groupElementHandle = DEUtil.getGroupElementHandle((List<?>) input);
}

if (groupElementHandle != null) {
Expand Down

0 comments on commit 9037f90

Please sign in to comment.