|
|
@ -1,8 +1,5 @@ |
|
|
|
package com.fr.design.gui.style; |
|
|
|
package com.fr.design.gui.style; |
|
|
|
|
|
|
|
|
|
|
|
import com.fine.swing.ui.layout.Column; |
|
|
|
|
|
|
|
import com.fine.swing.ui.layout.Layouts; |
|
|
|
|
|
|
|
import com.fine.swing.ui.layout.Row; |
|
|
|
|
|
|
|
import com.fine.theme.utils.FineUIUtils; |
|
|
|
import com.fine.theme.utils.FineUIUtils; |
|
|
|
import com.fr.base.CoreDecimalFormat; |
|
|
|
import com.fr.base.CoreDecimalFormat; |
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
import com.fr.base.GraphHelper; |
|
|
@ -16,7 +13,6 @@ import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
|
import com.fr.design.gui.core.ReactiveCardPane; |
|
|
|
|
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
import com.fr.design.gui.icombobox.TextFontComboBox; |
|
|
|
import com.fr.design.gui.icombobox.TextFontComboBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
@ -43,9 +39,11 @@ import java.math.RoundingMode; |
|
|
|
import java.text.Format; |
|
|
|
import java.text.Format; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.Cell; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.column; |
|
|
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
|
|
|
|
import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; |
|
|
|
|
|
|
|
import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author Starryi |
|
|
|
* @author Starryi |
|
|
@ -79,7 +77,6 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName |
|
|
|
private boolean isRightFormat; |
|
|
|
private boolean isRightFormat; |
|
|
|
private boolean isDate = false; |
|
|
|
private boolean isDate = false; |
|
|
|
private GlobalNameListener globalNameListener = null; |
|
|
|
private GlobalNameListener globalNameListener = null; |
|
|
|
protected ReactiveCardPane cardPane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public TextFormatPane() { |
|
|
|
public TextFormatPane() { |
|
|
|
|
|
|
|
|
|
|
@ -89,6 +86,10 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName |
|
|
|
initPreviewLabel4GeneralFormat(); |
|
|
|
initPreviewLabel4GeneralFormat(); |
|
|
|
|
|
|
|
|
|
|
|
initLayout(); |
|
|
|
initLayout(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTextFieldVisible(false); |
|
|
|
|
|
|
|
setRoundingBoxVisible(false); |
|
|
|
|
|
|
|
setPreviewLabelVisible(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initFormatTypesComboBox() { |
|
|
|
private void initFormatTypesComboBox() { |
|
|
@ -136,43 +137,33 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName |
|
|
|
|
|
|
|
|
|
|
|
protected void initLayout() { |
|
|
|
protected void initLayout() { |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
cardPane = ReactiveCardPane.create() |
|
|
|
this.add(column(LayoutConstants.VERTICAL_GAP, |
|
|
|
.addSupplier("normal", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, |
|
|
|
row( |
|
|
|
createTypeRow() |
|
|
|
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"))).weight(LEFT_WEIGHT), |
|
|
|
).getComponent()) |
|
|
|
cell(typeComboBox).weight(RIGHT_WEIGHT) |
|
|
|
.addSupplier("preview", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, |
|
|
|
), |
|
|
|
createTypeRow(), |
|
|
|
cell(textField), |
|
|
|
createPreviewRow() |
|
|
|
row( |
|
|
|
).getComponent()) |
|
|
|
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"))).weight(LEFT_WEIGHT), |
|
|
|
.addSupplier("previewAndCheck", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, |
|
|
|
cell(roundingBox).weight(RIGHT_WEIGHT) |
|
|
|
createTypeRow(), |
|
|
|
), |
|
|
|
createPreviewRow(), |
|
|
|
cell(previewLabel) |
|
|
|
createRoundBoxRow() |
|
|
|
).getComponent()); |
|
|
|
).getComponent()); |
|
|
|
|
|
|
|
cardPane.select("normal").populate(); |
|
|
|
|
|
|
|
this.add(cardPane); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Cell<Row> createTypeRow() { |
|
|
|
protected void setTextFieldVisible(boolean visible) { |
|
|
|
return row( |
|
|
|
textField.setVisible(visible); |
|
|
|
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"))).weight(1.2), |
|
|
|
|
|
|
|
cell(typeComboBox).weight(3) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Cell<Row> createRoundBoxRow() { |
|
|
|
protected void setRoundingBoxVisible(boolean visible) { |
|
|
|
return row( |
|
|
|
roundingBox.getParent().setVisible(visible); |
|
|
|
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"))).weight(1.2), |
|
|
|
|
|
|
|
cell(roundingBox).with(it -> it.setBorder(null)).weight(3) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Cell<Row> createPreviewRow() { |
|
|
|
protected void setPreviewLabelVisible(boolean visible) { |
|
|
|
return row( |
|
|
|
previewLabel.setVisible(visible); |
|
|
|
cell(previewLabel).weight(1) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected UIComboBoxRenderer createComBoxRender() { |
|
|
|
protected UIComboBoxRenderer createComBoxRender() { |
|
|
|
return new UIComboBoxRenderer() { |
|
|
|
return new UIComboBoxRenderer() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -314,11 +305,6 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName |
|
|
|
return contents == FormatContents.TEXT || contents == FormatContents.NULL; |
|
|
|
return contents == FormatContents.TEXT || contents == FormatContents.NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean isRoundFormat() { |
|
|
|
|
|
|
|
int contents = getFormatContents(); |
|
|
|
|
|
|
|
return contents == FormatContents.PERCENT || contents == FormatContents.THOUSANDTHS; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Radio selection listener. |
|
|
|
* Radio selection listener. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -328,16 +314,16 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
if (e.getStateChange() == ItemEvent.SELECTED) { |
|
|
|
if (e.getStateChange() == ItemEvent.SELECTED) { |
|
|
|
int contents = getFormatContents(); |
|
|
|
int contents = getFormatContents(); |
|
|
|
Column contentContainer; |
|
|
|
|
|
|
|
if (!isTextOrNull()) { |
|
|
|
if (!isTextOrNull()) { |
|
|
|
textField.removeAllItems(); |
|
|
|
textField.removeAllItems(); |
|
|
|
String[] items = FormatField.getInstance().getFormatArray(contents, false); |
|
|
|
String[] items = FormatField.getInstance().getFormatArray(contents, false); |
|
|
|
textField.setItemArray(items); |
|
|
|
textField.setItemArray(items); |
|
|
|
textField.setSelectedIndex(0); |
|
|
|
textField.setSelectedIndex(0); |
|
|
|
cardPane.select(isRoundFormat() ? "previewAndCheck" : "preview").populate(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
cardPane.select("normal").populate(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setTextFieldVisible(!isTextOrNull()); |
|
|
|
|
|
|
|
setPreviewLabelVisible(!isTextOrNull()); |
|
|
|
|
|
|
|
setRoundingBoxVisible(getFormatContents() == FormatContents.PERCENT || getFormatContents() == FormatContents.THOUSANDTHS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|