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.
124 lines
4.4 KiB
124 lines
4.4 KiB
7 years ago
|
package com.fr.extended.chart;
|
||
|
|
||
|
import com.fr.chart.chartattr.Chart;
|
||
|
import com.fr.chart.chartattr.ChartCollection;
|
||
7 years ago
|
import com.fr.design.gui.ibutton.UIButtonGroup;
|
||
|
import com.fr.design.gui.ilable.UILabel;
|
||
7 years ago
|
import com.fr.design.gui.ispinner.UISpinner;
|
||
|
import com.fr.design.layout.TableLayout;
|
||
|
import com.fr.design.layout.TableLayoutHelper;
|
||
|
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
|
||
|
import com.fr.design.mainframe.chart.PaneTitleConstants;
|
||
|
import com.fr.general.Inter;
|
||
7 years ago
|
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
|
||
7 years ago
|
|
||
|
import javax.swing.JPanel;
|
||
7 years ago
|
import javax.swing.event.ChangeEvent;
|
||
|
import javax.swing.event.ChangeListener;
|
||
|
import java.awt.BorderLayout;
|
||
7 years ago
|
import java.awt.Component;
|
||
|
|
||
|
/**
|
||
|
* Created by shine on 2018/3/12.
|
||
|
*/
|
||
|
public class ExtendedOtherPane extends AbstractChartAttrPane {
|
||
|
|
||
|
private ExtendedChartHyperLinkPane hyperLinkPane;
|
||
7 years ago
|
private UIButtonGroup refreshEnabled;
|
||
7 years ago
|
private UISpinner autoRefreshTime;
|
||
7 years ago
|
private JPanel contentPane;
|
||
7 years ago
|
|
||
|
@Override
|
||
|
public void populate(ChartCollection collection) {
|
||
|
if (collection != null) {
|
||
|
Chart chart = collection.getSelectedChart();
|
||
|
if (chart != null && chart instanceof AbstractChart) {
|
||
|
hyperLinkPane.populateBean((AbstractChart) chart);
|
||
|
autoRefreshTime.setValue(((AbstractChart) chart).getAutoRefreshTime());
|
||
7 years ago
|
refreshEnabled.setSelectedIndex(((AbstractChart) chart).isRefreshEnabled() ? 0 : 1);
|
||
|
checkRefreshEnable();
|
||
7 years ago
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void update(ChartCollection collection) {
|
||
|
if (collection != null) {
|
||
|
Chart chart = collection.getSelectedChart();
|
||
|
if (chart != null && chart instanceof AbstractChart) {
|
||
|
hyperLinkPane.updateBean((AbstractChart) chart);
|
||
|
((AbstractChart) chart).setAutoRefreshTime(autoRefreshTime.getValue());
|
||
7 years ago
|
((AbstractChart) chart).setRefreshEnabled(refreshEnabled.getSelectedIndex() == 0);
|
||
7 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
7 years ago
|
private void checkRefreshEnable() {
|
||
|
contentPane.setVisible(refreshEnabled.getSelectedIndex() == 0);
|
||
|
}
|
||
|
|
||
7 years ago
|
@Override
|
||
|
protected JPanel createContentPane() {
|
||
|
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
|
||
|
double[] columnSize = {f, e};
|
||
|
double[] rowSize = {p, p, p, p, p, p};
|
||
|
|
||
|
Component[][] components = new Component[][]{
|
||
7 years ago
|
new Component[]{createRefreshPane(), null},
|
||
7 years ago
|
new Component[]{createHyperlinkPane(), null}
|
||
|
};
|
||
|
|
||
|
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String getIconPath() {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
7 years ago
|
private JPanel createRefreshPane() {
|
||
|
|
||
|
refreshEnabled = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Open"), Inter.getLocText("Plugin-ChartF_Close")});
|
||
|
refreshEnabled.addChangeListener(new ChangeListener() {
|
||
|
@Override
|
||
|
public void stateChanged(ChangeEvent e) {
|
||
|
checkRefreshEnable();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
autoRefreshTime = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
double[] columnSize = {p, f, 20};
|
||
|
double[] rowSize = {p};
|
||
|
|
||
|
Component[][] components = new Component[][]{
|
||
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Time_Interval")), autoRefreshTime, new UILabel(Inter.getLocText("Chart-Time_Seconds"))},
|
||
|
};
|
||
|
contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
|
||
|
|
||
|
JPanel panel = new JPanel(new BorderLayout(0,4));
|
||
|
panel.add(refreshEnabled, BorderLayout.NORTH);
|
||
|
panel.add(contentPane, BorderLayout.CENTER);
|
||
|
|
||
7 years ago
|
JPanel gapPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Inter.getLocText("FR-Design-Chart_Auto_Refresh"), panel);
|
||
7 years ago
|
|
||
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("Chart-Use_Refresh"), gapPane);
|
||
|
}
|
||
|
|
||
7 years ago
|
private JPanel createHyperlinkPane() {
|
||
|
hyperLinkPane = new ExtendedChartHyperLinkPane();
|
||
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("M_Insert-Hyperlink"), hyperLinkPane);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String title4PopupWindow() {
|
||
|
return PaneTitleConstants.CHART_OTHER_TITLE;
|
||
|
}
|
||
|
|
||
|
}
|