<commit_before>/**
 * 
 */

package org.eclipse.birt.report.item.crosstab.ui.views.attributes.provider;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.ComboPropertyDescriptorProvider;
import org.eclipse.birt.report.item.crosstab.core.de.CrosstabReportItemHandle;
import org.eclipse.birt.report.item.crosstab.internal.ui.AggregationCellProviderWrapper;
import org.eclipse.birt.report.item.crosstab.ui.extension.AggregationCellViewAdapter;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.extension.ExtendedElementException;

/**
 * @author Administrator
 * 
 */
public class MeasureComboPropertyDescriptorProvider extends
		ComboPropertyDescriptorProvider
{

	protected CrosstabReportItemHandle crosstabHandle;
	protected static Logger logger = Logger.getLogger( MeasureComboPropertyDescriptorProvider.class.getName( ) );

	public MeasureComboPropertyDescriptorProvider( String property,
			String element )
	{
		super( property, element );
		// TODO Auto-generated constructor stub
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.IDescriptorProvider#save(java.lang.Object)
	 */
	public void save( Object value ) throws SemanticException
	{
		String stringValue = (String) value;
		if ( input == null )
		{
			return;
		}
		else if ( crosstabHandle == null )
		{
			initializeCrosstab( );
		}
		if ( stringValue != null )
		{
			crosstabHandle.setMeasureDirection( stringValue );
			AggregationCellProviderWrapper providerWrapper = new AggregationCellProviderWrapper(crosstabHandle);
			providerWrapper.updateAllAggregationCells( AggregationCellViewAdapter.CHANGE_ORIENTATION_TYPE );
		}

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.IDescriptorProvider#setInput(java.lang.Object)
	 */
	public void setInput( Object input )
	{
		// TODO Auto-generated method stub
		super.setInput( input );
		initializeCrosstab( );
	}

	protected void initializeCrosstab( )
	{
		crosstabHandle = null;
		if ( ( input == null ) )
		{<commit_msg>- Summary: Add transaction for changing crosstab orientation.<commit_after>/**
 * 
 */

package org.eclipse.birt.report.item.crosstab.ui.views.attributes.provider;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.ComboPropertyDescriptorProvider;
import org.eclipse.birt.report.designer.nls.Messages;
import org.eclipse.birt.report.item.crosstab.core.de.CrosstabReportItemHandle;
import org.eclipse.birt.report.item.crosstab.internal.ui.AggregationCellProviderWrapper;
import org.eclipse.birt.report.item.crosstab.ui.extension.AggregationCellViewAdapter;
import org.eclipse.birt.report.model.api.CommandStack;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.extension.ExtendedElementException;

/**
 * @author Administrator
 * 
 */
public class MeasureComboPropertyDescriptorProvider extends
		ComboPropertyDescriptorProvider
{

	protected CrosstabReportItemHandle crosstabHandle;
	protected static Logger logger = Logger.getLogger( MeasureComboPropertyDescriptorProvider.class.getName( ) );

	protected final String TRANS_NAME = Messages.getString( "MeasureComboPropertyDescriptorProvider.TransName" );
	public MeasureComboPropertyDescriptorProvider( String property,
			String element )
	{
		super( property, element );
		// TODO Auto-generated constructor stub
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.IDescriptorProvider#save(java.lang.Object)
	 */
	public void save( Object value ) throws SemanticException
	{

		
		String stringValue = (String) value;
		if ( input == null )
		{
			return;
		}
		else if ( crosstabHandle == null )
		{
			initializeCrosstab( );
		}
		if ( stringValue != null )
		{
			CommandStack stack = crosstabHandle.getModuleHandle( ).getCommandStack( );
			// start trans
			stack.startTrans( TRANS_NAME );
			
			crosstabHandle.setMeasureDirection( stringValue );
			AggregationCellProviderWrapper providerWrapper = new AggregationCellProviderWrapper(crosstabHandle);
			providerWrapper.updateAllAggregationCells( AggregationCellViewAdapter.CHANGE_ORIENTATION_TYPE );
			
			stack.commit( );
		}

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.IDescriptorProvider#setInput(java.lang.Object)
	 */
	public void setInput( Object input )
	{
		// TODO Auto-generated method stub
		super.setInput( input );
		initializeCrosstab( );
	}

	protected void initializeCrosstab( )
	{
		crosstabHandle = null;
		if ( ( input == null ) )
		{
{'fraction_non_alphanumeric': 0.1051898985881885, 'fraction_numerical': 0.0, 'mean_word_length': 4.774971297359357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5458172', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1497, 'n_words': 244}