You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.6 KiB
85 lines
2.6 KiB
package com.fr.solution.plugin.chart.echarts.common.ui; |
|
|
|
import com.fr.design.dialog.BasicScrollPane; |
|
import com.fr.design.gui.icombobox.UIDictionaryComboBox; |
|
import com.fr.design.gui.ilable.UILabel; |
|
import com.fr.design.gui.itextfield.UITextField; |
|
import com.fr.design.layout.TableLayout; |
|
import com.fr.design.layout.TableLayoutHelper; |
|
import com.fr.general.Inter; |
|
import com.fr.solution.plugin.chart.echarts.common.base.AbstractECharts; |
|
import com.fr.solution.plugin.chart.echarts.common.tooltip.EChartsTooltip; |
|
import com.fr.solution.plugin.chart.echarts.common.tooltip.TriggerType; |
|
|
|
import javax.swing.JPanel; |
|
import java.awt.BorderLayout; |
|
import java.awt.Component; |
|
|
|
/** |
|
* Created by richie on 16/2/19. |
|
*/ |
|
public class EChartsTooltipPane extends BasicScrollPane<AbstractECharts> { |
|
|
|
private UIDictionaryComboBox<TriggerType> triggerComboBox; |
|
private UITextField formatterTextField; |
|
|
|
public EChartsTooltipPane(EChartsStylePane parent) { |
|
|
|
} |
|
|
|
@Override |
|
protected JPanel createContentPane() { |
|
JPanel panel = new JPanel(); |
|
double p = TableLayout.PREFERRED; |
|
double f = TableLayout.FILL; |
|
double[] rowSize = {p, p}; |
|
double[] columnSize = {p, f}; |
|
|
|
UILabel titleLabel = new UILabel("触发点"); |
|
|
|
triggerComboBox = new UIDictionaryComboBox<TriggerType>( |
|
new TriggerType[]{TriggerType.ITEM, TriggerType.AXIS}, |
|
new String[]{"图例", "坐标轴"}); |
|
|
|
UILabel formatterLabel = new UILabel("显示格式"); |
|
|
|
formatterTextField = new UITextField(12); |
|
|
|
JPanel cen = TableLayoutHelper.createTableLayoutPane(new Component[][] { |
|
{titleLabel, triggerComboBox}, |
|
{formatterLabel, formatterTextField} |
|
},rowSize, columnSize); |
|
panel.add(cen, BorderLayout.CENTER); |
|
|
|
return panel; |
|
} |
|
|
|
@Override |
|
public void populateBean(AbstractECharts ob) { |
|
if (ob == null) { |
|
return; |
|
} |
|
EChartsTooltip tooltip = ob.getTooltip(); |
|
if (tooltip == null) { |
|
return; |
|
} |
|
triggerComboBox.setSelectedItem(tooltip.getTriggerType()); |
|
formatterTextField.setText(tooltip.getFormat()); |
|
} |
|
|
|
@Override |
|
public void updateBean(AbstractECharts ob) { |
|
if (ob == null) { |
|
return; |
|
} |
|
EChartsTooltip tooltip = new EChartsTooltip(); |
|
tooltip.setTriggerType(triggerComboBox.getSelectedItem()); |
|
tooltip.setFormat(formatterTextField.getText()); |
|
ob.setTooltip(tooltip); |
|
} |
|
|
|
@Override |
|
protected String title4PopupWindow() { |
|
return Inter.getLocText("Plugin-ECharts_Tooltip"); |
|
} |
|
}
|
|
|