Qinghui.Liu
4 years ago
8 changed files with 222 additions and 293 deletions
@ -1,123 +0,0 @@ |
|||||||
package com.fr.van.chart.box.data; |
|
||||||
|
|
||||||
import com.fr.chart.base.ChartConstants; |
|
||||||
import com.fr.chart.chartattr.ChartCollection; |
|
||||||
import com.fr.chart.chartdata.NormalTableDataDefinition; |
|
||||||
import com.fr.chart.chartdata.TableDataDefinition; |
|
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; |
|
||||||
import com.fr.general.ComparatorUtils; |
|
||||||
import com.fr.plugin.chart.box.data.VanBoxTableDefinitionHelper; |
|
||||||
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition; |
|
||||||
import com.fr.stable.ArrayUtils; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
|
|
||||||
import javax.swing.ComboBoxModel; |
|
||||||
|
|
||||||
public class BoxPlotDataContentPaneHelp { |
|
||||||
|
|
||||||
public static void populateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) { |
|
||||||
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
|
||||||
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
|
||||||
|
|
||||||
if (detailedDefinition != null) { |
|
||||||
dataScreeningPane.populateDefinition(detailedDefinition, false); |
|
||||||
} else if (resultDefinition != null) { |
|
||||||
dataScreeningPane.populateDefinition(resultDefinition, false); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static void updateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) { |
|
||||||
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
|
||||||
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
|
||||||
|
|
||||||
if (detailedDefinition != null) { |
|
||||||
dataScreeningPane.updateDefinition(detailedDefinition); |
|
||||||
} |
|
||||||
|
|
||||||
if (resultDefinition != null) { |
|
||||||
dataScreeningPane.updateDefinition(resultDefinition); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static void updateCategoryPane(UIComboBox categoryCombox, ChartCollection collection, boolean isDetailed) { |
|
||||||
Object categoryName = categoryCombox.getSelectedItem(); |
|
||||||
|
|
||||||
TableDataDefinition dataDefinition; |
|
||||||
|
|
||||||
if (isDetailed) { |
|
||||||
dataDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
|
||||||
|
|
||||||
if (dataDefinition == null) { |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
if (ArrayUtils.contains(ChartConstants.getNoneKeys(), categoryName)) { |
|
||||||
((NormalTableDataDefinition) dataDefinition).setCategoryName(StringUtils.EMPTY); |
|
||||||
} else { |
|
||||||
((NormalTableDataDefinition) dataDefinition).setCategoryName(categoryName == null ? null : categoryName.toString()); |
|
||||||
} |
|
||||||
} else { |
|
||||||
dataDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
|
||||||
|
|
||||||
if (dataDefinition == null) { |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
if (ArrayUtils.contains(ChartConstants.getNoneKeys(), categoryName)) { |
|
||||||
((VanBoxTableResultDefinition) dataDefinition).setCategoryName(StringUtils.EMPTY); |
|
||||||
} else { |
|
||||||
((VanBoxTableResultDefinition) dataDefinition).setCategoryName(categoryName == null ? null : categoryName.toString()); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static void populateCategoryPane(UIComboBox categoryCombox, ChartCollection collection, boolean isDetailed) { |
|
||||||
TableDataDefinition data; |
|
||||||
|
|
||||||
if (isDetailed) { |
|
||||||
data = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); |
|
||||||
|
|
||||||
if (data == null) { |
|
||||||
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
|
||||||
} else { |
|
||||||
populateCategoryItem(categoryCombox, ((NormalTableDataDefinition) data).getCategoryName()); |
|
||||||
} |
|
||||||
} else { |
|
||||||
data = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection); |
|
||||||
|
|
||||||
if (data == null) { |
|
||||||
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
|
||||||
} else { |
|
||||||
populateCategoryItem(categoryCombox, ((VanBoxTableResultDefinition) data).getCategoryName()); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static void populateCategoryItem(UIComboBox categoryCombox, Object item) { |
|
||||||
if (ComparatorUtils.equals(item, StringUtils.EMPTY)) { |
|
||||||
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); |
|
||||||
} else if (!boxItemsContainsObject(categoryCombox, item)) { |
|
||||||
categoryCombox.setSelectedItem(null); |
|
||||||
} else { |
|
||||||
categoryCombox.setSelectedItem(item); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static boolean boxItemsContainsObject(UIComboBox box, Object item) { |
|
||||||
if (box == null) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
ComboBoxModel dataModel = box.getModel(); |
|
||||||
|
|
||||||
for (int i = 0; i < dataModel.getSize(); i++) { |
|
||||||
if (ComparatorUtils.equals(dataModel.getElementAt(i), item)) { |
|
||||||
return true; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue