diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/FormatDateTimePattern.java b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/FormatDateTimePattern.java index 9bd391939c4..64b08b79b73 100644 --- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/FormatDateTimePattern.java +++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/FormatDateTimePattern.java @@ -18,79 +18,123 @@ import com.ibm.icu.util.ULocale; +/** + * Class to handle the format pattern of date time + * + * @since 3.3 + */ public class FormatDateTimePattern { - public static final String DATETIEM_FORMAT_TYPE_YEAR = "datetiem_format_type_year"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_SHORT_YEAR = "datetiem_format_type_short_year"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_LONG_MONTH_YEAR = "datetiem_format_type_long_month_year"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_SHOT_MONTH_YEAR = "datetiem_format_type_shot_month_year"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_MONTH = "datetiem_format_type_month"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_LONG_DAY_OF_WEEK = "datetiem_format_type_long_day_of_week"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_DAY_OF_MONTH = "datetiem_format_type_day_of_month"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_MEDIUM_DAY_OF_YEAR = "datetiem_format_type_medium_day_of_year"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_MINUTES = "datetiem_format_type_minutes"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_SECONTDS = "datetiem_format_type_secontds"; //$NON-NLS-1$ - public static final String DATETIEM_FORMAT_TYPE_GENERAL_TIME = "datetiem_format_type_general_time"; //$NON-NLS-1$ - - private static final String[] customCategories = { DATETIEM_FORMAT_TYPE_YEAR, DATETIEM_FORMAT_TYPE_SHORT_YEAR, - DATETIEM_FORMAT_TYPE_LONG_MONTH_YEAR, DATETIEM_FORMAT_TYPE_SHOT_MONTH_YEAR, DATETIEM_FORMAT_TYPE_MONTH, - DATETIEM_FORMAT_TYPE_LONG_DAY_OF_WEEK, DATETIEM_FORMAT_TYPE_DAY_OF_MONTH, - DATETIEM_FORMAT_TYPE_MEDIUM_DAY_OF_YEAR, DATETIEM_FORMAT_TYPE_MINUTES, DATETIEM_FORMAT_TYPE_SECONTDS, - DATETIEM_FORMAT_TYPE_GENERAL_TIME, }; + /** property: date time format of type year */ + public static final String DATETIME_FORMAT_TYPE_YEAR = "datetiem_format_type_year"; //$NON-NLS-1$ + + /** property: date time format of type short year */ + public static final String DATETIME_FORMAT_TYPE_SHORT_YEAR = "datetiem_format_type_short_year"; //$NON-NLS-1$ + + /** property: date time format of type long month year */ + public static final String DATETIME_FORMAT_TYPE_LONG_MONTH_YEAR = "datetiem_format_type_long_month_year"; //$NON-NLS-1$ + + /** property: date time format of type short month year */ + public static final String DATETIME_FORMAT_TYPE_SHORT_MONTH_YEAR = "datetiem_format_type_shot_month_year"; //$NON-NLS-1$ + + /** property: date time format of type month */ + public static final String DATETIME_FORMAT_TYPE_MONTH = "datetiem_format_type_month"; //$NON-NLS-1$ + + /** property: date time format of type long day of week */ + public static final String DATETIME_FORMAT_TYPE_LONG_DAY_OF_WEEK = "datetiem_format_type_long_day_of_week"; //$NON-NLS-1$ + + /** property: date time format of type day of month */ + public static final String DATETIME_FORMAT_TYPE_DAY_OF_MONTH = "datetiem_format_type_day_of_month"; //$NON-NLS-1$ + + /** property: date time format of type medium day of year */ + public static final String DATETIME_FORMAT_TYPE_MEDIUM_DAY_OF_YEAR = "datetiem_format_type_medium_day_of_year"; //$NON-NLS-1$ + + /** property: date time format of type minutes */ + public static final String DATETIME_FORMAT_TYPE_MINUTES = "datetiem_format_type_minutes"; //$NON-NLS-1$ + + /** property: date time format of type seconds */ + public static final String DATETIME_FORMAT_TYPE_SECONDS = "datetiem_format_type_secontds"; //$NON-NLS-1$ + + /** property: date time format of type general time */ + public static final String DATETIME_FORMAT_TYPE_GENERAL_TIME = "datetiem_format_type_general_time"; //$NON-NLS-1$ + private static final String[] customCategories = { DATETIME_FORMAT_TYPE_YEAR, DATETIME_FORMAT_TYPE_SHORT_YEAR, + DATETIME_FORMAT_TYPE_LONG_MONTH_YEAR, DATETIME_FORMAT_TYPE_SHORT_MONTH_YEAR, DATETIME_FORMAT_TYPE_MONTH, + DATETIME_FORMAT_TYPE_LONG_DAY_OF_WEEK, DATETIME_FORMAT_TYPE_DAY_OF_MONTH, + DATETIME_FORMAT_TYPE_MEDIUM_DAY_OF_YEAR, DATETIME_FORMAT_TYPE_MINUTES, DATETIME_FORMAT_TYPE_SECONDS, + DATETIME_FORMAT_TYPE_GENERAL_TIME, }; + + /** + * Get all categories of custom pattern + * + * @return Return all categories of custom pattern + */ public static String[] getCustormPatternCategorys() { return customCategories; } + /** + * Get the display name for the custom category + * + * @param custormCategory custom category + * @return Return the display name for the custom category + */ public static String getDisplayName4CustomCategory(String custormCategory) { return Messages.getString("FormatDateTimePattern." + custormCategory); //$NON-NLS-1$ } - public static String getCustormFormatPattern(String custormCategory, ULocale locale) { + /** + * Get the custom format pattern + * + * @param customCategory custom category + * @param locale locale + * @return Return the custom format pattern + */ + public static String getCustomFormatPattern(String customCategory, ULocale locale) { if (locale == null) { locale = ULocale.getDefault(); } - if (DATETIEM_FORMAT_TYPE_GENERAL_TIME.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_GENERAL_TIME, //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_GENERAL_TIME.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_GENERAL_TIME, //$NON-NLS-1$ locale.toLocale()); } - if (DATETIEM_FORMAT_TYPE_YEAR.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_YEAR, locale.toLocale()); //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_YEAR.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_YEAR, locale.toLocale()); //$NON-NLS-1$ } - if (DATETIEM_FORMAT_TYPE_SHORT_YEAR.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_SHORT_YEAR, //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_SHORT_YEAR.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_SHORT_YEAR, //$NON-NLS-1$ locale.toLocale()); } - if (DATETIEM_FORMAT_TYPE_LONG_MONTH_YEAR.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_LONG_MONTH_YEAR, //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_LONG_MONTH_YEAR.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_LONG_MONTH_YEAR, //$NON-NLS-1$ locale.toLocale()); } - if (DATETIEM_FORMAT_TYPE_SHOT_MONTH_YEAR.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_SHOT_MONTH_YEAR, //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_SHORT_MONTH_YEAR.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_SHORT_MONTH_YEAR, //$NON-NLS-1$ locale.toLocale()); } - if (DATETIEM_FORMAT_TYPE_MONTH.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_MONTH, locale.toLocale()); //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_MONTH.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_MONTH, locale.toLocale()); //$NON-NLS-1$ } - if (DATETIEM_FORMAT_TYPE_LONG_DAY_OF_WEEK.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_LONG_DAY_OF_WEEK, //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_LONG_DAY_OF_WEEK.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_LONG_DAY_OF_WEEK, //$NON-NLS-1$ locale.toLocale()); } - if (DATETIEM_FORMAT_TYPE_DAY_OF_MONTH.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_DAY_OF_MONTH, //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_DAY_OF_MONTH.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_DAY_OF_MONTH, //$NON-NLS-1$ locale.toLocale()); } - if (DATETIEM_FORMAT_TYPE_MEDIUM_DAY_OF_YEAR.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_MEDIUM_DAY_OF_YEAR, //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_MEDIUM_DAY_OF_YEAR.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_MEDIUM_DAY_OF_YEAR, //$NON-NLS-1$ locale.toLocale()); } - if (DATETIEM_FORMAT_TYPE_MINUTES.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_MINUTES, //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_MINUTES.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_MINUTES, //$NON-NLS-1$ locale.toLocale()); } - if (DATETIEM_FORMAT_TYPE_SECONTDS.equals(custormCategory)) { - return Messages.getString("FormatDateTimePattern.pattern." + DATETIEM_FORMAT_TYPE_SECONTDS, //$NON-NLS-1$ + if (DATETIME_FORMAT_TYPE_SECONDS.equals(customCategory)) { + return Messages.getString("FormatDateTimePattern.pattern." + DATETIME_FORMAT_TYPE_SECONDS, //$NON-NLS-1$ locale.toLocale()); } diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatAdapter.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatAdapter.java index 8fb90bae3b0..5c86cd744de 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatAdapter.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatAdapter.java @@ -29,8 +29,10 @@ */ public abstract class FormatAdapter { + /** property: label of NONE */ public static final String NONE = Messages.getString("FormatAdapter.DisplayName.None"); //$NON-NLS-1$ + /** property: tree map of local table */ public final static TreeMap LOCALE_TABLE = new TreeMap<>(Collator.getInstance()); static { @@ -46,6 +48,12 @@ public abstract class FormatAdapter { } } + /** + * Get locale display name + * + * @param locale locale for the display name + * @return Return the locale display name + */ public static String getLocaleDisplayName(ULocale locale) { if (locale == null) { return NONE; @@ -53,6 +61,11 @@ public static String getLocaleDisplayName(ULocale locale) { return locale.getDisplayName(); } + /** + * Get locale display name array + * + * @return Return the locale display name array + */ public static String[] getLocaleDisplayNames() { String[] oldNames = LOCALE_TABLE.keySet().toArray(new String[0]); String[] newNames = new String[oldNames.length + 1]; @@ -61,6 +74,12 @@ public static String[] getLocaleDisplayNames() { return newNames; } + /** + * Get the locale of display name + * + * @param localeDisplayName the display name to get the locale + * @return Return the locale of the display name + */ public static ULocale getLocaleByDisplayName(String localeDisplayName) { if (NONE.equals(localeDisplayName) || localeDisplayName == null) { return null; @@ -68,6 +87,13 @@ public static ULocale getLocaleByDisplayName(String localeDisplayName) { return LOCALE_TABLE.get(localeDisplayName); } + /** + * Get the matrix of choice like array + * + * @param structName structure name + * @param popertyName property name + * @return Return the matrix of choice like array + */ public static String[][] getChoiceArray(String structName, String popertyName) { IChoiceSet set = ChoiceSetFactory.getStructChoiceSet(structName, popertyName); IChoice[] choices = set.getChoices(); @@ -90,21 +116,54 @@ public static String[][] getChoiceArray(String structName, String popertyName) { return ca; } + /** + * Get the init choice array + * + * @return Return the init choice array + */ public abstract String[][] initChoiceArray(); /** * Gets the format types for display names. + * + * @param locale locale of the format types + * + * @return Return the format types for display names. */ public abstract String[] getFormatTypes(ULocale locale); + /** + * Get the index of category + * + * @param name name to get the category index + * @return Return the index of category + */ public abstract int getIndexOfCategory(String name); + /** + * Get the display name based on category + * + * @param category + * @return Return the display name based on category + */ public abstract String getDisplayName4Category(String category); /** * Gets the corresponding category for given display name. + * + * @param displayName display name + * + * @return Return the corresponding category for given display name */ public abstract String getCategory4DisplayName(String displayName); + /** + * Gets the corresponding category for given display name locale based + * + * @param displayName display name + * @param locale locale of display name + * + * @return Return the corresponding category for given display name locale based + */ public abstract String getPattern4DisplayName(String displayName, ULocale locale); } diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatDateTimeAdapter.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatDateTimeAdapter.java index c8b562c5e99..d7a70e68b6b 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatDateTimeAdapter.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatDateTimeAdapter.java @@ -212,21 +212,27 @@ public String getPattern4DisplayName(String displayName, ULocale locale) { } /** - * @return + * Get the display name of unformatted category + * + * @return Return the display name of unformatted category */ public String getUnformattedCategoryDisplayName() { return UNFORMATTED_DISPLAYNAME; } /** - * @return + * Get the category name of custom + * + * @return Return the category name of custom */ public String getCustomCategoryName() { return CUSTOM; } /** - * @return + * Get the category name of unformatted + * + * @return Return the category name of unformatted */ public String getUnformattedCategoryName() { return UNFORMATTED_NAME; diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatDateTimeLayoutPeer.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatDateTimeLayoutPeer.java index 41efb5c15a0..f2b7332ece1 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatDateTimeLayoutPeer.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/FormatDateTimeLayoutPeer.java @@ -397,9 +397,9 @@ private String[][] getTableItems(ULocale locale) { String[] customPatterns = FormatDateTimePattern.getCustormPatternCategorys(); for (int i = 0; i < customPatterns.length; i++) { itemList.add(new String[] { FormatDateTimePattern.getDisplayName4CustomCategory(customPatterns[i]), - new DateFormatter(FormatDateTimePattern.getCustormFormatPattern(customPatterns[i], locale), locale) + new DateFormatter(FormatDateTimePattern.getCustomFormatPattern(customPatterns[i], locale), locale) .format(defaultDate), - FormatDateTimePattern.getCustormFormatPattern(customPatterns[i], locale) }); + FormatDateTimePattern.getCustomFormatPattern(customPatterns[i], locale) }); } return itemList.toArray(new String[0][3]); } diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/dialogs/ParameterDialog.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/dialogs/ParameterDialog.java index 65dc698b135..b2012eab1dd 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/dialogs/ParameterDialog.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/dialogs/ParameterDialog.java @@ -80,6 +80,7 @@ import org.eclipse.birt.report.model.api.SelectionChoiceHandle; import org.eclipse.birt.report.model.api.StructureFactory; import org.eclipse.birt.report.model.api.activity.SemanticException; +import org.eclipse.birt.report.model.api.core.IStructure; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; import org.eclipse.birt.report.model.api.elements.ReportDesignConstants; import org.eclipse.birt.report.model.api.elements.structures.FormatValue; @@ -88,8 +89,8 @@ import org.eclipse.birt.report.model.api.metadata.IChoiceSet; import org.eclipse.birt.report.model.api.util.ParameterValidationUtil; import org.eclipse.birt.report.model.api.util.StringUtil; +import org.eclipse.birt.report.model.elements.interfaces.IInternalAbstractScalarParameterModel; import org.eclipse.birt.report.model.elements.interfaces.IScalarParameterModel; -import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.IStructuredContentProvider; @@ -281,14 +282,18 @@ public class ParameterDialog extends BaseTitleAreaDialog { private static final String BOOLEAN_FALSE = Messages.getString("ParameterDialog.Boolean.False"); //$NON-NLS-1$ + /** property: name of parameter control list */ public static final String PARAM_CONTROL_LIST = DesignChoiceConstants.PARAM_CONTROL_LIST_BOX + "/List"; //$NON-NLS-1$ + /** property: name of parameter combo box */ public static final String PARAM_CONTROL_COMBO = DesignChoiceConstants.PARAM_CONTROL_LIST_BOX + "/Combo"; //$NON-NLS-1$ private static final String PARAM_CONTROL_RADIO = DesignChoiceConstants.PARAM_CONTROL_RADIO_BUTTON; // $NON-NLS-1$ + /** property: display name of parameter control list */ public static final String DISPLAY_NAME_CONTROL_LIST = Messages.getString("ParameterDialog.DisplayLabel.List"); //$NON-NLS-1$ + /** property: display name of parameter combo box */ public static final String DISPLAY_NAME_CONTROL_COMBO = Messages.getString("ParameterDialog.DisplayLabel.Combo"); //$NON-NLS-1$ private static final String NONE_DISPLAY_TEXT = Messages.getString("ParameterDialog.Label.None"); //$NON-NLS-1$ @@ -298,32 +303,40 @@ public class ParameterDialog extends BaseTitleAreaDialog { private static final Image NOT_DEFAULT_ICON = ReportPlatformUIImages .getImage(IReportGraphicConstants.ICON_DEFAULT_NOT); + /** property: control type value */ public static final String CONTROLTYPE_VALUE = "controltype";//$NON-NLS-1$ + /** property: data type value */ public static final String DATATYPE_VALUE = "datatype";//$NON-NLS-1$ + /** property: static value */ public static final String STATIC_VALUE = "static";//$NON-NLS-1$ + /** property: helper key of control type */ public static final String HELPER_KEY_CONTROLTYPE = "controlType";//$NON-NLS-1$ + /** property: helper key of start point */ public static final String HELPER_KEY_STARTPOINT = "autoSuggestStartPoint";//$NON-NLS-1$ + /** property: control type of input value */ public static final String CONTROLTYPE_INPUTVALUE = "controltypeinput"; //$NON-NLS-1$ + /** property: start point of input value */ public static final String STARTPOINT_INPUTVALUE = "startpointinput"; //$NON-NLS-1$ + /** property: start point value */ public static final String STARTPOINT_VALUE = "startpoint"; //$NON-NLS-1$ private boolean allowMultiValueVisible = true; - private HashMap dirtyProperties = new HashMap(5); + private HashMap dirtyProperties = new HashMap(5); - private ArrayList choiceList = new ArrayList(); + private ArrayList choiceList = new ArrayList(); private Map editChoiceMap = new HashMap<>(); private static final IChoiceSet DATA_TYPE_CHOICE_SET = DEUtil.getMetaDataDictionary() .getElement(ReportDesignConstants.SCALAR_PARAMETER_ELEMENT) - .getProperty(ScalarParameterHandle.DATA_TYPE_PROP).getAllowedChoices(); + .getProperty(IInternalAbstractScalarParameterModel.DATA_TYPE_PROP).getAllowedChoices(); private static final double DEFAULT_PREVIEW_NUMBER = 1234.56; @@ -376,7 +389,7 @@ public class ParameterDialog extends BaseTitleAreaDialog { private Composite valueArea, sorttingArea; - private List columnList; + private List columnList; private TableArea staticTableArea; @@ -396,8 +409,8 @@ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { @Override public Object[] getElements(Object inputElement) { - ArrayList list = ((ArrayList) inputElement); - ArrayList elementsList = (ArrayList) list.clone(); + ArrayList list = ((ArrayList) inputElement); + ArrayList elementsList = (ArrayList) list.clone(); return elementsList.toArray(); } }; @@ -410,9 +423,8 @@ public Image getColumnImage(Object element, int columnIndex) { SelectionChoice choice = ((SelectionChoice) element); if (isDefaultChoice(choice)) { return DEFAULT_ICON; - } else { - return NOT_DEFAULT_ICON; } + return NOT_DEFAULT_ICON; } return null; } @@ -486,7 +498,7 @@ public String validate(String displayLableKey, String displayLabel, String value } }); - if (dialog.open() == Dialog.OK) { + if (dialog.open() == Window.OK) { // choice.setValue( convertToStandardFormat( choice.getValue( ) // ) ); // oldChoice.setValue( tempChoice.getValue( ) ); @@ -521,7 +533,7 @@ public String validate(String displayLabelKey, String displayLabel, String value return validateChoice(null, displayLabelKey, displayLabel, value); } }); - if (dialog.open() == Dialog.OK) { + if (dialog.open() == Window.OK) { // choice.setValue( convertToStandardFormat( choice.getValue( ) // ) ); // choice.setValue( choice.getValue( ) ); @@ -564,7 +576,7 @@ public Object[] getElements(Object inputElement) { if (inputElement == null) { return new Object[0]; } else if (inputElement instanceof List) { - return ((List) inputElement).toArray(); + return ((List) inputElement).toArray(); } return null; } @@ -645,7 +657,8 @@ public ParameterDialog(String title) { } /** - * Create a new parameter dialog with given title under the specified shell + * Constructor: Create a new parameter dialog with given title under the + * specified shell * * @param parentShell the parent shell of the dialog * @param title the title of the dialog @@ -655,6 +668,14 @@ public ParameterDialog(Shell parentShell, String title) { this.title = title; } + /** + * Constructor: Create a new parameter dialog with given title under the + * specified shell + * + * @param parentShell the parent shell of the dialog + * @param title the title of the dialog + * @param allowMultiValueVisible the flag to allow multiple value + */ public ParameterDialog(Shell parentShell, String title, boolean allowMultiValueVisible) { this(parentShell, title); this.allowMultiValueVisible = allowMultiValueVisible; @@ -1152,7 +1173,7 @@ private void initValueArea() { refreshSortByItems(); ExpressionHandle columnValueValue = inputParameter - .getExpressionProperty(ScalarParameterHandle.VALUE_EXPR_PROP); + .getExpressionProperty(IInternalAbstractScalarParameterModel.VALUE_EXPR_PROP); { columnChooser.setData(ExpressionButtonUtil.EXPR_TYPE, columnValueValue == null || columnValueValue.getType() == null ? UIUtil.getDefaultScriptType() @@ -1169,7 +1190,8 @@ private void initValueArea() { } } - ExpressionHandle columnValue = inputParameter.getExpressionProperty(ScalarParameterHandle.LABEL_EXPR_PROP); + ExpressionHandle columnValue = inputParameter + .getExpressionProperty(IInternalAbstractScalarParameterModel.LABEL_EXPR_PROP); { displayTextChooser.setData(ExpressionButtonUtil.EXPR_TYPE, columnValue == null || columnValue.getType() == null ? UIUtil.getDefaultScriptType() @@ -1319,7 +1341,7 @@ private void initFormatField() { updateFormatField(); } - private List getColumnValueList() { + private List getColumnValueList() { try { if (columnChooser.getText() == null || columnChooser.getText().equals("")) //$NON-NLS-1$ { @@ -1344,9 +1366,9 @@ private void refreshDataSets() { String selectedDataSetName = dataSetChooser.getText(); String[] oldList = dataSetChooser.getItems(); - List dataSetList = new ArrayList(); + List dataSetList = new ArrayList(); - for (Iterator iterator = inputParameter.getModuleHandle().getVisibleDataSets().iterator(); iterator + for (Iterator iterator = inputParameter.getModuleHandle().getVisibleDataSets().iterator(); iterator .hasNext();) { DataSetHandle DataSetHandle = (DataSetHandle) iterator.next(); dataSetList.add(DataSetHandle.getQualifiedName()); @@ -1355,7 +1377,7 @@ private void refreshDataSets() { // if(staticRadio.getSelection()) // linked data model is not applicable to // dynamic params. { - for (Iterator itr = new LinkedDataSetAdapter().getVisibleLinkedDataSets().iterator(); itr.hasNext();) { + for (Iterator itr = new LinkedDataSetAdapter().getVisibleLinkedDataSets().iterator(); itr.hasNext();) { dataSetList.add(itr.next().toString()); } } @@ -1371,7 +1393,7 @@ private void refreshDataSets() { selectedDataSetName = newName; } - dataSetChooser.setItems((String[]) dataSetList.toArray(new String[] {})); + dataSetChooser.setItems(dataSetList.toArray(new String[] {})); if (StringUtil.isBlank(selectedDataSetName)) { dataSetChooser.select(0); refreshColumns(false); @@ -1383,7 +1405,7 @@ private void refreshDataSets() { } } - private String findNewDataSet(List existingDataSets, List newDataSets) { + private String findNewDataSet(List existingDataSets, List newDataSets) { for (int i = 0; i < newDataSets.size(); i++) { if (!existingDataSets.contains(newDataSets.get(i))) { return (String) newDataSets.get(i); @@ -1410,7 +1432,7 @@ private void refreshColumns(boolean onlyFilter) { } displayTextChooser.removeAll(); displayTextChooser.add(NONE_DISPLAY_TEXT); - for (Iterator iter = columnList.iterator(); iter.hasNext();) { + for (Iterator iter = columnList.iterator(); iter.hasNext();) { displayTextChooser.add(((ResultSetColumnHandle) iter.next()).getColumnName()); } @@ -1426,7 +1448,7 @@ private void refreshColumns(boolean onlyFilter) { String originalSelection = columnChooser.getText(); columnChooser.removeAll(); - for (Iterator iter = columnList.iterator(); iter.hasNext();) { + for (Iterator iter = columnList.iterator(); iter.hasNext();) { ResultSetColumnHandle cachedColumn = (ResultSetColumnHandle) iter.next(); if (matchDataType(cachedColumn)) { columnChooser.add(cachedColumn.getColumnName()); @@ -1509,9 +1531,8 @@ private String getSelectedControlType() { String type = (String) controlTypeHelper.getProperty(CONTROLTYPE_VALUE); if (type == null) { return getInputControlType(); - } else { - return type; } + return type; } private void changeDataType() { @@ -1561,11 +1582,11 @@ private boolean makeUniqueAndValid() { boolean change = false; try { - Set set = new HashSet(); + Set set = new HashSet(); if ((isStatic() && !distinct.isEnabled()) || (distinct.isEnabled() && !distinct.getSelection())) { if (choiceList != null) { - for (Iterator iter = choiceList.iterator(); iter.hasNext();) { + for (Iterator iter = choiceList.iterator(); iter.hasNext();) { SelectionChoice choice = (SelectionChoice) iter.next(); if (isValidValue(choice.getValue()) != null || set.contains(validateValue(choice.getValue()))) { if (enableAllowMultiValueVisible()) { @@ -1581,7 +1602,7 @@ private boolean makeUniqueAndValid() { } if (defaultValueList != null) { - for (Iterator iter = defaultValueList.iterator(); iter.hasNext();) { + for (Iterator iter = defaultValueList.iterator(); iter.hasNext();) { Expression expression = (Expression) iter.next(); if (expression != null) { if (isValidValue(expression) != null || set.contains(validateValue(expression))) { @@ -1722,7 +1743,7 @@ private void switchToCheckBox() { public void modifyText(ModifyEvent e) { String type = (String) defaultValueChooser.getData(ExpressionButtonUtil.EXPR_TYPE); - List list = new ArrayList(Arrays.asList(defaultValueChooser.getItems())); + List list = new ArrayList(Arrays.asList(defaultValueChooser.getItems())); switch (list.indexOf(defaultValueChooser.getText())) { case 0: defaultValueList = null; @@ -1746,9 +1767,8 @@ public void modifyText(ModifyEvent e) { public String getExpression() { if (defaultValueChooser != null) { return getDefaultValueChooserValue(); - } else { - return ""; //$NON-NLS-1$ } + return ""; //$NON-NLS-1$ } @Override @@ -1908,9 +1928,9 @@ public void widgetDefaultSelected(SelectionEvent e) { @Override public void widgetSelected(SelectionEvent e) { String type = getSelectedDataType(); - List choices = new ArrayList(); - Map labelMap = new HashMap(); - for (Iterator iter = choiceList.iterator(); iter.hasNext();) { + List choices = new ArrayList(); + Map labelMap = new HashMap(); + for (Iterator iter = choiceList.iterator(); iter.hasNext();) { SelectionChoice choice = (SelectionChoice) iter.next(); choices.add(choice.getValue()); if (choice.getLabel() != null) { @@ -1947,7 +1967,7 @@ public String validateString(String value) { SelectionChoice choice = StructureFactory.createSelectionChoice(); choice.setValue(importValues[i]); if (labelMap.get(importValues[i]) != null) { - choice.setLabel((String) labelMap.get(importValues[i])); + choice.setLabel(labelMap.get(importValues[i])); } choiceList.add(choice); } @@ -1973,7 +1993,7 @@ public void widgetSelected(SelectionEvent e) { .getFirstElement(); if (isDefaultChoice(choice)) { // changeDefaultValue( null ); - Iterator iter = ((IStructuredSelection) valueTable.getSelection()).iterator(); + Iterator iter = ((IStructuredSelection) valueTable.getSelection()).iterator(); while (iter.hasNext()) { Object obj = iter.next(); if (obj instanceof SelectionChoice) { @@ -1982,7 +2002,7 @@ public void widgetSelected(SelectionEvent e) { } } else { // changeDefaultValue( choice.getValue( ) ); - Iterator iter = ((IStructuredSelection) valueTable.getSelection()).iterator(); + Iterator iter = ((IStructuredSelection) valueTable.getSelection()).iterator(); while (iter.hasNext()) { Object obj = iter.next(); if (obj instanceof SelectionChoice) { @@ -2221,7 +2241,7 @@ private void refreshSortByItems() { sortKeyChooser.add(CHOICE_DISPLAY_TEXT); sortKeyChooser.add(CHOICE_VALUE_COLUMN); } else if (dynamicRadio.getSelection()) { - for (Iterator iter = columnList.iterator(); iter.hasNext();) { + for (Iterator iter = columnList.iterator(); iter.hasNext();) { sortKeyChooser.add(((ResultSetColumnHandle) iter.next()).getColumnName()); } @@ -2562,7 +2582,7 @@ public void widgetSelected(SelectionEvent e) { String selection = defaultValueChooser.getItem(defaultValueChooser.getSelectionIndex()); if (selection.equals(CHOICE_SELECT_VALUE)) { - List columnValueList = getColumnValueList(); + List columnValueList = getColumnValueList(); if (columnValueList.isEmpty()) { return; } @@ -2615,9 +2635,8 @@ public void modifyText(ModifyEvent e) { public String getExpression() { if (defaultValueChooser != null) { return defaultValueChooser.getText(); - } else { - return ""; //$NON-NLS-1$ } + return ""; //$NON-NLS-1$ } @Override @@ -2705,9 +2724,8 @@ private Object validateValue(String value) throws BirtException { private Object validateValue(Expression expression) throws BirtException { if (expression == null) { return validateValue(null, null); - } else { - return validateValue(expression.getStringExpression(), expression.getType()); } + return validateValue(expression.getStringExpression(), expression.getType()); } private Object validateValue(String value, String type) throws BirtException { @@ -2730,10 +2748,8 @@ private Object validateValue(String value, String type) throws BirtException { return ParameterValidationUtil.validate(getSelectedDataType(), ParameterUtil.STANDARD_DATE_TIME_PATTERN, tempdefaultValue, ULocale.getDefault()); - } else { - return tempdefaultValue; } - + return tempdefaultValue; } if (DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals(getSelectedDataType())) { if (tempdefaultValue != null && tempdefaultValue.equals(CHOICE_NO_DEFAULT)) { @@ -2741,12 +2757,10 @@ private Object validateValue(String value, String type) throws BirtException { } if (ExpressionType.CONSTANT.equals(exprType)) { return DataTypeUtil.toBoolean(tempdefaultValue); - } else { - return tempdefaultValue; } - } else { return tempdefaultValue; } + return tempdefaultValue; } private void validateValueList(List values) throws BirtException { @@ -2790,7 +2804,7 @@ protected void okPressed() { inputParameter.setParamType(DesignChoiceConstants.SCALAR_PARAM_TYPE_MULTI_VALUE); } } else { - inputParameter.setProperty(ScalarParameterHandle.MUCH_MATCH_PROP, null); + inputParameter.setProperty(IScalarParameterModel.MUCH_MATCH_PROP, null); } // Save control type @@ -2809,7 +2823,7 @@ protected void okPressed() { } if (choiceList != null) { - for (Iterator iter = choiceList.iterator(); iter.hasNext();) { + for (Iterator iter = choiceList.iterator(); iter.hasNext();) { SelectionChoice choice = (SelectionChoice) iter.next(); if (isEqual(choice.getValue(), value)) { flag = true; @@ -2835,9 +2849,9 @@ protected void okPressed() { .setDataType(DATA_TYPE_CHOICE_SET.findChoiceByDisplayName(dataTypeChooser.getText()).getName()); PropertyHandle selectionChioceList = inputParameter - .getPropertyHandle(ScalarParameterHandle.SELECTION_LIST_PROP); + .getPropertyHandle(IInternalAbstractScalarParameterModel.SELECTION_LIST_PROP); // Clear original choices list - selectionChioceList.setValue(new ArrayList()); + selectionChioceList.setValue(new ArrayList()); if (isStatic()) { // Save static choices list @@ -2846,7 +2860,7 @@ protected void okPressed() { && !DesignChoiceConstants.PARAM_CONTROL_CHECK_BOX.equals(newControlType)) { if (choiceList != null) { SelectionChoice originalChoice = null; - for (Iterator iter = choiceList.iterator(); iter.hasNext();) { + for (Iterator iter = choiceList.iterator(); iter.hasNext();) { SelectionChoice choice = (SelectionChoice) iter.next(); originalChoice = editChoiceMap.get(choice); if (originalChoice != null) { @@ -2873,7 +2887,8 @@ protected void okPressed() { { Expression expression = new Expression(getExpression(columnChooser, columnChooser.getText()), (String) columnChooser.getData(ExpressionButtonUtil.EXPR_TYPE)); - inputParameter.setExpressionProperty(ScalarParameterHandle.VALUE_EXPR_PROP, expression); + inputParameter.setExpressionProperty(IInternalAbstractScalarParameterModel.VALUE_EXPR_PROP, + expression); } if (displayTextChooser.getText().equals(LABEL_NULL)) { inputParameter.setLabelExpr(""); //$NON-NLS-1$ @@ -2881,7 +2896,8 @@ protected void okPressed() { Expression expression = new Expression( getExpression(displayTextChooser, displayTextChooser.getText()), (String) displayTextChooser.getData(ExpressionButtonUtil.EXPR_TYPE)); - inputParameter.setExpressionProperty(ScalarParameterHandle.LABEL_EXPR_PROP, expression); + inputParameter.setExpressionProperty(IInternalAbstractScalarParameterModel.LABEL_EXPR_PROP, + expression); } if (startPointTypeHelper != null) { if (startPointTypeHelper.getControl() != null && startPointTypeHelper.getControl().isVisible()) { @@ -2930,7 +2946,7 @@ protected void okPressed() { inputParameter.setConcealValue(getProperty(CHECKBOX_DO_NOT_ECHO)); } } else { - inputParameter.setProperty(ScalarParameterHandle.CONCEAL_VALUE_PROP, null); + inputParameter.setProperty(IScalarParameterModel.CONCEAL_VALUE_PROP, null); } if (distinct.isEnabled()) { @@ -2967,7 +2983,7 @@ protected void okPressed() { } } } else { - inputParameter.setProperty(ScalarParameterHandle.FIXED_ORDER_PROP, null); + inputParameter.setProperty(IScalarParameterModel.FIXED_ORDER_PROP, null); } // Save limits @@ -2980,7 +2996,7 @@ protected void okPressed() { ERROR_MSG_INVALID_LIST_LIMIT, new Object[] { Integer.toString(Integer.MAX_VALUE) })); } } else { - inputParameter.setProperty(ScalarParameterHandle.LIST_LIMIT_PROP, null); + inputParameter.setProperty(IInternalAbstractScalarParameterModel.LIST_LIMIT_PROP, null); } } catch (SemanticException e) { ExceptionHandler.handle(e); @@ -3244,7 +3260,7 @@ private String validateName() { private String getDefaultValueChooserValue() { String defaultValue; - List list = new ArrayList(Arrays.asList(defaultValueChooser.getItems())); + List list = new ArrayList(Arrays.asList(defaultValueChooser.getItems())); switch (list.indexOf(defaultValueChooser.getText())) { case 0: defaultValue = null; @@ -3276,7 +3292,7 @@ private void refreshDynamicValueTable() { } private boolean getProperty(String key) { - return ((Boolean) dirtyProperties.get(key)).booleanValue(); + return dirtyProperties.get(key).booleanValue(); } // private String format( String string ) @@ -3303,9 +3319,8 @@ private String isValidValue(String value) { private String isValidValue(Expression expression) { if (expression == null) { return isValidValue(null, null); - } else { - return isValidValue(expression.getStringExpression(), expression.getType()); } + return isValidValue(expression.getStringExpression(), expression.getType()); } private String isValidValue(String value, String exprType) { @@ -3510,7 +3525,7 @@ private String convertNullString(String str) { } private boolean containValue(SelectionChoice selectedChoice, String newValue, String property) { - for (Iterator iter = choiceList.iterator(); iter.hasNext();) { + for (Iterator iter = choiceList.iterator(); iter.hasNext();) { SelectionChoice choice = (SelectionChoice) iter.next(); if (choice != selectedChoice) { String value = null; @@ -3593,7 +3608,7 @@ private boolean canBeBlank() { // getSelectedControlType( ) ) ) { if (dirtyProperties.containsKey(CHECKBOX_ISREQUIRED)) { - canBeBlank = !(((Boolean) dirtyProperties.get(CHECKBOX_ISREQUIRED)).booleanValue()); + canBeBlank = !(dirtyProperties.get(CHECKBOX_ISREQUIRED).booleanValue()); } else { canBeBlank = !(inputParameter.isRequired()); } @@ -3604,7 +3619,7 @@ private boolean canBeBlank() { private boolean canBeNull() { boolean canBeNull = true; if (dirtyProperties.containsKey(CHECKBOX_ISREQUIRED)) { - canBeNull = !(((Boolean) dirtyProperties.get(CHECKBOX_ISREQUIRED)).booleanValue()); + canBeNull = !(dirtyProperties.get(CHECKBOX_ISREQUIRED).booleanValue()); } else { canBeNull = !(inputParameter.isRequired()); } @@ -3633,7 +3648,7 @@ private String getExpression(String columnName) { if (columnName.equals(NONE_DISPLAY_TEXT)) { return null; } - for (Iterator iter = columnList.iterator(); iter.hasNext();) { + for (Iterator iter = columnList.iterator(); iter.hasNext();) { ResultSetColumnHandle cachedColumn = (ResultSetColumnHandle) iter.next(); if (cachedColumn.getColumnName().equals(columnName)) { return DEUtil.getExpression(cachedColumn); @@ -3647,7 +3662,7 @@ private String getExpression(Control control, String columnName) { if (columnName.equals(NONE_DISPLAY_TEXT) || (columnList == null)) { return null; } - for (Iterator iter = columnList.iterator(); iter.hasNext();) { + for (Iterator iter = columnList.iterator(); iter.hasNext();) { ResultSetColumnHandle cachedColumn = (ResultSetColumnHandle) iter.next(); if (cachedColumn.getColumnName().equals(columnName)) { IExpressionConverter converter = ExpressionButtonUtil.getCurrentExpressionConverter(control); @@ -3659,7 +3674,7 @@ private String getExpression(Control control, String columnName) { } private String getColumnName(String expression) { - for (Iterator iter = columnList.iterator(); iter.hasNext();) { + for (Iterator iter = columnList.iterator(); iter.hasNext();) { ResultSetColumnHandle cachedColumn = (ResultSetColumnHandle) iter.next(); if (DEUtil.getExpression(cachedColumn).equals(expression)) { return cachedColumn.getColumnName(); @@ -3671,7 +3686,7 @@ private String getColumnName(String expression) { private String getColumnName(Control control, String expression) { IExpressionConverter converter = ExpressionButtonUtil.getCurrentExpressionConverter(control); - for (Iterator iter = columnList.iterator(); iter.hasNext();) { + for (Iterator iter = columnList.iterator(); iter.hasNext();) { ResultSetColumnHandle cachedColumn = (ResultSetColumnHandle) iter.next(); if (ExpressionUtility.getExpression(cachedColumn, converter).equals(expression)) { return cachedColumn.getColumnName(); @@ -3690,9 +3705,8 @@ private String validateChoice(SelectionChoice choice, String displayLabelKey, St if (distinct.isEnabled() && distinct.getSelection()) { if (containValue(choice, displayLabelKey, COLUMN_DISPLAY_TEXT_KEY)) { return ERROR_MSG_DUPLICATED_LABELKEY; - } else { - return null; } + return null; } if (containValue(choice, value, COLUMN_VALUE)) { return ERROR_MSG_DUPLICATED_VALUE; @@ -3897,7 +3911,7 @@ public ParameterDataSetExpressionProvider(DesignElementHandle handle) { * getCategoryList() */ @Override - protected List getCategoryList() { + protected List getCategoryList() { ArrayList categoryList = (ArrayList) super.getCategoryList(); if (categoryList != null && !categoryList.contains(DATASETS)) { if (elementHandle.getModuleHandle() instanceof ReportDesignHandle diff --git a/model/org.eclipse.birt.report.model.adapter.oda/src/org/eclipse/birt/report/model/adapter/oda/impl/AbstractReportParameterAdapter.java b/model/org.eclipse.birt.report.model.adapter.oda/src/org/eclipse/birt/report/model/adapter/oda/impl/AbstractReportParameterAdapter.java index 0601573b568..574bea4cf47 100644 --- a/model/org.eclipse.birt.report.model.adapter.oda/src/org/eclipse/birt/report/model/adapter/oda/impl/AbstractReportParameterAdapter.java +++ b/model/org.eclipse.birt.report.model.adapter.oda/src/org/eclipse/birt/report/model/adapter/oda/impl/AbstractReportParameterAdapter.java @@ -34,9 +34,9 @@ import org.eclipse.birt.report.model.api.SelectionChoiceHandle; import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; -import org.eclipse.birt.report.model.api.elements.structures.OdaDataSetParameter; +import org.eclipse.birt.report.model.api.elements.structures.DataSetParameter; import org.eclipse.birt.report.model.api.util.StringUtil; -import org.eclipse.birt.report.model.elements.interfaces.IAbstractScalarParameterModel; +import org.eclipse.birt.report.model.elements.interfaces.IInternalAbstractScalarParameterModel; import org.eclipse.birt.report.model.elements.interfaces.IScalarParameterModel; import org.eclipse.datatools.connectivity.oda.design.DataElementAttributes; import org.eclipse.datatools.connectivity.oda.design.DataElementUIHints; @@ -111,7 +111,7 @@ protected void updateLinkedReportParameterFromROMParameter(AbstractScalarParamet // should not convert report parameter name here. - Object defaultValue = dataSetParam.getExpressionProperty(OdaDataSetParameter.DEFAULT_VALUE_MEMBER).getValue(); + Object defaultValue = dataSetParam.getExpressionProperty(DataSetParameter.DEFAULT_VALUE_MEMBER).getValue(); String paramName = dataSetParam.getParamName(); if (StringUtil.isBlank(paramName)) { @@ -204,12 +204,10 @@ protected void updateAbstractScalarParameter(AbstractScalarParameterHandle repor * Returns the matched ODA data set parameter by the given ROM data set * parameter and data set design. * - * @param param the ROM data set parameter + * @param param the ROM data set parameter * @param odaParams - * @param dataSetDesign the oda data set design - * @return the matched ODA parameter defintion + * @return the matched ODA parameter definition */ - protected static ParameterDefinition getValidParameterDefinition(OdaDataSetParameterHandle param, DataSetParameters odaParams) { if (param == null || odaParams == null || odaParams.getParameterDefinitions().isEmpty()) { @@ -532,7 +530,7 @@ protected InputParameterAttributes updateInputElementAttrs(InputParameterAttribu inputAttrs.setOptional(getReportParamAllowMumble(paramHandle, ALLOW_BLANK_PROP_NAME)); ScalarValueChoices staticChoices = null; - Iterator selectionList = paramHandle.choiceIterator(); + Iterator selectionList = paramHandle.choiceIterator(); while (selectionList.hasNext()) { if (staticChoices == null) { staticChoices = designFactory.createScalarValueChoices(); @@ -554,8 +552,10 @@ protected InputParameterAttributes updateInputElementAttrs(InputParameterAttribu } inputAttrs.setStaticValueChoices(staticChoices); - ExpressionHandle valueExpr = paramHandle.getExpressionProperty(IAbstractScalarParameterModel.VALUE_EXPR_PROP); - ExpressionHandle labelExpr = paramHandle.getExpressionProperty(IAbstractScalarParameterModel.LABEL_EXPR_PROP); + ExpressionHandle valueExpr = paramHandle + .getExpressionProperty(IInternalAbstractScalarParameterModel.VALUE_EXPR_PROP); + ExpressionHandle labelExpr = paramHandle + .getExpressionProperty(IInternalAbstractScalarParameterModel.LABEL_EXPR_PROP); DynamicValuesQuery valueQuery = updateDynamicValueQuery(paramHandle.getDataSet(), valueExpr.getValue(), labelExpr.getValue(), dataSetDesign, @@ -590,7 +590,7 @@ protected DynamicValuesQuery updateDynamicValueQuery(DataSetHandle setHandle, Ob valueQuery = designFactory.createDynamicValuesQuery(); if (dataSetDesign != null) { - DataSetDesign targetDataSetDesign = (DataSetDesign) EcoreUtil.copy(dataSetDesign); + DataSetDesign targetDataSetDesign = EcoreUtil.copy(dataSetDesign); if (!setHandle.getName().equals(dataSetDesign.getName())) { targetDataSetDesign = new ModelOdaAdapter().createDataSetDesign((OdaDataSetHandle) setHandle); } @@ -609,11 +609,11 @@ protected DynamicValuesQuery updateDynamicValueQuery(DataSetHandle setHandle, Ob } /** - * @param inputAttrs - * @param inputParamAttrs - * @param paramHandle + * Update default static values + * + * @param inputAttrs attributes of the input element + * @param paramHandle parameter handle */ - protected void updateDefaultStaticValues(InputElementAttributes inputAttrs, AbstractScalarParameterHandle paramHandle) { // update default values. diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/AbstractScalarParameterHandleImpl.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/AbstractScalarParameterHandleImpl.java index c5f4e8004d4..9ace742a24e 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/AbstractScalarParameterHandleImpl.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/AbstractScalarParameterHandleImpl.java @@ -323,7 +323,7 @@ public void setDataSet(DataSetHandle handle) throws SemanticException { * @see org.eclipse.birt.report.model.api.elements.structures.SelectionChoice */ - public Iterator choiceIterator() { + public Iterator choiceIterator() { PropertyHandle propHandle = getPropertyHandle(SELECTION_LIST_PROP); return propHandle.iterator(); } @@ -373,7 +373,6 @@ public void setDefaultValueList(List defaultValueList) throws * * @return the default value */ - public List getDefaultValueList() { return getListProperty(DEFAULT_VALUE_PROP); } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ScalarParameterHandle.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ScalarParameterHandle.java index f69407e6985..3ad4fad1df2 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ScalarParameterHandle.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ScalarParameterHandle.java @@ -25,7 +25,7 @@ import org.eclipse.birt.report.model.api.metadata.IPropertyType; import org.eclipse.birt.report.model.core.DesignElement; import org.eclipse.birt.report.model.core.Module; -import org.eclipse.birt.report.model.elements.interfaces.IAbstractScalarParameterModel; +import org.eclipse.birt.report.model.elements.interfaces.IInternalAbstractScalarParameterModel; import org.eclipse.birt.report.model.elements.interfaces.IScalarParameterModel; import org.eclipse.birt.report.model.metadata.MetaDataDictionary; import org.eclipse.birt.report.model.metadata.PropertyDefn; @@ -335,7 +335,7 @@ public void setCategory(String category) throws SemanticException { */ public String getControlType() { - return getStringProperty(IAbstractScalarParameterModel.CONTROL_TYPE_PROP); + return getStringProperty(IInternalAbstractScalarParameterModel.CONTROL_TYPE_PROP); } /** @@ -376,7 +376,7 @@ public int getListlimit() { */ public void setControlType(String controlType) throws SemanticException { - setStringProperty(IAbstractScalarParameterModel.CONTROL_TYPE_PROP, controlType); + setStringProperty(IInternalAbstractScalarParameterModel.CONTROL_TYPE_PROP, controlType); } /** @@ -596,7 +596,7 @@ public void setType(String type) throws SemanticException { * @return a list containing the bound columns. */ - public Iterator columnBindingsIterator() { + public Iterator columnBindingsIterator() { PropertyHandle propHandle = getPropertyHandle(BOUND_DATA_COLUMNS_PROP); return propHandle.iterator(); } @@ -618,7 +618,6 @@ public PropertyHandle getColumnBindings() { * @param inForce true the column is added to the list regardless * of duplicate expression. false do not add the * column if the expression already exist - * @param column the bound column * @return the newly created ComputedColumnHandle or the existed * ComputedColumnHandle in the list * @throws SemanticException if expression is not duplicate but the name @@ -626,13 +625,12 @@ public PropertyHandle getColumnBindings() { * both name/expression are duplicate, but * inForce is true. */ - public ComputedColumnHandle addColumnBinding(ComputedColumn addColumn, boolean inForce) throws SemanticException { if (addColumn == null) { return null; } - List columns = (List) getProperty(BOUND_DATA_COLUMNS_PROP); + List columns = (List) getProperty(BOUND_DATA_COLUMNS_PROP); if (columns == null) { return (ComputedColumnHandle) getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn); } diff --git a/viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/api/ParameterDefinition.java b/viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/api/ParameterDefinition.java index 059d170308b..992e44c11d7 100644 --- a/viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/api/ParameterDefinition.java +++ b/viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/api/ParameterDefinition.java @@ -22,28 +22,49 @@ public class ParameterDefinition { // These are copied from IScalarParameterDefinition... + + /** property: text box key */ public static final int TEXT_BOX = 0; + /** property: list box key */ public static final int LIST_BOX = 1; + /** property: radio button */ public static final int RADIO_BUTTON = 2; + /** property: check box key */ public static final int CHECK_BOX = 3; + /** property: text alignment auto */ public static final int AUTO = 0; + /** property: text alignment left */ public static final int LEFT = 1; + /** property: text alignment center */ public static final int CENTER = 2; + /** property: text alignment right */ public static final int RIGHT = 3; + /** property: parameter data type any */ public static final int TYPE_ANY = 0; + /** property: parameter data type string */ public static final int TYPE_STRING = 1; + /** property: parameter data type float */ public static final int TYPE_FLOAT = 2; + /** property: parameter data type decimal */ public static final int TYPE_DECIMAL = 3; + /** property: parameter data type date time */ public static final int TYPE_DATE_TIME = 4; + /** property: parameter data type boolean */ public static final int TYPE_BOOLEAN = 5; + /** property: parameter data type integer */ public static final int TYPE_INTEGER = 6; + /** property: parameter data type date */ public static final int TYPE_DATE = 7; + /** property: parameter data type time */ public static final int TYPE_TIME = 8; + /** property: parameter selection list none */ public static final int SELECTION_LIST_NONE = 0; + /** property: parameter selection list dynamic */ public static final int SELECTION_LIST_DYNAMIC = 1; + /** property: parameter selection list static */ public static final int SELECTION_LIST_STATIC = 2; private long id; @@ -86,13 +107,38 @@ public class ParameterDefinition { private ParameterGroupDefinition group; - private Collection selectionList; + private Collection selectionList; + /** + * Constructor to define the parameter object + * + * @param id parameter id + * @param name parameter name + * @param category parameter category + * @param pattern parameter patter + * @param displayFormat parameter display format + * @param displayName parameter display name + * @param helpText parameter help text + * @param promptText parameter prompt text + * @param dataType parameter data type + * @param valueExpr parameter value expression + * @param controlType parameter control type + * @param hidden parameter hidden property + * @param allowNull parameter allow null value + * @param allowBlank parameter allow blank + * @param isRequired parameter is required + * @param mustMatch parameter must be match + * @param concealValue parameter conceal value + * @param distinct parameter distinct + * @param isMultiValue parameter can have multiple values + * @param group parameter group + * @param selectionList parameter selection list + */ public ParameterDefinition(long id, String name, String category, String pattern, String displayFormat, String displayName, String helpText, String promptText, int dataType, String valueExpr, int controlType, boolean hidden, boolean allowNull, boolean allowBlank, boolean isRequired, boolean mustMatch, boolean concealValue, - boolean distinct, boolean isMultiValue, ParameterGroupDefinition group, Collection selectionList) { + boolean distinct, boolean isMultiValue, ParameterGroupDefinition group, Collection selectionList) { this.id = id; this.name = name; this.category = category; @@ -123,53 +169,110 @@ public long getId() { return id; } + /** + * Get the parameter name + * + * @return Return the parameter name + */ public String getName() { return name; } + /** + * Get the parameter category + * + * @return Return the parameter category + */ public String getCategory() { return category; } + /** + * Get the parameter pattern + * + * @return Return the parameter pattern + */ public String getPattern() { return pattern; } + /** + * Get the parameter display format + * + * @return Return the parameter display format + */ public String getDisplayFormat() { return displayFormat; } + /** + * Get the parameter display name + * + * @return Return the parameter display name + */ public String getDisplayName() { return displayName; } + /** + * Get the parameter help text + * + * @return Return the parameter help text + */ public String getHelpText() { return helpText; } + /** + * Get the parameter prompt text + * + * @return Return the parameter prompt text + */ public String getPromptText() { return promptText; } + /** + * Get the parameter data type + * + * @return Return the parameter data type + */ public int getDataType() { return dataType; } + /** + * Get the parameter value expression + * + * @return Return the parameter value expression + */ public String getValueExpr() { return valueExpr; } + /** + * Get the parameter control type + * + * @return Return the parameter control type + */ public int getControlType() { return controlType; } + /** + * Get the parameter is hidden + * + * @return Return the parameter hidden flag + */ public boolean isHidden() { return hidden; } /** + * Get the allow null value flag + * * @deprecated - * @return + * @return Return the allow null value flag */ @Deprecated public boolean allowNull() { @@ -177,42 +280,76 @@ public boolean allowNull() { } /** + * Get the allow blank value flag + * * @deprecated - * @return + * @return Return the allow blank value flag */ @Deprecated public boolean allowBlank() { return allowBlank; } + /** + * Get the required flag + * + * @return Return the required flag + */ public boolean isRequired() { return isRequired; } + /** + * Get the must match flag + * + * @return Return the must match flag + */ public boolean mustMatch() { return mustMatch; } + /** + * Get the parameter conceal value + * + * @return Return the parameter conceal value + */ public boolean concealValue() { return concealValue; } + /** + * Get the parameter distinct flag + * + * @return Return the parameter distinct flag + */ public boolean isDistinct() { return distinct; } /** + * Is parameter with multiple value flag + * * @return the isMultiValue */ public boolean isMultiValue() { return isMultiValue; } + /** + * Get the parameter group + * + * @return Return the parameter group + */ public ParameterGroupDefinition getGroup() { return group; } - public Collection getSelectionList() { + /** + * Get the parameter selection list + * + * @return Return the parameter selecton list + */ + public Collection getSelectionList() { return selectionList; }