forked from fanruan/design
29 changed files with 170 additions and 107 deletions
@ -0,0 +1,40 @@ |
|||||||
|
package com.fr.plugin.chart.designer.component.format; |
||||||
|
|
||||||
|
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.style.FormatPane; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by mengao on 2017/8/14. |
||||||
|
*/ |
||||||
|
public class DataSheetFormatPane extends FormatPane { |
||||||
|
protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) { |
||||||
|
return new Component[][]{ |
||||||
|
new Component[]{null, centerPane}, |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
protected void setTypeComboBoxPane(UIComboBox typeComboBox) { |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double[] rowSize = {p, p}; |
||||||
|
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
||||||
|
double[] columnSize = {f, e}; |
||||||
|
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getTypeComboBoxComponent(typeComboBox), rowSize, columnSize); |
||||||
|
this.add(panel, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
protected Component[][] getTypeComboBoxComponent (UIComboBox typeComboBox) { |
||||||
|
return new Component[][]{ |
||||||
|
new Component[]{null, null}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_DataType"), SwingConstants.LEFT), typeComboBox}, |
||||||
|
|
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -1,40 +1,32 @@ |
|||||||
package com.fr.plugin.chart.designer.component.format; |
package com.fr.plugin.chart.designer.component.format; |
||||||
|
|
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.gui.style.FormatPane; |
import com.fr.design.gui.style.FormatPane; |
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
|
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by mengao on 2017/8/14. |
* Created by mengao on 2017/8/28. |
||||||
*/ |
*/ |
||||||
public class VanChartFormatPane extends FormatPane { |
public class VanChartFormatPane extends FormatPane { |
||||||
protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) { |
private static final int HEIGHT = 30; |
||||||
return new Component[][]{ |
|
||||||
new Component[]{null, centerPane}, |
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
protected void setTypeComboBoxPane(UIComboBox typeComboBox) { |
|
||||||
double f = TableLayout.FILL; |
|
||||||
double p = TableLayout.PREFERRED; |
|
||||||
double[] rowSize = {p, p}; |
|
||||||
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; |
|
||||||
double[] columnSize = {f, e}; |
|
||||||
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getTypeComboBoxComponent(typeComboBox), rowSize, columnSize); |
|
||||||
this.add(panel, BorderLayout.NORTH); |
|
||||||
} |
|
||||||
|
|
||||||
protected Component[][] getTypeComboBoxComponent (UIComboBox typeComboBox) { |
protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { |
||||||
return new Component[][]{ |
return new Component[][]{ |
||||||
new Component[]{null, null}, |
new Component[]{null, null}, |
||||||
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_DataType"), SwingConstants.LEFT), typeComboBox}, |
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format"), SwingConstants.LEFT), typePane}, |
||||||
|
new Component[]{centerPane, null}, |
||||||
}; |
}; |
||||||
} |
} |
||||||
|
|
||||||
|
public Dimension getPreferredSize() { |
||||||
|
//todo @mango
|
||||||
|
if (getTypeComboBox().getSelectedIndex() == 0) { |
||||||
|
return new Dimension((int)getTypeComboBox().getPreferredSize().getWidth(), HEIGHT); |
||||||
|
} |
||||||
|
return super.getPreferredSize(); |
||||||
|
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue