Skip to content

Commit

Permalink
When you drop a measure the expression should have data indicator.
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Thronson <cthronson@actuate.com>
  • Loading branch information
Carl Thronson committed Nov 19, 2015
1 parent 16cc903 commit 37aee86
Showing 1 changed file with 37 additions and 1 deletion.
Expand Up @@ -12,6 +12,7 @@
package org.eclipse.birt.chart.reportitem.ui;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
Expand All @@ -31,8 +32,10 @@
import org.eclipse.birt.report.designer.internal.ui.dialogs.expression.ExpressionButton;
import org.eclipse.birt.report.designer.internal.ui.util.ExpressionButtonUtil;
import org.eclipse.birt.report.designer.ui.dialogs.IExpressionProvider;
import org.eclipse.birt.report.model.api.ComputedColumnHandle;
import org.eclipse.birt.report.model.api.Expression;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.elements.structures.ComputedColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
Expand Down Expand Up @@ -229,7 +232,7 @@ public void setBindingName( String bindingName, boolean bNotifyEvents )
if ( bindingName != null && bindingName.length( ) > 0 )
{
exprCodec.setBindingName( bindingName,
isCube( ),
isCube( bindingName ),
eHelper.getExpressionType( ) );
eHelper.setExpression( exprCodec.getExpression( ) );
}
Expand All @@ -249,6 +252,39 @@ public void setBindingName( String bindingName, boolean bNotifyEvents )
lastExpr.setType( eHelper.getExpressionType( ) );
}

private boolean isCube( String bindingName )
{
Object context = this.eHelper.getContextObject( );
if ( context instanceof ExtendedItemHandle )
{
ExtendedItemHandle eih = (ExtendedItemHandle)context;
Iterator bindings = eih.getAvailableBindings( );
while ( bindings.hasNext( ) )
{
Object binding = bindings.next( );
if ( binding instanceof ComputedColumnHandle )
{
ComputedColumnHandle cch = (ComputedColumnHandle)binding;
if ( cch.getName( ).equals( bindingName )
&& cch.getExpressionProperty(
ComputedColumn.EXPRESSION_MEMBER ) != null
&& cch.getExpressionProperty(
ComputedColumn.EXPRESSION_MEMBER )
.getStringValue( ) != null
&& cch.getExpressionProperty(
ComputedColumn.EXPRESSION_MEMBER )
.getStringValue( )
.startsWith(
ExpressionUtil.MEASURE_INDICATOR ) )
{
return true;
}
}
}
}
return this.isCube( );
}

public void setExpression( String expr, boolean bNotifyEvents )
{
if ( expr != null && expr.length( ) > 0 )
Expand Down

0 comments on commit 37aee86

Please sign in to comment.