Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/feature/10.0)

* commit '079530d6a9afb8790ce37e8e829508232773add0':
  REPORT-19464 【匹配移动端】TAB下菜单式图标优化2
  REPORT-19462
  REPORT-19464 【匹配移动端】TAB下菜单式图标优化2
  REPORT-20328 sonar
  REPORT-19464 【匹配移动端】TAB下菜单式图标优化2
  REPORT-19464 【匹配移动端】TAB下菜单式图标优化2
  无jira任务,sonar问题修复
  REPORT-20868 sonar问题修复
  REPORT-20329 sonar问题修复
  无JIRA任务 抽象实体类,给SDK做准备
  无JIRA任务 修复编译错误
  删掉sdk
  冲突
  REPORT-19466 【匹配移动端】组件级控制选中等
  REPORT-19466 【匹配移动端】组件级控制选中等
  误传
  无JIRA任务 开放SDK对需要开放的类的标记
  REPORT-19468 【匹配移动端】H5超链标题显示处理
  REPORT-19465 【匹配移动端】模板级全局控制缩放等
research/11.0
vito 5 years ago
parent
commit
2bc3e3effa
  1. 3
      designer-base/src/main/java/com/fr/design/gui/UIDefaultTheme.java
  2. 3
      designer-base/src/main/java/com/fr/design/gui/autocomplete/LanguageAwareCompletionProvider.java
  3. 4
      designer-base/src/main/java/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java
  4. 2
      designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java
  5. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/ObjectUIControlPane.java
  6. 10
      designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java
  7. 1
      designer-base/src/main/java/com/fr/design/gui/demo/LoadingPaneDemo.java
  8. 1
      designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPaneTest.java
  9. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/UINumberSlidePane.java
  10. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java
  11. 51
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java
  12. 27
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  13. 14
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java
  14. 12
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  15. 22
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java
  16. 23
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  17. 4
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  18. 10
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  19. 29
      designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java
  20. 3
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  21. 6
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java
  22. 22
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  23. 11
      designer-form/src/main/java/com/fr/design/designer/creator/XWBorderLayout.java
  24. 31
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  25. 11
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  26. 3
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  27. 12
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  28. 5
      designer-form/src/main/java/com/fr/design/form/mobile/FormMobileOthersPane.java
  29. 31
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutBorderPane.java
  30. 6
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutBorderPreviewPane.java
  31. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java
  32. 40
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java
  33. 15
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java
  34. 40
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  35. 19
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java
  36. 92
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java
  37. 18
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java
  38. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentMarginPane.java
  39. 153
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  40. 12
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  41. 18
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java
  42. 20
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java
  43. 7
      designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java
  44. 5
      designer-sdk/pom.xml
  45. 80
      designer-sdk/src/main/java/com/fr/sdk/designer/FineDesignUtils.java
  46. 7
      designer-sdk/src/test/java/com/fr/sdk/FineDesignUtilsTest.java

3
designer-base/src/main/java/com/fr/design/gui/UIDefaultTheme.java

@ -76,7 +76,6 @@ public class UIDefaultTheme extends DefaultMetalTheme {
table.put("Table.background", ThemeUtils.TEXT_BG_COLOR); table.put("Table.background", ThemeUtils.TEXT_BG_COLOR);
table.put("Table.selectionForeground", ThemeUtils.NORMAL_FOREGROUND); table.put("Table.selectionForeground", ThemeUtils.NORMAL_FOREGROUND);
table.put("Table.selectionBackground", new ColorUIResource(200, 221, 233)); table.put("Table.selectionBackground", new ColorUIResource(200, 221, 233));
table.put("Table.gridColor", new ColorUIResource(200, 221, 233));
table.put("TableHeader.background", new ColorUIResource(229, 229, 229)); table.put("TableHeader.background", new ColorUIResource(229, 229, 229));
table.put("ProgressBar.foreground", ThemeUtils.PROCESS_COLOR); table.put("ProgressBar.foreground", ThemeUtils.PROCESS_COLOR);
table.put("ProgressBar.background", ThemeUtils.TEXT_BG_COLOR); table.put("ProgressBar.background", ThemeUtils.TEXT_BG_COLOR);
@ -85,7 +84,6 @@ public class UIDefaultTheme extends DefaultMetalTheme {
table.put("ProgressBar.selectionForeground", ThemeUtils.NORMAL_FOREGROUND); table.put("ProgressBar.selectionForeground", ThemeUtils.NORMAL_FOREGROUND);
table.put("ProgressBar.selectionBackground", ThemeUtils.NORMAL_FOREGROUND); table.put("ProgressBar.selectionBackground", ThemeUtils.NORMAL_FOREGROUND);
table.put("PopupMenu.background", ThemeUtils.NORMAL_BG); table.put("PopupMenu.background", ThemeUtils.NORMAL_BG);
table.put("TabbedPane.background", ThemeUtils.TEXT_BG_COLOR);
table.put("TabbedPane.background", ThemeUtils.NORMAL_BG); table.put("TabbedPane.background", ThemeUtils.NORMAL_BG);
table.put("TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 0)); table.put("TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 0));
table.put("TabbedPane.tabInsets", new InsetsUIResource(1, 6, 4, 6)); table.put("TabbedPane.tabInsets", new InsetsUIResource(1, 6, 4, 6));
@ -108,7 +106,6 @@ public class UIDefaultTheme extends DefaultMetalTheme {
table.put("ComboBox.foreground", ThemeUtils.NORMAL_FOREGROUND); table.put("ComboBox.foreground", ThemeUtils.NORMAL_FOREGROUND);
table.put("ComboBox.background", ThemeUtils.TEXT_BG_COLOR); table.put("ComboBox.background", ThemeUtils.TEXT_BG_COLOR);
table.put("ComboBox.disabledBackground", ThemeUtils.TEXT_DISABLED_BG_COLOR); table.put("ComboBox.disabledBackground", ThemeUtils.TEXT_DISABLED_BG_COLOR);
table.put("EditorPane.background", ThemeUtils.TEXT_BG_COLOR);
table.put("EditorPane.foreground", ThemeUtils.NORMAL_FOREGROUND); table.put("EditorPane.foreground", ThemeUtils.NORMAL_FOREGROUND);
table.put("PasswordField.background", ThemeUtils.TEXT_BG_COLOR); table.put("PasswordField.background", ThemeUtils.TEXT_BG_COLOR);
table.put("PasswordField.foreground", ThemeUtils.NORMAL_FOREGROUND); table.put("PasswordField.foreground", ThemeUtils.NORMAL_FOREGROUND);

3
designer-base/src/main/java/com/fr/design/gui/autocomplete/LanguageAwareCompletionProvider.java

@ -195,6 +195,9 @@ public class LanguageAwareCompletionProvider extends CompletionProviderBase
// provider. We do not do function/method completions while editing // provider. We do not do function/method completions while editing
// strings or comments. // strings or comments.
CompletionProvider provider = getProviderFor(tc); CompletionProvider provider = getProviderFor(tc);
if (provider == null) {
return null;
}
return provider==defaultProvider ? return provider==defaultProvider ?
provider.getParameterizedCompletions(tc) : null; provider.getParameterizedCompletions(tc) : null;
} }

4
designer-base/src/main/java/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java

@ -517,6 +517,10 @@ class ParameterizedCompletionContext {
} }
} }
if (currentNext == null) {
return;
}
// No params after caret - go to first one // No params after caret - go to first one
if (currentNext.getStartOffset() + 1 <= dot) { if (currentNext.getStartOffset() + 1 <= dot) {
int nextIndex = getFirstHighlight(highlights); int nextIndex = getFirstHighlight(highlights);

2
designer-base/src/main/java/com/fr/design/gui/columnrow/ColumnRowPane.java

@ -146,6 +146,8 @@ public class ColumnRowPane extends JPanel implements UIObserver {
if (cftf != null) { if (cftf != null) {
cftf.setColumns(3); // specify more width than we need cftf.setColumns(3); // specify more width than we need
cftf.setHorizontalAlignment(UITextField.LEFT); cftf.setHorizontalAlignment(UITextField.LEFT);
}else {
throw new IllegalArgumentException("Spinner'Editor can not be null!");
} }
((AbstractDocument) cftf.getDocument()).setDocumentFilter(new DocumentFilter() { ((AbstractDocument) cftf.getDocument()).setDocumentFilter(new DocumentFilter() {

4
designer-base/src/main/java/com/fr/design/gui/controlpane/ObjectUIControlPane.java

@ -1,8 +1,8 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.stable.AssistUtils;
/** /**
* Created by plough on 2017/8/1. * Created by plough on 2017/8/1.
@ -48,7 +48,7 @@ public abstract class ObjectUIControlPane extends UIListControlPane {
if (constructor != null) { if (constructor != null) {
return constructor; return constructor;
} else { } else {
if (cls.getName() == Object.class.getName()) { if (AssistUtils.equals(cls.getName(),Object.class.getName())) {
return null; return null;
} }
return getConstructor(clazz, cls.getSuperclass()); return getConstructor(clazz, cls.getSuperclass());

10
designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java

@ -157,7 +157,7 @@ public class UIDatePicker extends UIComboBox implements Serializable {
/** /**
* 设置当前选择的日期 * 设置当前选择的日期
*/ */
public void setSelectedDate(Date date) throws ParseException { public synchronized void setSelectedDate(Date date) throws ParseException {
if (date == null) { if (date == null) {
this.setSelectedItem(null); this.setSelectedItem(null);
} else { } else {
@ -165,6 +165,7 @@ public class UIDatePicker extends UIComboBox implements Serializable {
} }
} }
@Override
public void setSelectedItem(Object anObject) { public void setSelectedItem(Object anObject) {
model.setSelectedItem(anObject); model.setSelectedItem(anObject);
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
@ -192,12 +193,14 @@ public class UIDatePicker extends UIComboBox implements Serializable {
setBorder(BorderFactory.createEmptyBorder()); setBorder(BorderFactory.createEmptyBorder());
} }
@Override
public void hide() { public void hide() {
if (isWillHide) { if (isWillHide) {
super.hide(); super.hide();
} }
} }
@Override
public void show() { public void show() {
if (isWillHide || UIDatePicker.this.isEnabled() == false) { if (isWillHide || UIDatePicker.this.isEnabled() == false) {
return; return;
@ -211,6 +214,7 @@ public class UIDatePicker extends UIComboBox implements Serializable {
/** /**
* 显示弹出面板 * 显示弹出面板
*/ */
@Override
protected void firePropertyChange(String propertyName, protected void firePropertyChange(String propertyName,
Object oldValue, Object oldValue,
Object newValue) { Object newValue) {
@ -250,12 +254,14 @@ public class UIDatePicker extends UIComboBox implements Serializable {
} }
} }
@Override
protected ComboBoxUI getUIComboBoxUI() { protected ComboBoxUI getUIComboBoxUI() {
return new UIComboBoxUI() { return new UIComboBoxUI() {
@Override
protected ComboPopup createPopup() { protected ComboPopup createPopup() {
return new DatePopup(comboBox); return new DatePopup(comboBox);
} }
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (UIDatePicker.this.isPopupVisible()) { if (UIDatePicker.this.isPopupVisible()) {
isWillHide = true; isWillHide = true;

1
designer-base/src/main/java/com/fr/design/gui/demo/LoadingPaneDemo.java

@ -35,6 +35,7 @@ public class LoadingPaneDemo extends JPanel {
Thread.sleep(500); Thread.sleep(500);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} }
container.add(new UIButton(i + "adfadwdadawdwad")); container.add(new UIButton(i + "adfadwdadawdwad"));
} }

1
designer-base/src/main/java/com/fr/design/gui/frpane/LoadingBasicPaneTest.java

@ -24,6 +24,7 @@ public class LoadingBasicPaneTest {
Thread.sleep(500); Thread.sleep(500);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} }
container.add(new UIButton(i + "adfadwdadawdwad")); container.add(new UIButton(i + "adfadwdadawdwad"));
} }

3
designer-base/src/main/java/com/fr/design/gui/frpane/UINumberSlidePane.java

@ -14,6 +14,7 @@ import javax.swing.event.ChangeListener;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.style.NumberDragBar; import com.fr.design.gui.style.NumberDragBar;
import com.fr.stable.AssistUtils;
/** /**
* 拖拽的滑条和对应滑条值的数字 * 拖拽的滑条和对应滑条值的数字
@ -65,7 +66,7 @@ public class UINumberSlidePane extends BasicBeanPane<Double> {
public void checkValue(double value) { public void checkValue(double value) {
value = Math.max(value, minValue); value = Math.max(value, minValue);
value = Math.min(value, maxValue); value = Math.min(value, maxValue);
if (this.value == value) { if (AssistUtils.equals(this.value, value)) {
return; return;
} }
double diff = Math.abs(value - this.value); double diff = Math.abs(value - this.value);

3
designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -81,7 +82,7 @@ public abstract class UnitInputPane extends BasicPane {
floatValue = de.floatValue(); floatValue = de.floatValue();
} }
//选中多列, 并且列宽不完全一致的话, 就不显示值了. //选中多列, 并且列宽不完全一致的话, 就不显示值了.
temp.setText(floatValue == 0 ? StringUtils.EMPTY : Utils.convertNumberStringToString(new Float(floatValue))); temp.setText(AssistUtils.equals(floatValue, 0) ? StringUtils.EMPTY : Utils.convertNumberStringToString(new Float(floatValue)));
// denny:默认应该为选中,方便用户修改 // denny:默认应该为选中,方便用户修改
temp.selectAll(); temp.selectAll();

51
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java

@ -7,12 +7,25 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.*; import javax.swing.JCheckBox;
import java.awt.event.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
public class UICheckListPopup extends UIPopupMenu { public class UICheckListPopup extends UIPopupMenu {
private List<ActionListener> listeners = new ArrayList<ActionListener>(); private List<ActionListener> listeners = new ArrayList<ActionListener>();
@ -66,10 +79,10 @@ public class UICheckListPopup extends UIPopupMenu {
} }
addSelectListener(); addSelectListener();
jScrollPane.setPreferredSize(new Dimension(200, checkBoxList.size() * CHECKBOX_HEIGHT + 10)); jScrollPane.setPreferredSize(new Dimension(130, checkBoxList.size() * CHECKBOX_HEIGHT + 10));
//超过1页的数量时显示滚动条 //超过1页的数量时显示滚动条
if (checkBoxList.size() > maxDisplayNumber) { if (checkBoxList.size() > maxDisplayNumber) {
jScrollPane.setPreferredSize(new Dimension(200, maxDisplayNumber * CHECKBOX_HEIGHT)); jScrollPane.setPreferredSize(new Dimension(130, maxDisplayNumber * CHECKBOX_HEIGHT));
} }
checkboxPane.repaint(); checkboxPane.repaint();
jScrollPane.repaint(); jScrollPane.repaint();
@ -77,11 +90,11 @@ public class UICheckListPopup extends UIPopupMenu {
private void addOneCheckValue(Object checkValue) { private void addOneCheckValue(Object checkValue) {
JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
checkPane.setPreferredSize(new Dimension(185, CHECKBOX_HEIGHT)); checkPane.setPreferredSize(new Dimension(120, CHECKBOX_HEIGHT));
final JCheckBox temp = createCheckbox(); final JCheckBox temp = createCheckbox();
final UILabel label = new UILabel(checkValue.toString()); final UILabel label = new UILabel(checkValue.toString());
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
label.setPreferredSize(new Dimension(156, 20)); label.setPreferredSize(new Dimension(80, 20));
checkPane.setBackground(Color.WHITE); checkPane.setBackground(Color.WHITE);
checkPane.add(temp); checkPane.add(temp);
checkPane.add(label); checkPane.add(label);
@ -95,8 +108,8 @@ public class UICheckListPopup extends UIPopupMenu {
JCheckBox checkBox = new JCheckBox(); JCheckBox checkBox = new JCheckBox();
checkBox.setPreferredSize(new Dimension(20, 20)); checkBox.setPreferredSize(new Dimension(20, 20));
checkBox.setBackground(Color.WHITE); checkBox.setBackground(Color.WHITE);
checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL)); checkBox.setIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL));
checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED)); checkBox.setSelectedIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED));
return checkBox; return checkBox;
} }
@ -109,10 +122,12 @@ public class UICheckListPopup extends UIPopupMenu {
*/ */
private void addMouseListener(final JCheckBox checkBox, final UILabel label) { private void addMouseListener(final JCheckBox checkBox, final UILabel label) {
label.addMouseListener(new MouseAdapter() { label.addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
} }
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
label.setOpaque(true); label.setOpaque(true);
label.setBackground(mouseEnteredColor); label.setBackground(mouseEnteredColor);
@ -133,6 +148,7 @@ public class UICheckListPopup extends UIPopupMenu {
JCheckBox checkBox = checkBoxList.get(i); JCheckBox checkBox = checkBoxList.get(i);
if (i == 0) { if (i == 0) {
checkBox.addItemListener(new ItemListener() { checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
//全选checkbox事件 //全选checkbox事件
doSelectAll(checkBoxList.get(0).isSelected()); doSelectAll(checkBoxList.get(0).isSelected());
@ -140,6 +156,7 @@ public class UICheckListPopup extends UIPopupMenu {
}); });
} else { } else {
checkBox.addItemListener(new ItemListener() { checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
//do半选判断放在commit事件里 //do半选判断放在commit事件里
commit(); commit();
@ -157,8 +174,17 @@ public class UICheckListPopup extends UIPopupMenu {
private void doSelectAll(boolean isSelected) { private void doSelectAll(boolean isSelected) {
for (int i = 1; i < checkBoxList.size(); i++) { for (int i = 1; i < checkBoxList.size(); i++) {
//全选和反全选都不考虑全选按钮本身 //全选和反全选都不考虑全选按钮本身
if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) {
checkBoxList.get(i).setSelected(isSelected); checkBoxList.get(i).setSelected(isSelected);
}
}
}
public void setSelectedValue(Map<Object, Boolean> selectedValues) {
List<Object> allValue = Arrays.asList(values);
for (Object value : selectedValues.keySet()) {
int index = allValue.indexOf(value);
checkBoxList.get(index + 1).setSelected(selectedValues.get(value));
} }
} }
@ -214,8 +240,9 @@ public class UICheckListPopup extends UIPopupMenu {
} }
public void addActionListener(ActionListener listener) { public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener)) if (!listeners.contains(listener)) {
listeners.add(listener); listeners.add(listener);
}
} }
public void removeActionListener(ActionListener listener) { public void removeActionListener(ActionListener listener) {

27
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -11,14 +11,23 @@ import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.Icon;
import java.awt.*; import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 设计器下拉复选框组件 * 设计器下拉复选框组件
@ -125,7 +134,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private UITextField createEditor() { private UITextField createEditor() {
UITextField editor = new UITextField(); UITextField editor = new UITextField();
editor.setEditable(false); editor.setEditable(false);
editor.setPreferredSize(new Dimension(180, 20)); editor.setPreferredSize(new Dimension(110, 20));
addPopupListener(editor); addPopupListener(editor);
return editor; return editor;
@ -138,6 +147,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
*/ */
private void addPopupListener(Component component) { private void addPopupListener(Component component) {
component.addMouseListener(new MouseAdapter() { component.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
togglePopup(); togglePopup();
} }
@ -166,6 +176,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private class PopupAction implements ActionListener { private class PopupAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) { if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) {
selectedValues = popup.getSelectedValues(); selectedValues = popup.getSelectedValues();
@ -292,13 +303,15 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
public void addActionListener(ActionListener listener) { public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener)) if (!listeners.contains(listener)) {
listeners.add(listener); listeners.add(listener);
}
} }
public void removeActionListener(ActionListener listener) { public void removeActionListener(ActionListener listener) {
if (listeners.contains(listener)) if (listeners.contains(listener)) {
listeners.remove(listener); listeners.remove(listener);
}
} }
protected void fireActionPerformed(ActionEvent e) { protected void fireActionPerformed(ActionEvent e) {
@ -307,6 +320,10 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
} }
public void setSelectedValues(Map<Object, Boolean> map) {
popup.setSelectedValue(map);
}
/** /**
* 简单的测试demo * 简单的测试demo
* @param args * @param args

14
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java

@ -1,5 +1,7 @@
package com.fr.design.gui.iscrollbar; package com.fr.design.gui.iscrollbar;
import com.fr.design.constants.UIConstants;
import com.fr.stable.StringUtils;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
@ -20,7 +22,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import javax.swing.BoundedRangeModel; import javax.swing.BoundedRangeModel;
import javax.swing.InputMap; import javax.swing.InputMap;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -38,8 +39,6 @@ import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ScrollBarUI; import javax.swing.plaf.ScrollBarUI;
import javax.swing.plaf.UIResource; import javax.swing.plaf.UIResource;
import com.fr.design.constants.UIConstants;
import sun.swing.DefaultLookup; import sun.swing.DefaultLookup;
/** /**
@ -148,6 +147,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* *
* @param c * @param c
*/ */
@Override
public void installUI(JComponent c) { public void installUI(JComponent c) {
scrollbar = (JScrollBar) c; scrollbar = (JScrollBar) c;
thumbRect = new Rectangle(0, 0, 0, 0); thumbRect = new Rectangle(0, 0, 0, 0);
@ -163,6 +163,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* *
* @param c * @param c
*/ */
@Override
public void uninstallUI(JComponent c) { public void uninstallUI(JComponent c) {
scrollbar = (JScrollBar) c; scrollbar = (JScrollBar) c;
uninstallListeners(); uninstallListeners();
@ -357,6 +358,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
/** /**
* 只画Thumb * 只画Thumb
*/ */
@Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Rectangle thumbBounds = getThumbBounds(); Rectangle thumbBounds = getThumbBounds();
if (thumbBounds.intersects(g.getClipBounds())) { if (thumbBounds.intersects(g.getClipBounds())) {
@ -380,6 +382,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* @see #getMaximumSize * @see #getMaximumSize
* @see #getMinimumSize * @see #getMinimumSize
*/ */
@Override
public Dimension getPreferredSize(JComponent c) { public Dimension getPreferredSize(JComponent c) {
return (scrollbar.getOrientation() == JScrollBar.VERTICAL) ? new Dimension(scrollBarWidth, 48) : new Dimension(48, scrollBarWidth); return (scrollbar.getOrientation() == JScrollBar.VERTICAL) ? new Dimension(scrollBarWidth, 48) : new Dimension(48, scrollBarWidth);
} }
@ -390,6 +393,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* @see #getMinimumSize * @see #getMinimumSize
* @see #getPreferredSize * @see #getPreferredSize
*/ */
@Override
public Dimension getMaximumSize(JComponent c) { public Dimension getMaximumSize(JComponent c) {
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
} }
@ -937,6 +941,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
private transient int direction = +1; private transient int direction = +1;
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
isPressing = false; isPressing = false;
if (isDragging) { if (isDragging) {
@ -968,6 +973,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* one page. If there is no thumb then page up if the mouse is in the * one page. If there is no thumb then page up if the mouse is in the
* upper half of the track. * upper half of the track.
*/ */
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
boolean isMiddle = !isSupportsAbsolutePositioning() && SwingUtilities.isMiddleMouseButton(e); boolean isMiddle = !isSupportsAbsolutePositioning() && SwingUtilities.isMiddleMouseButton(e);
if (SwingUtilities.isRightMouseButton(e) || isMiddle) { if (SwingUtilities.isRightMouseButton(e) || isMiddle) {
@ -1313,7 +1319,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
public void propertyChange(PropertyChangeEvent e) { public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName(); String propertyName = e.getPropertyName();
if ("model" == propertyName) { if (StringUtils.equals("model", propertyName)) {
BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue(); BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
BoundedRangeModel newModel = (BoundedRangeModel) e.getNewValue(); BoundedRangeModel newModel = (BoundedRangeModel) e.getNewValue();
oldModel.removeChangeListener(modelListener); oldModel.removeChangeListener(modelListener);

12
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -217,6 +217,18 @@ public class FRGUIPaneFactory {
return jp; return jp;
} }
/**
* 创建一个靠左空边框面板间隔小firsthgap 为0
*
* @return JPanel对象
*/
public static JPanel createTinyHGapFlowInnerContainer_M_Pane_First0() {
JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jp.setLayout(new FRLeftFlowLayout(0, 5, 0));
return jp;
}
/** /**
* 创建一个靠左空边框面板间隔中等 * 创建一个靠左空边框面板间隔中等
* *

22
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java

@ -11,6 +11,8 @@ import com.fr.design.web.CustomIconPane;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -33,6 +35,7 @@ import java.util.ArrayList;
public class TabIconConfigPane extends JPanel { public class TabIconConfigPane extends JPanel {
private UIButton editIconButton; private UIButton editIconButton;
private UIButton deleteIconButton;
private String curIconName; private String curIconName;
private IconButton selectIconButton; private IconButton selectIconButton;
private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>(); private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>();
@ -43,7 +46,7 @@ public class TabIconConfigPane extends JPanel {
public void initComp(int count) { public void initComp(int count) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); JPanel panel = FRGUIPaneFactory.createTinyHGapFlowInnerContainer_M_Pane_First0();
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
@ -63,12 +66,28 @@ public class TabIconConfigPane extends JPanel {
curIconName = cip.update(); curIconName = cip.update();
setShowIconImage(); setShowIconImage();
TabIconConfigPane.this.repaint(); TabIconConfigPane.this.repaint();
deleteIconButton.setEnabled(true);
} }
}); });
editDialog.setVisible(true); editDialog.setVisible(true);
} }
}); });
editIconButton.setEnabled(false); editIconButton.setEnabled(false);
deleteIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Delete"));
deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
deleteIconButton.setPreferredSize(new Dimension(62, 20));
panel.add(deleteIconButton);
deleteIconButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
curIconName = "";
setShowIconImage();
TabIconConfigPane.this.repaint();
deleteIconButton.setEnabled(false);
}
});
deleteIconButton.setEnabled(false);
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
JPanel northPane = new JPanel(); JPanel northPane = new JPanel();
@ -163,6 +182,7 @@ public class TabIconConfigPane extends JPanel {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
selectIconButton = this; selectIconButton = this;
editIconButton.setEnabled(true); editIconButton.setEnabled(true);
deleteIconButton.setEnabled(StringUtils.isNotEmpty(this.getIconName()));
TabIconConfigPane.this.repaint();// repaint TabIconConfigPane.this.repaint();// repaint
} }

23
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -35,6 +35,7 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -362,10 +363,10 @@ public class UpdateMainDialog extends UIDialog {
add(jarVersionInfoPane, BorderLayout.NORTH); add(jarVersionInfoPane, BorderLayout.NORTH);
//海外版本不显示更新信息 //海外版本不显示更新信息
if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)){ if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)) {
add(jarUpdateInfoPane, BorderLayout.CENTER); add(jarUpdateInfoPane, BorderLayout.CENTER);
add(updateActionPane, BorderLayout.SOUTH); add(updateActionPane, BorderLayout.SOUTH);
}else { } else {
add(updateActionPane, BorderLayout.CENTER); add(updateActionPane, BorderLayout.CENTER);
} }
@ -513,16 +514,15 @@ public class UpdateMainDialog extends UIDialog {
if (endTime.equals(lastUpdateCacheTime) || jsonArray.length() == 0 || ComparatorUtils.compare(endTime, lastUpdateCacheTime) <= 0) { if (endTime.equals(lastUpdateCacheTime) || jsonArray.length() == 0 || ComparatorUtils.compare(endTime, lastUpdateCacheTime) <= 0) {
return; return;
} }
OutputStreamWriter writerStream = new OutputStreamWriter(new FileOutputStream(cacheFile), "UTF-8"); try (OutputStreamWriter writerStream = new OutputStreamWriter(new FileOutputStream(cacheFile), EncodeConstants.ENCODING_UTF_8);
BufferedWriter bufferWriter = new BufferedWriter(writerStream); BufferedWriter bufferWriter = new BufferedWriter(writerStream)) {
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jo = (JSONObject) jsonArray.get(i); JSONObject jo = (JSONObject) jsonArray.get(i);
bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title")); bufferWriter.write((String) jo.get("update") + '\t' + jo.get("title"));
bufferWriter.newLine(); bufferWriter.newLine();
bufferWriter.flush(); bufferWriter.flush();
}
} }
bufferWriter.close();
writerStream.close();
lastUpdateCacheState = UPDATE_CACHE_STATE_SUCCESS; lastUpdateCacheState = UPDATE_CACHE_STATE_SUCCESS;
lastUpdateCacheTime = endTime; lastUpdateCacheTime = endTime;
cacheProperty.updateProperty("updateTime", lastUpdateCacheTime); cacheProperty.updateProperty("updateTime", lastUpdateCacheTime);
@ -634,6 +634,7 @@ public class UpdateMainDialog extends UIDialog {
/** /**
* 获取当前jar的md5 * 获取当前jar的md5
*
* @param currentJAR * @param currentJAR
* @return * @return
*/ */

4
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -67,8 +67,7 @@ public class DesignUtils {
* @return 启动了返回true * @return 启动了返回true
*/ */
public static boolean isStarted() { public static boolean isStarted() {
try { try (Socket socket = new Socket("localhost", port)) {
new Socket("localhost", port);
return true; return true;
} catch (Exception ignored) { } catch (Exception ignored) {
} }
@ -116,6 +115,7 @@ public class DesignUtils {
* @param startPort 端口 * @param startPort 端口
* @param suffixs 文件后缀 * @param suffixs 文件后缀
*/ */
@SuppressWarnings("squid:S2095")
public static void createListeningServer(final int startPort, final String[] suffixs) { public static void createListeningServer(final int startPort, final String[] suffixs) {
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("DesignClientListener")); ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("DesignClientListener"));
service.execute(new Runnable() { service.execute(new Runnable() {

10
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -433,7 +433,7 @@ public class CustomIconPane extends BasicPane {
JPanel imagePane = new JPanel(); JPanel imagePane = new JPanel();
imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0));
showImageLabel = new UILabel(); showImageLabel = new UILabel();
showImageLabel.setPreferredSize(new Dimension(20, 20)); showImageLabel.setPreferredSize(new Dimension(50, 50));
imagePane.add(showImageLabel); imagePane.add(showImageLabel);
imagePane.add(browseButton); imagePane.add(browseButton);
Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}}; Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}};
@ -450,12 +450,12 @@ public class CustomIconPane extends BasicPane {
if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) { if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) {
String path = jf.getSelectedFile().getAbsolutePath(); String path = jf.getSelectedFile().getAbsolutePath();
// 将图片转化到16 × 16大小 // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path); Image image = BaseUtils.readImage(path);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(IconManager.DEFAULT_ICONWIDTH, BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH),
IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB); Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics(); Graphics2D g2d = bufferedImage.createGraphics();
g2d.drawImage(image, 0, 0, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); g2d.drawImage(image, 0, 0, Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), null);
bufferedImage.flush(); bufferedImage.flush();
g2d.dispose(); g2d.dispose();
iconImage = bufferedImage; iconImage = bufferedImage;

29
designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java

@ -86,12 +86,14 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
initDialog(); initDialog();
dialog.addWindowListener(new WindowAdapter() { dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) { public void windowClosing(WindowEvent e) {
//取消下载 //取消下载
result = false; result = false;
exitDialog(); exitDialog();
} }
@Override
public void windowOpened(WindowEvent e) { public void windowOpened(WindowEvent e) {
downloadAndInstallPluginDependenceFile(); downloadAndInstallPluginDependenceFile();
exitDialog(); exitDialog();
@ -119,25 +121,22 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind(siteInfo.siteKind)); httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind(siteInfo.siteKind));
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
InputStream reader = httpClient.getResponseStream();
String temp = StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE); String temp = StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE);
File file = new File(temp); File file = new File(temp);
StableUtils.makesureFileExist(file); StableUtils.makesureFileExist(file);
FileOutputStream writer = new FileOutputStream(temp); try (InputStream reader = httpClient.getResponseStream();
byte[] buffer = new byte[PluginConstants.BYTES_NUM]; FileOutputStream writer = new FileOutputStream(temp)) {
int bytesRead; byte[] buffer = new byte[PluginConstants.BYTES_NUM];
while ((bytesRead = reader.read(buffer)) > 0 && result) { int bytesRead;
writer.write(buffer, 0, bytesRead); while ((bytesRead = reader.read(buffer)) > 0 && result) {
buffer = new byte[PluginConstants.BYTES_NUM]; writer.write(buffer, 0, bytesRead);
buffer = new byte[PluginConstants.BYTES_NUM];
currentBytesRead += bytesRead;
setProgress(currentBytesRead); currentBytesRead += bytesRead;
setProgress(currentBytesRead);
}
writer.flush();
} }
reader.close();
writer.flush();
writer.close();
if (result) { if (result) {
//安装文件 //安装文件
IOUtils.unZipFilesGBK(temp, StableUtils.pathJoin(WorkContext.getCurrent().getPath(), siteInfo.localDir)); IOUtils.unZipFilesGBK(temp, StableUtils.pathJoin(WorkContext.getCurrent().getPath(), siteInfo.localDir));

3
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -24,6 +24,7 @@ import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WTabDisplayPosition; import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.act.BorderPacker;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
@ -284,7 +285,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
backupBound.x -= rec.x; backupBound.x -= rec.x;
backupBound.y -= rec.y; backupBound.y -= rec.y;
XWCardLayout cardLayout = mainLayout.getCardPart(); XWCardLayout cardLayout = mainLayout.getCardPart();
LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); BorderPacker style = cardLayout.toData().getBorderStyle();
XWCardTitleLayout xwCardTitleLayout = mainLayout.getTitlePart(); XWCardTitleLayout xwCardTitleLayout = mainLayout.getTitlePart();
Dimension titleDimension = xwCardTitleLayout.getSize(); Dimension titleDimension = xwCardTitleLayout.getSize();

6
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java

@ -7,18 +7,16 @@ package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.beans.GroupModel; import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.XWidgetCreator; import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FRTabFitLayoutPropertiesGroupModel; import com.fr.design.designer.properties.FRTabFitLayoutPropertiesGroupModel;
import com.fr.design.mainframe.widget.editors.ParameterEditor;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.act.BorderPacker;
import java.awt.*; import java.awt.*;
@ -90,7 +88,7 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter {
// TODO 可以直接在这边将x,y都变成相对坐标,这样在后面判断拖进来的新控件放置方式的时候就不用再判断了 // TODO 可以直接在这边将x,y都变成相对坐标,这样在后面判断拖进来的新控件放置方式的时候就不用再判断了
private int adjustY(int y, XWTabFitLayout tabLayout) { private int adjustY(int y, XWTabFitLayout tabLayout) {
XWCardLayout cardLayout = (XWCardLayout) tabLayout.getBackupParent(); XWCardLayout cardLayout = (XWCardLayout) tabLayout.getBackupParent();
LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); BorderPacker style = cardLayout.toData().getBorderStyle();
y = y - this.getParaEditorYOffset(); y = y - this.getParaEditorYOffset();
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) {
y = y - WCardMainBorderLayout.TAB_HEIGHT; y = y - WCardMainBorderLayout.TAB_HEIGHT;

22
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -11,6 +11,8 @@ import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.WidgetValue; import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.act.BorderPacker;
import com.fr.general.act.TitlePacker;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -41,7 +43,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
} }
protected void initStyle() { protected void initStyle() {
LayoutBorderStyle style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
initBorderStyle(); initBorderStyle();
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) {
initTitleStyle(style); initTitleStyle(style);
@ -52,7 +54,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
// 边框默认值设为NONE,不然像scalelayout这种只用默认边框的会不显示边框 // 边框默认值设为NONE,不然像scalelayout这种只用默认边框的会不显示边框
protected void initBorderStyle() { protected void initBorderStyle() {
LayoutBorderStyle style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
if (style != null && style.getBorder() != Constants.LINE_NONE) { if (style != null && style.getBorder() != Constants.LINE_NONE) {
this.setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius())); this.setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius()));
} else { } else {
@ -74,8 +76,8 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
* 设置样式为标题样式时对应组件加上标题 * 设置样式为标题样式时对应组件加上标题
* @param style 样式 * @param style 样式
*/ */
protected void initTitleStyle(LayoutBorderStyle style){ protected void initTitleStyle(BorderPacker style){
if (style.getTitle() == null) { if (style.getTitle() == null || style.getTitle().getTextObject() == null) {
return; return;
} }
XWTitleLayout parent = (XWTitleLayout) this.getParent(); XWTitleLayout parent = (XWTitleLayout) this.getParent();
@ -100,25 +102,25 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
/** /**
* 更新标题控件所有的样式 * 更新标题控件所有的样式
*/ */
private void updateTitleWidgetStyle(Label title, LayoutBorderStyle style) { private void updateTitleWidgetStyle(Label title, BorderPacker style) {
//标题的边框样式目前是取对应的控件的边框样式 //标题的边框样式目前是取对应的控件的边框样式
title.setBorder(style.getBorder()); title.setBorder(style.getBorder());
title.setColor(style.getColor()); title.setColor(style.getColor());
// title.setCorner(style.isCorner()); // title.setCorner(style.isCorner());
WidgetTitle wTitle = style.getTitle(); TitlePacker wTitle = style.getTitle();
//设置成随机不重复的, 不然都用一个名字的话, 联动只能联动一个 //设置成随机不重复的, 不然都用一个名字的话, 联动只能联动一个
title.setWidgetName(wTitle.TITLE_NAME_INDEX + this.toData().getWidgetName()); title.setWidgetName(WidgetTitle.TITLE_NAME_INDEX + this.toData().getWidgetName());
title.setWidgetValue(getTitleValue(wTitle)); title.setWidgetValue(getTitleValue(wTitle));
title.setFont(wTitle.getFrFont()); title.setFont(wTitle.getFrFont());
title.setTextalign(wTitle.getPosition()); title.setTextalign(wTitle.getPosition());
title.setBackground(wTitle.getBackground()); title.setBackground(wTitle.getBackground());
} }
private WidgetValue getTitleValue(WidgetTitle wTitle){ private WidgetValue getTitleValue(TitlePacker wTitle){
String content = String.valueOf(wTitle.getTextObject()); String content = String.valueOf(wTitle.getTextObject());
Object vlaue = content.startsWith("=") ? BaseFormula.createFormulaBuilder().build(content) : content; Object value = content.startsWith("=") ? BaseFormula.createFormulaBuilder().build(content) : content;
return new WidgetValue(vlaue); return new WidgetValue(value);
} }
@Override @Override

11
designer-form/src/main/java/com/fr/design/designer/creator/XWBorderLayout.java

@ -42,6 +42,7 @@ public class XWBorderLayout extends XLayoutContainer {
* 默认名称 * 默认名称
* @return 名称 * @return 名称
*/ */
@Override
public String createDefaultName() { public String createDefaultName() {
return "border"; return "border";
} }
@ -50,6 +51,7 @@ public class XWBorderLayout extends XLayoutContainer {
* 转化成相应 WBorderLayout * 转化成相应 WBorderLayout
* @return 相应 WBorderLayout * @return 相应 WBorderLayout
*/ */
@Override
public WBorderLayout toData() { public WBorderLayout toData() {
return (WBorderLayout) data; return (WBorderLayout) data;
} }
@ -62,6 +64,7 @@ public class XWBorderLayout extends XLayoutContainer {
* 初始大小 * 初始大小
* @return 初始大小 * @return 初始大小
*/ */
@Override
public Dimension initEditorSize() { public Dimension initEditorSize() {
return new Dimension(WBorderLayout.DEFAULT_WIDTH, WBorderLayout.DEFAULT_HEIGHT); return new Dimension(WBorderLayout.DEFAULT_WIDTH, WBorderLayout.DEFAULT_HEIGHT);
} }
@ -71,15 +74,18 @@ public class XWBorderLayout extends XLayoutContainer {
* @return 属性名 * @return 属性名
* @throws java.beans.IntrospectionException 抛错 * @throws java.beans.IntrospectionException 抛错
*/ */
@Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] { return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Toolkit.i18nText("Fine-Design_Form_Form_Widget_Name")) new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Toolkit.i18nText("Fine-Design_Form_Form_Widget_Name")),
new CRPropertyDescriptor("customTitleName", this.data.getClass()).setI18NName(Toolkit.i18nText("Fine-Design_Form_Title"))
}; };
} }
/** /**
* 将WLayout转换为XLayoutContainer * 将WLayout转换为XLayoutContainer
*/ */
@Override
public void convert() { public void convert() {
isRefreshing = true; isRefreshing = true;
WBorderLayout wb = this.toData(); WBorderLayout wb = this.toData();
@ -101,6 +107,7 @@ public class XWBorderLayout extends XLayoutContainer {
* 设计界面中有组件添加时要通知WLayout容器重新paint * 设计界面中有组件添加时要通知WLayout容器重新paint
* @param e 事件 * @param e 事件
*/ */
@Override
public void componentAdded(ContainerEvent e) { public void componentAdded(ContainerEvent e) {
if (isRefreshing) { if (isRefreshing) {
return; return;
@ -158,6 +165,7 @@ public class XWBorderLayout extends XLayoutContainer {
/** /**
* 重新计算大小 * 重新计算大小
*/ */
@Override
public void recalculateChildrenSize() { public void recalculateChildrenSize() {
Dimension d = getSize(); Dimension d = getSize();
WBorderLayout layout = toData(); WBorderLayout layout = toData();
@ -173,6 +181,7 @@ public class XWBorderLayout extends XLayoutContainer {
* @param comp 组件 * @param comp 组件
* @param constraints 方位 * @param constraints 方位
*/ */
@Override
public void add(Component comp, Object constraints) { public void add(Component comp, Object constraints) {
super.add(comp, constraints); super.add(comp, constraints);
if (comp == null) { if (comp == null) {

31
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -22,31 +22,20 @@ import com.fr.design.mainframe.JForm;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.WTabTextDirection; import com.fr.form.ui.container.WTabTextDirection;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.act.BorderPacker;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.act.TitlePacker;
import com.fr.general.cardtag.TemplateStyle; import com.fr.general.cardtag.TemplateStyle;
import com.fr.stable.unit.PT; import com.fr.stable.unit.PT;
import javax.swing.Action; import javax.swing.*;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicLabelUI; import javax.swing.plaf.basic.BasicLabelUI;
import java.awt.Color; import java.awt.*;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.ArrayList; import java.util.ArrayList;
@ -308,7 +297,7 @@ public class XCardSwitchButton extends XButton {
super.paintComponent(g); super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
CardSwitchButton button = (CardSwitchButton) this.toData(); CardSwitchButton button = (CardSwitchButton) this.toData();
WidgetTitle widgetTitle = getWidgetTitle(); TitlePacker widgetTitle = getWidgetTitle();
drawBackground(button, widgetTitle); drawBackground(button, widgetTitle);
drawTitle(button, widgetTitle); drawTitle(button, widgetTitle);
Dimension panelSize = this.getContentLabel().getSize(); Dimension panelSize = this.getContentLabel().getSize();
@ -322,7 +311,7 @@ public class XCardSwitchButton extends XButton {
} }
//画背景 //画背景
private void drawBackground(CardSwitchButton button, WidgetTitle widgetTitle){ private void drawBackground(CardSwitchButton button, TitlePacker widgetTitle){
Background background = widgetTitle.getBackground() == null ? ColorBackground.getInstance(NORMAL_GRAL) : widgetTitle.getBackground(); Background background = widgetTitle.getBackground() == null ? ColorBackground.getInstance(NORMAL_GRAL) : widgetTitle.getBackground();
TemplateStyle templateStyle = ((WCardTagLayout) tagLayout.toData()).getTemplateStyle(); TemplateStyle templateStyle = ((WCardTagLayout) tagLayout.toData()).getTemplateStyle();
//获取当前tab的index //获取当前tab的index
@ -340,7 +329,7 @@ public class XCardSwitchButton extends XButton {
} }
//画标题 //画标题
private void drawTitle(CardSwitchButton button, WidgetTitle widgetTitle) { private void drawTitle(CardSwitchButton button, TitlePacker widgetTitle) {
String titleText = button.getText(); String titleText = button.getText();
this.setButtonText(titleText); this.setButtonText(titleText);
FRFont font = widgetTitle.getFrFont(); FRFont font = widgetTitle.getFrFont();
@ -351,11 +340,11 @@ public class XCardSwitchButton extends XButton {
} }
private WidgetTitle getWidgetTitle() { private TitlePacker getWidgetTitle() {
if (this.cardLayout == null) { if (this.cardLayout == null) {
initRelateLayout(); initRelateLayout();
} }
LayoutBorderStyle style = this.cardLayout.toData().getBorderStyle(); BorderPacker style = this.cardLayout.toData().getBorderStyle();
return style.getTitle(); return style.getTitle();
} }
@ -463,7 +452,7 @@ public class XCardSwitchButton extends XButton {
String titleText = button.getText(); String titleText = button.getText();
java.util.List verticalTextList = new ArrayList(); java.util.List verticalTextList = new ArrayList();
StringBuilder titleStringBuf = new StringBuilder(); StringBuilder titleStringBuf = new StringBuilder();
WidgetTitle title = getWidgetTitle(); TitlePacker title = getWidgetTitle();
FRFont font = title.getFrFont(); FRFont font = title.getFrFont();
FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), font.getSize() + FONT_SIZE_ADJUST); FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), font.getSize() + FONT_SIZE_ADJUST);
FontMetrics fm = GraphHelper.getFontMetrics(newFont); FontMetrics fm = GraphHelper.getFontMetrics(newFont);

11
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -25,7 +25,6 @@ import com.fr.form.ui.CardAddButton;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
@ -33,7 +32,9 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.act.BorderPacker;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.act.TitlePacker;
import com.fr.general.cardtag.DefaultTemplateStyle; import com.fr.general.cardtag.DefaultTemplateStyle;
import com.fr.general.cardtag.TemplateStyle; import com.fr.general.cardtag.TemplateStyle;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -165,7 +166,7 @@ public class XWCardLayout extends XLayoutContainer {
WCardMainBorderLayout border = new WCardMainBorderLayout(); WCardMainBorderLayout border = new WCardMainBorderLayout();
XWCardMainBorderLayout xMainBorder = new XWCardMainBorderLayout(border, dimension); XWCardMainBorderLayout xMainBorder = new XWCardMainBorderLayout(border, dimension);
//将子WCardBorder的style设置到父容器上 //将子WCardBorder的style设置到父容器上
LayoutBorderStyle style = (this.toData()).getBorderStyle(); BorderPacker style = (this.toData()).getBorderStyle();
border.setBorderStyle(style); border.setBorderStyle(style);
this.setBackupParent(xMainBorder); this.setBackupParent(xMainBorder);
XWCardTitleLayout titlePart = this.initTitlePart(widgetName, xMainBorder); XWCardTitleLayout titlePart = this.initTitlePart(widgetName, xMainBorder);
@ -397,13 +398,13 @@ public class XWCardLayout extends XLayoutContainer {
//初始化样式 //初始化样式
@Override @Override
protected void initStyle() { protected void initStyle() {
LayoutBorderStyle style = toData().getBorderStyle(); BorderPacker style = toData().getBorderStyle();
initBorderTitleStyle(style); initBorderTitleStyle(style);
initBorderStyle(); initBorderStyle();
clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE));
} }
private void initBorderTitleStyle(LayoutBorderStyle style) { private void initBorderTitleStyle(BorderPacker style) {
//初始化默认标题样式 //初始化默认标题样式
if (!initFlag) { if (!initFlag) {
return; return;
@ -411,7 +412,7 @@ public class XWCardLayout extends XLayoutContainer {
style.setType(LayoutBorderStyle.TITLE); style.setType(LayoutBorderStyle.TITLE);
style.setBorder(Constants.LINE_THIN); style.setBorder(Constants.LINE_THIN);
WidgetTitle widgetTitle = style.getTitle(); TitlePacker widgetTitle = style.getTitle();
widgetTitle.setBackground(ColorBackground.getInstance(TITLE_COLOR)); widgetTitle.setBackground(ColorBackground.getInstance(TITLE_COLOR));
initFlag = false; initFlag = false;
} }

3
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -38,6 +38,7 @@ import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.act.BorderPacker;
import com.fr.share.ShareConstants; import com.fr.share.ShareConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
@ -164,7 +165,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
String tabpaneName = cardLayout.getWidgetName(); String tabpaneName = cardLayout.getWidgetName();
if (!wCardTagLayout.isNewTab()) { if (!wCardTagLayout.isNewTab()) {
wCardTagLayout.setWidgetName(tabpaneName); wCardTagLayout.setWidgetName(tabpaneName);
LayoutBorderStyle borderStyle = cardLayout.getBorderStyle(); BorderPacker borderStyle = cardLayout.getBorderStyle();
if(borderStyle != null){ if(borderStyle != null){
//新tab默认都有标题 //新tab默认都有标题
borderStyle.setType(LayoutBorderStyle.TITLE); borderStyle.setType(LayoutBorderStyle.TITLE);

12
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -27,21 +27,18 @@ import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetTitle;
import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WTabDisplayPosition; import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.act.BorderPacker;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.cardtag.DefaultTemplateStyle; import com.fr.general.cardtag.DefaultTemplateStyle;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.awt.Dimension; import java.awt.*;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.event.ContainerEvent; import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.HashMap; import java.util.HashMap;
@ -363,9 +360,8 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
if (this.cardLayout == null) { if (this.cardLayout == null) {
initCardLayout(); initCardLayout();
} }
LayoutBorderStyle borderStyle = this.cardLayout.toData().getBorderStyle(); BorderPacker borderStyle = this.cardLayout.toData().getBorderStyle();
WidgetTitle title = borderStyle.getTitle(); FRFont f = borderStyle.getTitle().getFrFont();
FRFont f = title.getFrFont();
FontMetrics fm = GraphHelper.getFontMetrics(f); FontMetrics fm = GraphHelper.getFontMetrics(f);
switch (wCardTagLayout.getTextDirection()) { switch (wCardTagLayout.getTextDirection()) {

5
designer-form/src/main/java/com/fr/design/form/mobile/FormMobileOthersPane.java

@ -18,6 +18,7 @@ public class FormMobileOthersPane extends BasicBeanPane<FormMobileAttr> {
private MobileRadioCheckPane appearRefreshCheckPane; // 页面再现时刷新 private MobileRadioCheckPane appearRefreshCheckPane; // 页面再现时刷新
private MobileRadioCheckPane promptWhenLeaveWithoutSubmitCheckPane; // 数据未提交离开提示 private MobileRadioCheckPane promptWhenLeaveWithoutSubmitCheckPane; // 数据未提交离开提示
private MobileRadioCheckPane allowDoubleClickOrZoomCheckPane; // 允许双击/双指缩放
public FormMobileOthersPane() { public FormMobileOthersPane() {
this.initComponents(); this.initComponents();
@ -32,6 +33,8 @@ public class FormMobileOthersPane extends BasicBeanPane<FormMobileAttr> {
contentPane.add(appearRefreshCheckPane, BorderLayout.WEST); contentPane.add(appearRefreshCheckPane, BorderLayout.WEST);
promptWhenLeaveWithoutSubmitCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Prompt_When_Leave_Without_Submit")); promptWhenLeaveWithoutSubmitCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Prompt_When_Leave_Without_Submit"));
contentPane.add(promptWhenLeaveWithoutSubmitCheckPane, BorderLayout.CENTER); contentPane.add(promptWhenLeaveWithoutSubmitCheckPane, BorderLayout.CENTER);
allowDoubleClickOrZoomCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("允许双击/双指缩放"));
contentPane.add(allowDoubleClickOrZoomCheckPane, BorderLayout.EAST);
borderPane.add(contentPane); borderPane.add(contentPane);
this.add(borderPane); this.add(borderPane);
} }
@ -43,6 +46,7 @@ public class FormMobileOthersPane extends BasicBeanPane<FormMobileAttr> {
} }
this.appearRefreshCheckPane.populateBean(ob.isAppearRefresh()); this.appearRefreshCheckPane.populateBean(ob.isAppearRefresh());
this.promptWhenLeaveWithoutSubmitCheckPane.populateBean(ob.isPromptWhenLeaveWithoutSubmit()); this.promptWhenLeaveWithoutSubmitCheckPane.populateBean(ob.isPromptWhenLeaveWithoutSubmit());
this.allowDoubleClickOrZoomCheckPane.populateBean(ob.isAllowDoubleClickOrZoom());
} }
@Override @Override
@ -55,6 +59,7 @@ public class FormMobileOthersPane extends BasicBeanPane<FormMobileAttr> {
if(mobileAttr != null) { if(mobileAttr != null) {
mobileAttr.setAppearRefresh(this.appearRefreshCheckPane.updateBean()); mobileAttr.setAppearRefresh(this.appearRefreshCheckPane.updateBean());
mobileAttr.setPromptWhenLeaveWithoutSubmit(this.promptWhenLeaveWithoutSubmitCheckPane.updateBean()); mobileAttr.setPromptWhenLeaveWithoutSubmit(this.promptWhenLeaveWithoutSubmitCheckPane.updateBean());
mobileAttr.setAllowDoubleClickOrZoom(this.allowDoubleClickOrZoomCheckPane.updateBean());
} }
} }

31
designer-form/src/main/java/com/fr/design/gui/xpane/LayoutBorderPane.java

@ -38,32 +38,17 @@ import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.WidgetTitle;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.act.TitlePacker;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.AbstractButton; import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.plaf.basic.BasicToggleButtonUI; import javax.swing.plaf.basic.BasicToggleButtonUI;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -546,7 +531,7 @@ public class LayoutBorderPane extends BasicPane {
style.setColor(currentLineColorPane.getColor()); style.setColor(currentLineColorPane.getColor());
style.setBackground(backgroundPane.update()); style.setBackground(backgroundPane.update());
style.setAlpha((float)(numberDragPane.updateBean()/maxNumber)); style.setAlpha((float)(numberDragPane.updateBean()/maxNumber));
WidgetTitle title = style.getTitle() == null ? new WidgetTitle() : style.getTitle(); TitlePacker title = style.getTitle() == null ? new WidgetTitle() : style.getTitle();
title.setTextObject(formulaPane.updateBean()); title.setTextObject(formulaPane.updateBean());
FRFont frFont = title.getFrFont(); FRFont frFont = title.getFrFont();
frFont = frFont.applySize((Integer)fontSizeComboBox.getSelectedItem()); frFont = frFont.applySize((Integer)fontSizeComboBox.getSelectedItem());
@ -644,10 +629,10 @@ public class LayoutBorderPane extends BasicPane {
} }
protected void populateTitle(){ protected void populateTitle(){
WidgetTitle widgetTitle = borderStyle == null ? new WidgetTitle() : borderStyle.getTitle(); TitlePacker widgetTitle = borderStyle == null ? new WidgetTitle() : borderStyle.getTitle();
widgetTitle = widgetTitle == null ? new WidgetTitle() : widgetTitle; widgetTitle = widgetTitle == null ? new WidgetTitle() : widgetTitle;
populateFourmula(widgetTitle); populateFormula(widgetTitle);
populateFont(widgetTitle); populateFont(widgetTitle);
underline.addMouseListener(new MouseAdapter() { underline.addMouseListener(new MouseAdapter() {
@ -683,7 +668,7 @@ public class LayoutBorderPane extends BasicPane {
paintPreviewPane(); paintPreviewPane();
} }
protected void populateFont(WidgetTitle widgetTitle){ protected void populateFont(TitlePacker widgetTitle){
FRFont frFont = widgetTitle.getFrFont(); FRFont frFont = widgetTitle.getFrFont();
this.fontSizeComboBox.setSelectedItem(frFont.getSize()); this.fontSizeComboBox.setSelectedItem(frFont.getSize());
this.fontSizeComboBox.addItemListener(new ItemListener() { this.fontSizeComboBox.addItemListener(new ItemListener() {
@ -756,7 +741,7 @@ public class LayoutBorderPane extends BasicPane {
} }
private void populateFourmula(WidgetTitle widgetTitle) { private void populateFormula(TitlePacker widgetTitle) {
this.formulaPane.populateBean(widgetTitle.getTextObject().toString()); this.formulaPane.populateBean(widgetTitle.getTextObject().toString());
this.formulaPane.getUITextField().getDocument() this.formulaPane.getUITextField().getDocument()
.addDocumentListener(new DocumentListener() { .addDocumentListener(new DocumentListener() {

6
designer-form/src/main/java/com/fr/design/gui/xpane/LayoutBorderPreviewPane.java

@ -7,10 +7,10 @@ import com.fr.base.background.ColorBackground;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.act.TitlePacker;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -126,7 +126,7 @@ public class LayoutBorderPreviewPane extends JPanel{
g2d.setColor(new Color(237, 237, 237)); g2d.setColor(new Color(237, 237, 237));
} }
g2d.setFont(frFont.applyResolutionNP(resolution)); g2d.setFont(frFont.applyResolutionNP(resolution));
WidgetTitle title = borderStyle.getTitle(); TitlePacker title = borderStyle.getTitle();
String paintText = title.getTextObject().toString(); String paintText = title.getTextObject().toString();
int startX1 = 0; int startX1 = 0;
int startY = 0; int startY = 0;
@ -158,7 +158,7 @@ public class LayoutBorderPreviewPane extends JPanel{
GraphHelper.draw(g,double2, borderStyle.getBorder()); GraphHelper.draw(g,double2, borderStyle.getBorder());
} }
private void drawTabBack(Graphics2D g2d, Graphics g, WidgetTitle title, FontMetrics fm, int startX1, int startY){ private void drawTabBack(Graphics2D g2d, Graphics g, TitlePacker title, FontMetrics fm, int startX1, int startY){
Dimension d = getSize(); Dimension d = getSize();
String paintText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Title")+TAB_ZERO; String paintText = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Title")+TAB_ZERO;

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

@ -107,7 +107,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
public void populateBean(WCardTagLayout ob) { public void populateBean(WCardTagLayout ob) {
//标题背景和字体属性设置在WCardLayout上做兼容 //标题背景和字体属性设置在WCardLayout上做兼容
XLayoutContainer topLayout = creator.getTopLayout(); XLayoutContainer topLayout = creator.getTopLayout();
LayoutBorderStyle layoutBorderStyle = ((XWCardMainBorderLayout) topLayout).getCardPart().toData().getBorderStyle(); LayoutBorderStyle layoutBorderStyle = (LayoutBorderStyle) ((XWCardMainBorderLayout) topLayout).getCardPart().toData().getBorderStyle();
displayPositionGroup.setSelectedIndex(ob.getDisplayPosition().getType()); displayPositionGroup.setSelectedIndex(ob.getDisplayPosition().getType());
textDirectionGroup.setSelectedIndex(ob.getTextDirection().getType()); textDirectionGroup.setSelectedIndex(ob.getTextDirection().getType());
@ -125,7 +125,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
//标题背景和字体属性设置在WCardLayout上做兼容 //标题背景和字体属性设置在WCardLayout上做兼容
XLayoutContainer topLayout = creator.getTopLayout(); XLayoutContainer topLayout = creator.getTopLayout();
XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart(); XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart();
LayoutBorderStyle layoutBorderStyle = xCardLayout.toData().getBorderStyle(); LayoutBorderStyle layoutBorderStyle = (LayoutBorderStyle) xCardLayout.toData().getBorderStyle();
FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont(); FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont();
FRFont titleFont = frFontPane.update(frFont); FRFont titleFont = frFontPane.update(frFont);
layoutBorderStyle.getTitle().setFrFont(titleFont); layoutBorderStyle.getTitle().setFrFont(titleFont);

40
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java

@ -11,7 +11,8 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.MobileWidgetListPane; import com.fr.design.mainframe.MobileWidgetListPane;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentAdvancePane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentFrozenPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.RichStyleWidgetProvider; import com.fr.form.ui.RichStyleWidgetProvider;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
@ -30,8 +31,11 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private UICheckBox appRelayoutCheck; private UICheckBox appRelayoutCheck;
private MobileWidgetListPane mobileWidgetListPane; private MobileWidgetListPane mobileWidgetListPane;
private MobileComponentAdvancePane advancePane; private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane; private MobileComponentLayoutIntervalPane intervalPane;
private MobileComponentFrozenPane frozenPane;
private UIExpandablePane advancePane;
private UIExpandablePane layoutPane;
public BodyMobileDefinePane(XCreator xCreator) { public BodyMobileDefinePane(XCreator xCreator) {
this.bodyCreator = xCreator; this.bodyCreator = xCreator;
@ -89,16 +93,23 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
private JPanel createNorthPane() { private JPanel createNorthPane() {
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(getMobilePropertyPane(), BorderLayout.NORTH); holder.add(getMobilePropertyPane(), BorderLayout.NORTH);
marginPane = new MobileComponentMarginPane(FormBodyPaddingAttrMark.XML_TAG);
advancePane = new MobileComponentAdvancePane(FormBodyPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG);
frozenPane = new MobileComponentFrozenPane();
JPanel wrapLayoutPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapLayoutPane.add(intervalPane, BorderLayout.NORTH);
wrapLayoutPane.add(frozenPane, BorderLayout.CENTER);
advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane);
layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, wrapLayoutPane);
//高级 //高级
holder.add(advancePane, BorderLayout.CENTER); holder.add(advancePane, BorderLayout.CENTER);
//布局 //布局
holder.add(intervalPane, BorderLayout.SOUTH); holder.add(layoutPane, BorderLayout.SOUTH);
advancePane.setVisible(!shouldHidePadding(designer)); boolean flag = !shouldHidePadding(designer);
intervalPane.setVisible(!shouldHidePadding(designer)); advancePane.setVisible(flag);
layoutPane.setVisible(flag);
frozenPane.setVisible(appRelayoutCheck.isSelected());
return holder; return holder;
} }
@ -137,13 +148,12 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
public void populate(FormDesigner designer) { public void populate(FormDesigner designer) {
this.designer = designer; this.designer = designer;
appRelayoutCheck.setSelected(FormDesignerUtils.isAppRelayout(designer)); appRelayoutCheck.setSelected(FormDesignerUtils.isAppRelayout(designer));
// 数据 populate 完成后,再设置监听 // 数据 populate 完成后,再设置监听
this.bindListeners2Widgets(); this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener); this.addAttributeChangeListener(changeListener);
marginPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
advancePane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
frozenPane.populate(designer.getSelectionModel().getSelection().getSelectedCreator());
} }
@Override @Override
@ -152,15 +162,19 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
setAppRelayout(appRelayoutCheck.isSelected()); setAppRelayout(appRelayoutCheck.isSelected());
boolean appPaddingVisible = appRelayout || !FormDesignerUtils.isBodyAbsolute(designer); boolean appPaddingVisible = appRelayout || !FormDesignerUtils.isBodyAbsolute(designer);
advancePane.setVisible(appPaddingVisible); advancePane.setVisible(appPaddingVisible);
intervalPane.setVisible(appPaddingVisible); layoutPane.setVisible(appPaddingVisible);
frozenPane.setVisible(appRelayout);
mobileWidgetListPane.updateToDesigner(); mobileWidgetListPane.updateToDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
if (advancePane.isVisible()) { if (advancePane.isVisible()) {
advancePane.update((RichStyleWidgetProvider) getBodyCreator().toData()); marginPane.update((RichStyleWidgetProvider) getBodyCreator().toData());
} }
if (intervalPane.isVisible()) { if (layoutPane.isVisible()) {
intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData());
} }
if (appRelayout) {
frozenPane.update(designer.getSelectionModel().getSelection().getSelectedCreator());
}
} }
} }

15
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java

@ -48,6 +48,7 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private UILabel tipLabel; private UILabel tipLabel;
private UICheckBox allowFullCheckBox;//允许全屏 private UICheckBox allowFullCheckBox;//允许全屏
private UICheckBox functionalWhenUnactivatedCheckBox;//组件未激活时可使用组件内功能
public ChartEditorDefinePane(XCreator xCreator) { public ChartEditorDefinePane(XCreator xCreator) {
this.xCreator = xCreator; this.xCreator = xCreator;
@ -88,6 +89,8 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
panel.add(unavailableTipLabel, BorderLayout.NORTH); panel.add(unavailableTipLabel, BorderLayout.NORTH);
allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen")); allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen"));
panel.add(allowFullCheckBox); panel.add(allowFullCheckBox);
functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"));
panel.add(functionalWhenUnactivatedCheckBox);
return panel; return panel;
} }
@ -98,19 +101,21 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
tipLabel.setForeground(Color.gray); tipLabel.setForeground(Color.gray);
updateTipLabel(); updateTipLabel();
allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen")); allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen"));
functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"));
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_Out_Logic"), SwingConstants.LEFT), zoomOutComboBox}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_Out_Logic"), SwingConstants.LEFT), zoomOutComboBox},
new Component[] {tipLabel, null}, new Component[] {tipLabel, null},
new Component[] {allowFullCheckBox} new Component[] {allowFullCheckBox, null},
new Component[] {functionalWhenUnactivatedCheckBox, null}
}; };
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p}; double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f}; double[] columnSize = {p,f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE); final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -154,6 +159,8 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
BaseChartEditor chartEditor = (BaseChartEditor)xCreator.toData(); BaseChartEditor chartEditor = (BaseChartEditor)xCreator.toData();
boolean allowFullScreen = chartEditor.getMobileAttr().isAllowFullScreen(); boolean allowFullScreen = chartEditor.getMobileAttr().isAllowFullScreen();
this.allowFullCheckBox.setSelected(allowFullScreen); this.allowFullCheckBox.setSelected(allowFullScreen);
boolean isFunctionalWhenUnactivated = chartEditor.getMobileAttr().isFunctionalWhenUnactivated();
this.functionalWhenUnactivatedCheckBox.setSelected(isFunctionalWhenUnactivated);
this.bindListeners2Widgets(); this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener); this.addAttributeChangeListener(changeListener);
@ -188,8 +195,10 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
mobileAttr.setZoomInAttr(ChartMobileFitAttrState.PROPORTION); mobileAttr.setZoomInAttr(ChartMobileFitAttrState.PROPORTION);
mobileAttr.setZoomOutAttr((ChartMobileFitAttrState) ((Item) zoomOutComboBox.getSelectedItem()).getValue()); mobileAttr.setZoomOutAttr((ChartMobileFitAttrState) ((Item) zoomOutComboBox.getSelectedItem()).getValue());
mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected()); mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected());
mobileAttr.setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected());
}else { }else {
mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected()); mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected());
mobileAttr.setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected());
} }
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
} }

40
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -29,10 +29,10 @@ import java.awt.Component;
/** /**
* 报表块-移动端属性面板 * 报表块-移动端属性面板
* * <p>
* Created by fanglei on 2017/8/8. * Created by fanglei on 2017/8/8.
*/ */
public class ElementCaseDefinePane extends MobileWidgetDefinePane{ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
private static final double MAX_HEIGHT_LIMIT = 0.8; private static final double MAX_HEIGHT_LIMIT = 0.8;
private static final Item[] ITEMS = { private static final Item[] ITEMS = {
new Item(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL), new Item(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL),
@ -50,8 +50,9 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
private UISpinner maxHeightSpinner; // 最大高度Spinner private UISpinner maxHeightSpinner; // 最大高度Spinner
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private UICheckBox allowFullCheckBox; private UICheckBox allowFullCheckBox;
private UICheckBox functionalWhenUnactivatedCheckBox;
public ElementCaseDefinePane (XCreator xCreator) { public ElementCaseDefinePane(XCreator xCreator) {
this.xCreator = xCreator; this.xCreator = xCreator;
} }
@ -87,19 +88,22 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen")); allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen"));
functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"));
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal"), SwingConstants.LEFT), hComboBox}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal"), SwingConstants.LEFT), hComboBox},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Vertical"), SwingConstants.LEFT), vComboBox}, new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Vertical"), SwingConstants.LEFT), vComboBox},
new Component[] {heightRestrictCheckBox, null}, new Component[] {heightRestrictCheckBox, null},
new Component[] {allowFullCheckBox}, new Component[] {allowFullCheckBox, null},
new Component[] {functionalWhenUnactivatedCheckBox, null},
new Component[] {maxHeightLabel, maxHeightSpinner} new Component[] {maxHeightLabel, maxHeightSpinner}
}; };
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p,f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE); final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
panelWrapper.add(panel, BorderLayout.NORTH); panelWrapper.add(panel, BorderLayout.NORTH);
@ -131,14 +135,15 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
public void populate(FormDesigner designer) { public void populate(FormDesigner designer) {
this.designer = designer; this.designer = designer;
this.addAttributeChangeListener(changeListener); this.addAttributeChangeListener(changeListener);
ElementCaseEditor elementCaseEditor = (ElementCaseEditor)xCreator.toData(); ElementCaseEditor elementCaseEditor = (ElementCaseEditor) xCreator.toData();
this.hComboBox.setSelectedItem(new Item (elementCaseEditor.getHorziontalAttr().description(), elementCaseEditor.getHorziontalAttr())); this.hComboBox.setSelectedItem(new Item(elementCaseEditor.getHorziontalAttr().description(), elementCaseEditor.getHorziontalAttr()));
this.vComboBox.setSelectedItem(new Item (elementCaseEditor.getVerticalAttr().description(), elementCaseEditor.getVerticalAttr())); this.vComboBox.setSelectedItem(new Item(elementCaseEditor.getVerticalAttr().description(), elementCaseEditor.getVerticalAttr()));
this.heightRestrictCheckBox.setSelected(elementCaseEditor.isHeightRestrict()); this.heightRestrictCheckBox.setSelected(elementCaseEditor.isHeightRestrict());
this.maxHeightLabel.setVisible(elementCaseEditor.isHeightRestrict()); this.maxHeightLabel.setVisible(elementCaseEditor.isHeightRestrict());
this.maxHeightSpinner.setVisible(elementCaseEditor.isHeightRestrict()); this.maxHeightSpinner.setVisible(elementCaseEditor.isHeightRestrict());
this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent()); this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent());
this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen()); this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen());
this.functionalWhenUnactivatedCheckBox.setSelected(elementCaseEditor.isFunctionalWhenUnactivated());
} }
@Override @Override
@ -147,22 +152,24 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
String globalName = this.getGlobalName(); String globalName = this.getGlobalName();
switch (globalName) { switch (globalName) {
case "hComboBox": case "hComboBox":
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(((MobileFitAttrState)((Item)hComboBox.getSelectedItem()).getValue())); ((ElementCaseEditor) xCreator.toData()).setHorziontalAttr(((MobileFitAttrState) ((Item) hComboBox.getSelectedItem()).getValue()));
break; break;
case "vComboBox": case "vComboBox":
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(((MobileFitAttrState)((Item)vComboBox.getSelectedItem()).getValue())); ((ElementCaseEditor) xCreator.toData()).setVerticalAttr(((MobileFitAttrState) ((Item) vComboBox.getSelectedItem()).getValue()));
break; break;
case "heightRestrictCheckBox": case "heightRestrictCheckBox":
boolean isHeightRestrict = heightRestrictCheckBox.isSelected(); boolean isHeightRestrict = heightRestrictCheckBox.isSelected();
((ElementCaseEditor)xCreator.toData()).setHeightRestrict(isHeightRestrict); ((ElementCaseEditor) xCreator.toData()).setHeightRestrict(isHeightRestrict);
maxHeightSpinner.setVisible(isHeightRestrict); maxHeightSpinner.setVisible(isHeightRestrict);
maxHeightLabel.setVisible(isHeightRestrict); maxHeightLabel.setVisible(isHeightRestrict);
break; break;
case "maxHeightSpinner": case "maxHeightSpinner":
((ElementCaseEditor)xCreator.toData()).setHeightPercent(maxHeightSpinner.getValue()); ((ElementCaseEditor) xCreator.toData()).setHeightPercent(maxHeightSpinner.getValue());
break; break;
case "allowFullCheckBox": case "allowFullCheckBox":
((ElementCaseEditor)xCreator.toData()).setAllowFullScreen(allowFullCheckBox.isSelected()); ((ElementCaseEditor) xCreator.toData()).setAllowFullScreen(allowFullCheckBox.isSelected());
case "functionalWhenUnactivatedCheckBox":
((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected());
} }
} }
@ -172,6 +179,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
this.heightRestrictCheckBox.setGlobalName("heightRestrictCheckBox"); this.heightRestrictCheckBox.setGlobalName("heightRestrictCheckBox");
this.maxHeightSpinner.setGlobalName("maxHeightSpinner"); this.maxHeightSpinner.setGlobalName("maxHeightSpinner");
this.allowFullCheckBox.setGlobalName("allowFullCheckBox"); this.allowFullCheckBox.setGlobalName("allowFullCheckBox");
this.functionalWhenUnactivatedCheckBox.setGlobalName("functionalWhenUnactivatedCheckBox");
} }
} }

19
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java

@ -4,6 +4,7 @@ import com.fr.base.iofile.attr.FormTabPaddingAttrMark;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -13,7 +14,7 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor;
import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane; import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentAdvancePane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle;
@ -27,7 +28,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
private FormDesigner designer; // 当前设计器 private FormDesigner designer; // 当前设计器
private AccessibleTemplateStyleEditor templateStyleEditor; private AccessibleTemplateStyleEditor templateStyleEditor;
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private MobileComponentAdvancePane advancePane; private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane; private MobileComponentLayoutIntervalPane intervalPane;
public TabMobileWidgetDefinePane(XCreator xCreator) { public TabMobileWidgetDefinePane(XCreator xCreator) {
@ -61,12 +62,14 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(jPanel, BorderLayout.NORTH); holder.add(jPanel, BorderLayout.NORTH);
if (!shouldHidePadding(designer)) { if (!shouldHidePadding(designer)) {
advancePane = new MobileComponentAdvancePane(FormTabPaddingAttrMark.XML_TAG); marginPane = new MobileComponentMarginPane(FormTabPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG);
UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane);
UIExpandablePane layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, intervalPane);
//高级 //高级
holder.add(advancePane, BorderLayout.CENTER); holder.add(advancePane, BorderLayout.CENTER);
//布局 //布局
holder.add(intervalPane, BorderLayout.SOUTH); holder.add(layoutPane, BorderLayout.SOUTH);
} }
this.add(holder, BorderLayout.NORTH); this.add(holder, BorderLayout.NORTH);
@ -78,8 +81,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
// 数据 populate 完成后,再设置监听 // 数据 populate 完成后,再设置监听
this.bindListeners2Widgets(); this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener); this.addAttributeChangeListener(changeListener);
if (advancePane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点 if (marginPane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点
advancePane.populate((WCardTagLayout) xCreator.toData()); marginPane.populate((WCardTagLayout) xCreator.toData());
} }
if (intervalPane != null) { if (intervalPane != null) {
intervalPane.populate((WCardTagLayout) xCreator.toData()); intervalPane.populate((WCardTagLayout) xCreator.toData());
@ -90,8 +93,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
public void update() { public void update() {
((WCardTagLayout) xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue()); ((WCardTagLayout) xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
if (advancePane != null) { if (marginPane != null) {
advancePane.update((WCardTagLayout) xCreator.toData()); marginPane.update((WCardTagLayout) xCreator.toData());
} }
if (intervalPane != null) { if (intervalPane != null) {
intervalPane.update((WCardTagLayout) xCreator.toData()); intervalPane.update((WCardTagLayout) xCreator.toData());

92
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java

@ -0,0 +1,92 @@
package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WSortLayout;
import com.fr.stable.ArrayUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author Hades
* @date 2019/8/14
*/
public class MobileComponentFrozenPane extends BasicPane {
private UIComboCheckBox uiComboCheckBox;
public MobileComponentFrozenPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel frozenLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Frozen"));
uiComboCheckBox = new UIComboCheckBox(initData());
JPanel wrapJPanel = UIComponentUtils.wrapWithBorderLayoutPane(uiComboCheckBox);
Component[][] components = new Component[][]{
new Component[]{frozenLabel, wrapJPanel}
};
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 10, 0));
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(centerPane, BorderLayout.NORTH);
this.add(holder, BorderLayout.NORTH);
}
private String[] initData() {
FormDesigner designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
Widget selectedModel = selectedCreator != null ? selectedCreator.toData() : null;
if (selectedModel == null || !selectedModel.acceptType(WSortLayout.class)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> widgetList = ((WSortLayout) selectedModel).getNonContainerWidgetList();
return widgetList.toArray(new String[0]);
}
public void update(XCreator xCreator) {
List<String> selected = new ArrayList<>();
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
Object[] values = uiComboCheckBox.getSelectedValues();
for (Object widgetName : values) {
selected.add((String) widgetName);
}
wSortLayout.updateFrozenWidgets(selected);
}
public void populate(XCreator xCreator) {
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
List<String> all = wSortLayout.getNonContainerWidgetList();
List<String> selected = wSortLayout.getFrozenWidgets();
Map<Object, Boolean> map = new LinkedHashMap<>();
for (String value : selected) {
map.put(value, true);
}
all.removeAll(selected);
for (String value : all) {
map.put(value, false);
}
uiComboCheckBox.setSelectedValues(map);
}
@Override
protected String title4PopupWindow() {
return "ComponentFrozenPane";
}
}

18
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java

@ -3,7 +3,6 @@ package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.base.iofile.attr.AttrMarkFactory; import com.fr.base.iofile.attr.AttrMarkFactory;
import com.fr.base.iofile.attr.FormBodyPaddingAttrMark; import com.fr.base.iofile.attr.FormBodyPaddingAttrMark;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -29,24 +28,17 @@ public class MobileComponentLayoutIntervalPane extends XmlRelationedBasicPane {
super(xmlTag); super(xmlTag);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel intervalLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval")); UILabel intervalLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, FormBodyPaddingAttrMark.DEFAULT_SIZE); componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, FormBodyPaddingAttrMark.DEFAULT_SIZE);
JPanel componentIntervelPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel); JPanel componentIntervalPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{intervalLabel, componentIntervelPane} new Component[]{intervalLabel, componentIntervalPane}
}; };
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 0, 0)); centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 10, 0));
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(centerPane, BorderLayout.NORTH); holder.add(centerPane, BorderLayout.NORTH);
UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, holder); this.add(holder, BorderLayout.NORTH);
this.add(layoutExpandablePane, BorderLayout.NORTH);
} }
@Override @Override

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentAdvancePane.java → designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentMarginPane.java

@ -2,7 +2,6 @@ package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.base.iofile.attr.AttrMarkFactory; import com.fr.base.iofile.attr.AttrMarkFactory;
import com.fr.base.iofile.attr.FormBodyPaddingAttrMark; import com.fr.base.iofile.attr.FormBodyPaddingAttrMark;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.ui.designer.XmlRelationedBasicPane; import com.fr.design.widget.ui.designer.XmlRelationedBasicPane;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
@ -13,20 +12,19 @@ import java.awt.BorderLayout;
/** /**
* 只有内边距设置的高级设置 * 只有内边距设置的高级设置
*/ */
public class MobileComponentAdvancePane extends XmlRelationedBasicPane { public class MobileComponentMarginPane extends XmlRelationedBasicPane {
private PaddingBoundPane paddingBound; private PaddingBoundPane paddingBound;
public MobileComponentAdvancePane(String xmlTag) { public MobileComponentMarginPane(String xmlTag) {
super(xmlTag); super(xmlTag);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
paddingBound = new PaddingBoundPane(FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE); paddingBound = new PaddingBoundPane(FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE);
UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, paddingBound); this.add(paddingBound, BorderLayout.NORTH);
this.add(advanceExpandablePane, BorderLayout.NORTH);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "ComponentAdvancePane"; return "ComponentMarginPane";
} }
public void update(RichStyleWidgetProvider marginWidget) { public void update(RichStyleWidgetProvider marginWidget) {

153
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -54,7 +54,6 @@ import java.util.concurrent.TimeUnit;
/** /**
* @author neil * @author neil
*
* @date: 2015-4-8-下午5:11:46 * @date: 2015-4-8-下午5:11:46
*/ */
public class InformationCollector implements XMLReadable, XMLWriter { public class InformationCollector implements XMLReadable, XMLWriter {
@ -83,17 +82,17 @@ public class InformationCollector implements XMLReadable, XMLWriter {
private String lastTime; private String lastTime;
private StartStopTime current = new StartStopTime(); private StartStopTime current = new StartStopTime();
public static InformationCollector getInstance(){ public static InformationCollector getInstance() {
if (collector == null) { if (collector == null) {
collector = new InformationCollector(); collector = new InformationCollector();
readEncodeXMLFile(collector, collector.getInfoFile()); readEncodeXMLFile(collector, collector.getInfoFile());
} }
return collector; return collector;
} }
private static void readEncodeXMLFile(XMLReadable xmlReadable, File xmlFile){ private static void readEncodeXMLFile(XMLReadable xmlReadable, File xmlFile) {
if (xmlFile == null || !xmlFile.exists()) { if (xmlFile == null || !xmlFile.exists()) {
return; return;
} }
@ -110,22 +109,22 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
xmlInputStream.close(); xmlInputStream.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (IOException e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (XMLStreamException e) { } catch (XMLStreamException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
private static String getDecodeFileContent(File xmlFile) throws FileNotFoundException, UnsupportedEncodingException{ private static String getDecodeFileContent(File xmlFile) throws FileNotFoundException, UnsupportedEncodingException {
InputStream encodeInputStream = new FileInputStream(xmlFile); InputStream encodeInputStream = new FileInputStream(xmlFile);
String encodeContent = IOUtils.inputStream2String(encodeInputStream); String encodeContent = IOUtils.inputStream2String(encodeInputStream);
return DesUtils.getDecString(encodeContent); return DesUtils.getDecString(encodeContent);
} }
private long getLastTimeMillis(){ private long getLastTimeMillis() {
if (StringUtils.isEmpty(this.lastTime)) { if (StringUtils.isEmpty(this.lastTime)) {
return 0; return 0;
} }
@ -138,7 +137,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
private JSONObject getJSONContentAsByte(){ private JSONObject getJSONContentAsByte() {
JSONObject content = new JSONObject(); JSONObject content = new JSONObject();
JSONArray startStopArray = new JSONArray(); JSONArray startStopArray = new JSONArray();
@ -159,7 +158,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
return content; return content;
} }
private void sendUserInfo(){ private void sendUserInfo() {
long currentTime = new Date().getTime(); long currentTime = new Date().getTime();
long lastTime = getLastTimeMillis(); long lastTime = getLastTimeMillis();
@ -178,7 +177,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
if (success){ if (success) {
this.reset(); this.reset();
} }
} }
@ -186,13 +185,13 @@ public class InformationCollector implements XMLReadable, XMLWriter {
/** /**
* 收集开始使用时间发送信息 * 收集开始使用时间发送信息
*/ */
public void collectStartTime(){ public void collectStartTime() {
this.current.setStartDate(dateToString()); this.current.setStartDate(dateToString());
sendUserInfoInOtherThread(); sendUserInfoInOtherThread();
} }
private void sendUserInfoInOtherThread(){ private void sendUserInfoInOtherThread() {
if (!DesignerEnvManager.getEnvManager().isJoinProductImprove() || !FRContext.isChineseEnv()) { if (!DesignerEnvManager.getEnvManager().isJoinProductImprove() || !FRContext.isChineseEnv()) {
return; return;
} }
@ -209,67 +208,57 @@ public class InformationCollector implements XMLReadable, XMLWriter {
}, SEND_DELAY, TimeUnit.MILLISECONDS); }, SEND_DELAY, TimeUnit.MILLISECONDS);
} }
/** /**
* 收集结束使用时间 * 收集结束使用时间
*/ */
public void collectStopTime(){ public void collectStopTime() {
this.current.setStopDate(dateToString()); this.current.setStopDate(dateToString());
} }
private String dateToString(){ private String dateToString() {
DateFormat df = FRContext.getDefaultValues().getDateTimeFormat(); DateFormat df = FRContext.getDefaultValues().getDateTimeFormat();
return df.format(new Date()); return df.format(new Date());
} }
private void reset(){ private void reset() {
this.startStop.clear(); this.startStop.clear();
this.lastTime = dateToString(); this.lastTime = dateToString();
} }
private File getInfoFile() { private File getInfoFile() {
return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FILE_NAME)); return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FILE_NAME));
} }
/** /**
* 保存xml文件 * 保存xml文件
*/ */
public void saveXMLFile() { public void saveXMLFile() {
File xmlFile = this.getInfoFile(); File xmlFile = this.getInfoFile();
try{ try {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLTools.writeOutputStreamXML(this, out); XMLTools.writeOutputStreamXML(this, out);
out.flush(); out.flush();
out.close(); out.close();
String fileContent = new String(out.toByteArray(), EncodeConstants.ENCODING_UTF_8); String fileContent = new String(out.toByteArray(), EncodeConstants.ENCODING_UTF_8);
String encodeCotent = DesUtils.getEncString(fileContent); String encodeCotent = DesUtils.getEncString(fileContent);
writeEncodeContentToFile(encodeCotent, xmlFile); writeEncodeContentToFile(encodeCotent, xmlFile);
}catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
/** /**
* 将文件内容写到输出流中 * 将文件内容写到输出流中
*/ */
private static void writeEncodeContentToFile(String fileContent, File file){ private static void writeEncodeContentToFile(String fileContent, File file) {
BufferedWriter bw = null; try (FileOutputStream fos = new FileOutputStream(file);
try { OutputStreamWriter osw = new OutputStreamWriter(fos, EncodeConstants.ENCODING_UTF_8);
FileOutputStream fos = new FileOutputStream(file); BufferedWriter bw = new BufferedWriter(osw)) {
OutputStreamWriter osw = new OutputStreamWriter(fos, EncodeConstants.ENCODING_UTF_8);
bw = new BufferedWriter(osw);
bw.write(fileContent); bw.write(fileContent);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
if(bw != null){
try {
bw.close();
} catch (IOException e) {
}
}
} }
} }
@Override @Override
@ -284,56 +273,56 @@ public class InformationCollector implements XMLReadable, XMLWriter {
writer.end(); writer.end();
} }
private void writeStartStopList(XMLPrintWriter writer){ private void writeStartStopList(XMLPrintWriter writer) {
//启停 //启停
writer.startTAG(XML_START_STOP_LIST); writer.startTAG(XML_START_STOP_LIST);
for (int i = 0; i < startStop.size(); i++) { for (int i = 0; i < startStop.size(); i++) {
startStop.get(i).writeXML(writer); startStop.get(i).writeXML(writer);
} }
writer.end(); writer.end();
} }
private void writeTag(String tag, String content, XMLPrintWriter writer){ private void writeTag(String tag, String content, XMLPrintWriter writer) {
if (StringUtils.isEmpty(content)) { if (StringUtils.isEmpty(content)) {
return; return;
} }
writer.startTAG(tag); writer.startTAG(tag);
writer.textNode(content); writer.textNode(content);
writer.end(); writer.end();
} }
@Override @Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
if (reader.isChildNode()) { if (reader.isChildNode()) {
String name = reader.getTagName(); String name = reader.getTagName();
if (XML_START_STOP_LIST.equals(name)) { if (XML_START_STOP_LIST.equals(name)) {
readStartStopList(reader); readStartStopList(reader);
} else if(XML_LAST_TIME.equals(name)){ } else if (XML_LAST_TIME.equals(name)) {
readLastTime(reader); readLastTime(reader);
} }
} }
} }
private void readLastTime(XMLableReader reader){ private void readLastTime(XMLableReader reader) {
String tmpVal; String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) { if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.lastTime = tmpVal; this.lastTime = tmpVal;
} }
} }
private void readStartStopList(XMLableReader reader){ private void readStartStopList(XMLableReader reader) {
startStop.clear(); startStop.clear();
reader.readXMLObject(new XMLReadable() { reader.readXMLObject(new XMLReadable() {
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
if (XML_START_STOP.equals(reader.getTagName())) { if (XML_START_STOP.equals(reader.getTagName())) {
StartStopTime startStopTime = new StartStopTime(); StartStopTime startStopTime = new StartStopTime();
reader.readXMLObject(startStopTime); reader.readXMLObject(startStopTime);
startStop.add(startStopTime); startStop.add(startStopTime);
} }
} }
}); });
} }
private class StartStopTime implements XMLReadable, XMLWriter { private class StartStopTime implements XMLReadable, XMLWriter {
@ -358,14 +347,14 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_START_STOP); writer.startTAG(XML_START_STOP);
if (StringUtils.isNotEmpty(startDate)) { if (StringUtils.isNotEmpty(startDate)) {
writer.attr(ATTR_START, this.startDate); writer.attr(ATTR_START, this.startDate);
} }
if (StringUtils.isNotEmpty(stopDate)) { if (StringUtils.isNotEmpty(stopDate)) {
writer.attr(ATTR_STOP, this.stopDate); writer.attr(ATTR_STOP, this.stopDate);
} }
writer.end(); writer.end();
} }
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {

12
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -95,10 +95,6 @@ import com.fr.stable.module.Module;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.web.controller.ViewRequestConstants; import com.fr.web.controller.ViewRequestConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -106,6 +102,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
/** /**
* JWorkBook used to edit WorkBook. * JWorkBook used to edit WorkBook.
@ -1103,9 +1102,8 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
// 弹出输入参数 // 弹出输入参数
java.util.Map<String, Object> parameterMap = inputParameters(tpl); java.util.Map<String, Object> parameterMap = inputParameters(tpl);
try { String fullPath = StableUtils.pathJoin(WorkContext.getCurrent().getPath(), newFile.getPath());
String fullPath = StableUtils.pathJoin(WorkContext.getCurrent().getPath(), newFile.getPath()); try (FileOutputStream fileOutputStream = new FileOutputStream(fullPath)) {
FileOutputStream fileOutputStream = new FileOutputStream(fullPath);
EmbeddedTableDataExporter exporter = new EmbeddedTableDataExporter(); EmbeddedTableDataExporter exporter = new EmbeddedTableDataExporter();
exporter.export(fileOutputStream, tpl, parameterMap); exporter.export(fileOutputStream, tpl, parameterMap);
} catch (Exception e1) { } catch (Exception e1) {

18
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java

@ -2,14 +2,17 @@ package com.fr.design.mainframe.errorinfo;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.core.UUID; import com.fr.stable.core.UUID;
import java.io.ByteArrayInputStream;
import java.io.*; import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Date; import java.util.Date;
@ -124,13 +127,14 @@ public class ErrorInfo {
String content = jo.toString(); String content = jo.toString();
String fileName = UUID.randomUUID() + ErrorInfoUploader.SUFFIX; String fileName = UUID.randomUUID() + ErrorInfoUploader.SUFFIX;
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), ErrorInfoUploader.FOLDER_NAME, fileName)); File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), ErrorInfoUploader.FOLDER_NAME, fileName));
try { FileOutputStream out = null;
try (InputStream in = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))) {
StableUtils.makesureFileExist(file); StableUtils.makesureFileExist(file);
FileOutputStream out = new FileOutputStream(file); out = new FileOutputStream(file);
InputStream in = new ByteArrayInputStream(content.getBytes(EncodeConstants.ENCODING_UTF_8));
IOUtils.copyBinaryTo(in, out); IOUtils.copyBinaryTo(in, out);
out.close();
} catch (IOException ignore) { } catch (IOException ignore) {
} finally {
IOUtils.close(out);
} }
} }
} }

20
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java

@ -19,7 +19,9 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.UUID; import java.util.UUID;
import java.util.zip.ZipOutputStream;
/** /**
* @author alex sung * @author alex sung
@ -52,13 +54,15 @@ public class FileEntityBuilder {
return null; return null;
} }
File zipFile = null; File zipFile = null;
ZipOutputStream zipOut = null;
try { try {
zipFile = new File(pathName + ".zip"); zipFile = new File(pathName + ".zip");
java.util.zip.ZipOutputStream zipOut = new java.util.zip.ZipOutputStream(new FileOutputStream(zipFile)); zipOut = new ZipOutputStream(new FileOutputStream(zipFile));
IOUtils.zip(zipOut, new File(pathName)); IOUtils.zip(zipOut, new File(pathName));
zipOut.close();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
IOUtils.close(zipOut);
} }
return zipFile; return zipFile;
} }
@ -67,18 +71,18 @@ public class FileEntityBuilder {
if (jsonArray.size() == 0) { if (jsonArray.size() == 0) {
return; return;
} }
try { FileOutputStream out = null;
String content = jsonArray.toString(); String content = jsonArray.toString();
try (InputStream in = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))) {
String fileName = String.valueOf(UUID.randomUUID()); String fileName = String.valueOf(UUID.randomUUID());
File file = new File(folderName + File.separator + fileName + ".json"); File file = new File(folderName + File.separator + fileName + ".json");
StableUtils.makesureFileExist(file); StableUtils.makesureFileExist(file);
FileOutputStream out = new FileOutputStream(file); out = new FileOutputStream(file);
InputStream in = new ByteArrayInputStream(content.getBytes(EncodeConstants.ENCODING_UTF_8));
IOUtils.copyBinaryTo(in, out); IOUtils.copyBinaryTo(in, out);
in.close();
out.close();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
IOUtils.close(out);
} }
} }

7
designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java

@ -18,6 +18,9 @@ public class MobileOthersPane extends BasicBeanPane<ElementCaseMobileAttr> {
private MobileRadioCheckPane appearRefreshCheckPane; // 页面再现时刷新 private MobileRadioCheckPane appearRefreshCheckPane; // 页面再现时刷新
// 允许双击/双指缩放
private MobileRadioCheckPane allowDoubleClickOrZoomCheckPane;
public MobileOthersPane() { public MobileOthersPane() {
this.initComponents(); this.initComponents();
} }
@ -29,6 +32,8 @@ public class MobileOthersPane extends BasicBeanPane<ElementCaseMobileAttr> {
contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0)); contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0));
appearRefreshCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Appear_Refresh")); appearRefreshCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Appear_Refresh"));
contentPane.add(appearRefreshCheckPane, BorderLayout.WEST); contentPane.add(appearRefreshCheckPane, BorderLayout.WEST);
allowDoubleClickOrZoomCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("允许双击/双指缩放"));
contentPane.add(allowDoubleClickOrZoomCheckPane, BorderLayout.CENTER);
borderPane.add(contentPane); borderPane.add(contentPane);
this.add(borderPane); this.add(borderPane);
} }
@ -39,6 +44,7 @@ public class MobileOthersPane extends BasicBeanPane<ElementCaseMobileAttr> {
ob = new ElementCaseMobileAttr(); ob = new ElementCaseMobileAttr();
} }
this.appearRefreshCheckPane.populateBean(ob.isAppearRefresh()); this.appearRefreshCheckPane.populateBean(ob.isAppearRefresh());
this.allowDoubleClickOrZoomCheckPane.populateBean(ob.isAllowDoubleClickOrZoom());
} }
@Override @Override
@ -50,6 +56,7 @@ public class MobileOthersPane extends BasicBeanPane<ElementCaseMobileAttr> {
public void updateBean(ElementCaseMobileAttr mobileAttr) { public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) { if(mobileAttr != null) {
mobileAttr.setAppearRefresh(this.appearRefreshCheckPane.updateBean()); mobileAttr.setAppearRefresh(this.appearRefreshCheckPane.updateBean());
mobileAttr.setAllowDoubleClickOrZoom(this.allowDoubleClickOrZoomCheckPane.updateBean());
} }
} }

5
designer-sdk/pom.xml

@ -17,10 +17,5 @@
<artifactId>designer-realize</artifactId> <artifactId>designer-realize</artifactId>
<version>10.0</version> <version>10.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.fr.report</groupId>
<artifactId>sdk-base</artifactId>
<version>10.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

80
designer-sdk/src/main/java/com/fr/sdk/designer/FineDesignUtils.java

@ -1,80 +0,0 @@
package com.fr.sdk.designer;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.RestrictionActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.scheduler.SchedulerActivator;
import com.fr.sdk.server.shell.ModuleShell;
import com.fr.serialization.SerializationActivator;
import com.fr.stable.StringUtils;
import com.fr.startup.WorkspaceRegister;
import com.fr.store.StateServerActivator;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.WorkspaceActivator;
import com.fr.workspace.server.ServerWorkspaceRegister;
/**
* 设计器SDK模块工具类用来放一些设计器相关插件开发过程中常用的工具函数
*/
public class FineDesignUtils {
/**
* 创建一个连接远程服务器的模块
* @param remoteUrl 远程服务器地址
* @param username 用户名
* @param password 密码
* @return 模块代理对象 使用ModuleShell的start和stop控制模块启停
*/
public static ModuleShell createRemoteServerModule(String remoteUrl, String username, String password) {
return createRemoteServerModule(remoteUrl, username, password, StringUtils.EMPTY, StringUtils.EMPTY);
}
/**
* 创建一个连接远程服务器的模块
* @param remoteUrl 远程服务器地址
* @param username 用户名
* @param password 密码
* @param certPath https证书路径
* @param certSecretKey 证书秘钥
* @return 模块代理对象 使用ModuleShell的start和stop控制模块启停
*/
public static ModuleShell createRemoteServerModule(final String remoteUrl, final String username, final String password, final String certPath, final String certSecretKey) {
Module module = ActivatorToolBox.simpleLink(
new WorkspaceActivator(),
new SerializationActivator(),
new Activator() {
@Override
public void start() {
WorkspaceConnectionInfo connectionInfo = new WorkspaceConnectionInfo(remoteUrl, username, password, certPath, certSecretKey);
try {
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(RemoteDesignerWorkspaceInfo.create(connectionInfo)));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(),e);
}
}
@Override
public void stop() {
}
},
new ConfigurationActivator(),
new StateServerActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WorkspaceRegister(),
new ServerWorkspaceRegister()
);
return new ModuleShell(module);
}
}

7
designer-sdk/src/test/java/com/fr/sdk/FineDesignUtilsTest.java

@ -1,7 +0,0 @@
package com.fr.sdk;
import junit.framework.TestCase;
public class FineDesignUtilsTest extends TestCase {
}
Loading…
Cancel
Save