|
|
|
@ -8,16 +8,23 @@ import com.fr.base.GraphHelper;
|
|
|
|
|
import com.fr.base.ScreenResolution; |
|
|
|
|
import com.fr.base.background.ColorBackground; |
|
|
|
|
import com.fr.chart.chartglyph.Marker; |
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.plugin.chart.ConfigHelper; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.general.FRFont; |
|
|
|
|
import com.fr.plugin.chart.ConfigHelper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import javax.swing.DefaultComboBoxModel; |
|
|
|
|
import javax.swing.JLabel; |
|
|
|
|
import javax.swing.JList; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.Font; |
|
|
|
|
import java.awt.FontMetrics; |
|
|
|
|
import java.awt.Graphics; |
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Combobox for selecting marker. |
|
|
|
@ -53,32 +60,39 @@ public class MarkerComboBox extends UIComboBox {
|
|
|
|
|
* CellRenderer. |
|
|
|
|
*/ |
|
|
|
|
class MarkerCellRenderer extends UIComboBoxRenderer { |
|
|
|
|
|
|
|
|
|
private Marker marker = null; |
|
|
|
|
private boolean isSelected = false; |
|
|
|
|
|
|
|
|
|
public Component getListCellRendererComponent(JList list, |
|
|
|
|
Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
|
|
|
this.marker = (Marker) value; |
|
|
|
|
this.isSelected = isSelected; |
|
|
|
|
|
|
|
|
|
return this; |
|
|
|
|
String text = null; |
|
|
|
|
if (marker != null) { |
|
|
|
|
boolean isAutoMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.AUTO_M); |
|
|
|
|
boolean isNullMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.NULL_M); |
|
|
|
|
if (isAutoMarker || isNullMarker) { |
|
|
|
|
text = isNullMarker |
|
|
|
|
? Toolkit.i18nText("Fine-Design_Report_None") |
|
|
|
|
: Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
JLabel comp = (JLabel) super.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus); |
|
|
|
|
return comp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void paint(Graphics g) { |
|
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
|
|
|
|
|
|
Dimension d = getSize(); |
|
|
|
|
g2d.setColor(Color.black); |
|
|
|
|
g2d.setFont(FRContext.getDefaultValues().getFRFont()); |
|
|
|
|
|
|
|
|
|
if (marker != null) { |
|
|
|
|
boolean isAutoMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.AUTO_M); |
|
|
|
|
boolean isNullMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.NULL_M); |
|
|
|
|
|
|
|
|
|
if (isAutoMarker || isNullMarker) { |
|
|
|
|
String text = isNullMarker |
|
|
|
|
?Toolkit.i18nText("Fine-Design_Report_None") |
|
|
|
|
:Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); |
|
|
|
|
|
|
|
|
|
paintTextMarker(g2d, d, text); |
|
|
|
|
super.paint(g); |
|
|
|
|
} else { |
|
|
|
|
g2d.setColor(Color.black); |
|
|
|
|
if (marker.getBackground() == null) { |
|
|
|
|
marker.setBackground(ColorBackground.getInstance(Color.black)); |
|
|
|
|
} |
|
|
|
@ -100,8 +114,6 @@ public class MarkerComboBox extends UIComboBox {
|
|
|
|
|
return getPreferredSize(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Marker marker = null; |
|
|
|
|
private boolean isSelected = false; |
|
|
|
|
|
|
|
|
|
private void paintTextMarker(Graphics2D g2d, Dimension d, String text) { |
|
|
|
|
g2d.setColor(Color.black); |
|
|
|
|