Browse Source

解决冲突

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
56c45528e5
  1. 8
      designer-base/src/main/java/com/fr/design/actions/UpdateAction.java
  2. 9
      designer-base/src/main/java/com/fr/design/actions/file/OpenRecentReportMenuDef.java
  3. 11
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  4. 17
      designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java
  5. 53
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  6. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  7. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  8. 39
      designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java
  9. 12
      designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java
  10. 11
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  11. 55
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  12. 27
      designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java
  13. 56
      designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java
  14. 4
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  15. 16
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  16. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  17. 2
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  18. 7
      designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java
  19. 1
      designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java
  20. 7
      designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java

8
designer-base/src/main/java/com/fr/design/actions/UpdateAction.java

@ -17,6 +17,7 @@ import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinFormat; import com.fr.stable.pinyin.PinyinFormat;
import com.fr.stable.pinyin.PinyinHelper; import com.fr.stable.pinyin.PinyinHelper;
@ -562,7 +563,12 @@ public abstract class UpdateAction extends ShortCut implements Action {
for (int i = 0; i < component.getTabCount(); i++) { for (int i = 0; i < component.getTabCount(); i++) {
String title = component.getTitleAt(i); String title = component.getTitleAt(i);
handleSearchText(separator, text, pinyin, shortPinyin, title); handleSearchText(separator, text, pinyin, shortPinyin, title);
Component tabComponent = component.getComponentAt(i); Component tabComponent = null;
try {
tabComponent = component.getComponentAt(i);
} catch (Exception ignore) {
FineLoggerFactory.getLogger().info("AlphaFine index tabPane end");
}
if (tabComponent instanceof JPanel) { if (tabComponent instanceof JPanel) {
getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin); getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin);
} else if (tabComponent instanceof JTabbedPane) { } else if (tabComponent instanceof JTabbedPane) {

9
designer-base/src/main/java/com/fr/design/actions/file/OpenRecentReportMenuDef.java

@ -1,6 +1,7 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.File;
import java.util.List; import java.util.List;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
@ -11,6 +12,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
/** /**
* Open Resent MenuDef. * Open Resent MenuDef.
@ -68,7 +70,12 @@ public class OpenRecentReportMenuDef extends MenuDef {
* @param e 事件 * @param e 事件
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(this.getPath())); File file = new File(this.getPath());
if (file.exists()) {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(file));
} else {
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(this.getPath()));
}
} }
public String getPath() { public String getPath() {

11
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -446,7 +446,16 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
* @param srcName 数据集来源(比如报表块就是报表块的名称) * @param srcName 数据集来源(比如报表块就是报表块的名称)
* @param tableDataSource 数据集 * @param tableDataSource 数据集
*/ */
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource, boolean isCover) {
return new HashMap<>(0);
}
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) { public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) {
return new HashMap<>(0); return addTableData(srcName, tableDataSource, false);
}
public void removeTableData(String sourceName) {
} }
} }

17
designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java

@ -1,5 +1,6 @@
package com.fr.design.data; package com.fr.design.data;
import com.fr.data.TableDataSource;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -10,6 +11,7 @@ import com.fr.stable.StringUtils;
* Created by hades on 2020/4/27 * Created by hades on 2020/4/27
*/ */
public abstract class BasicTableDataUtils { public abstract class BasicTableDataUtils {
private static final String SEPARATOR = "-";
private static final int LEN = 2; private static final int LEN = 2;
@ -33,4 +35,19 @@ public abstract class BasicTableDataUtils {
} }
return false; return false;
} }
public static String getTableDataName(boolean isCover, TableDataSource tds, String tdName, String srcName, boolean isDsNameRepeaded) {
if (isCover) {
return srcName + SEPARATOR + tdName;
}
if (tds.getTableData(tdName) != null || isDsNameRepeaded) {//如果有同名的就拼上来源名称
tdName = srcName + SEPARATOR + tdName;
}
int i = 0;
while (tds.getTableData(tdName) != null) {
i++;//如果拼上名字后依然已经存在就加编号
tdName += i;
}
return tdName;
}
} }

53
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -9,6 +9,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.StoreProcedureWorkerListener;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
@ -59,7 +60,7 @@ import java.util.Map;
public class TableDataTreePane extends BasicTableDataTreePane { public class TableDataTreePane extends BasicTableDataTreePane {
private static TableDataTreePane singleton = new TableDataTreePane(); private static TableDataTreePane singleton = new TableDataTreePane();
public static final int PLUGIN_LISTENER_PRIORITY = 1; public static final int PLUGIN_LISTENER_PRIORITY = 1;
public synchronized static BasicTableDataTreePane getInstance(DesignModelAdapter<?, ?> tc) { public synchronized static BasicTableDataTreePane getInstance(DesignModelAdapter<?, ?> tc) {
@ -96,10 +97,10 @@ public class TableDataTreePane extends BasicTableDataTreePane {
addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH);
createAddMenuDef(); createAddMenuDef();
// 创建插件监听 // 创建插件监听
createPluginListener(); createPluginListener();
editAction = new EditAction(); editAction = new EditAction();
removeAction = new RemoveAction(); removeAction = new RemoveAction();
previewTableDataAction = new PreviewTableDataAction(dataTree); previewTableDataAction = new PreviewTableDataAction(dataTree);
@ -139,27 +140,27 @@ public class TableDataTreePane extends BasicTableDataTreePane {
new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY); new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY);
checkButtonEnabled(); checkButtonEnabled();
} }
private void createPluginListener() { private void createPluginListener() {
//菜单栏监听 //菜单栏监听
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
addMenuDef.clearShortCuts(); addMenuDef.clearShortCuts();
createAddMenuDef(); createAddMenuDef();
} }
}, new PluginFilter() { }, new PluginFilter() {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign); return context.contain(PluginModule.ExtraDesign);
} }
}); });
//监听数据集插件 //监听数据集插件
GeneralContext.listenPluginRunningChanged(new PluginEventListener() { GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override @Override
@ -188,8 +189,8 @@ public class TableDataTreePane extends BasicTableDataTreePane {
} }
}); });
} }
protected void checkButtonEnabled() { protected void checkButtonEnabled() {
super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree); super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree);
} }
@ -339,10 +340,11 @@ public class TableDataTreePane extends BasicTableDataTreePane {
/** /**
* 合并数据集 * 合并数据集
* @param srcName 数据集来源(比如报表块就是报表块的名称) *
* @param srcName 数据集来源(比如报表块就是报表块的名称)
* @param tableDataSource 数据集 * @param tableDataSource 数据集
*/ */
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) { public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource, boolean isCover) {
Map<String, String> tdNameMap = new HashMap<>(); Map<String, String> tdNameMap = new HashMap<>();
allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook());
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
@ -352,14 +354,8 @@ public class TableDataTreePane extends BasicTableDataTreePane {
String tdName = (String) tdIterator.next(); String tdName = (String) tdIterator.next();
String oldName = tdName; String oldName = tdName;
TableData td = tableDataSource.getTableData(tdName); TableData td = tableDataSource.getTableData(tdName);
if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称 boolean isDsNameRepeaded = isDsNameRepeaded(tdName);
tdName = srcName + tdName; tdName = BasicTableDataUtils.getTableDataName(isCover, tds, tdName, srcName, isDsNameRepeaded);
}
int i = 0;
while (tds.getTableData(tdName) != null) {
i++;//如果拼上名字后依然已经存在就加编号
tdName += i;
}
tds.putTableData(tdName, td); tds.putTableData(tdName, td);
if (!ComparatorUtils.equals(oldName, tdName)) { if (!ComparatorUtils.equals(oldName, tdName)) {
tdNameMap.put(oldName, tdName); tdNameMap.put(oldName, tdName);
@ -367,8 +363,19 @@ public class TableDataTreePane extends BasicTableDataTreePane {
} }
tc.parameterChanged(); tc.parameterChanged();
dataTree.refresh(); dataTree.refresh();
return Collections.unmodifiableMap(tdNameMap); return Collections.unmodifiableMap(tdNameMap);
} }
@Override
public void removeTableData(String sourceName) {
TableDataSource tds = tc.getBook();
tds.removeTableData(sourceName);
dataTree.refresh();
}
public void addDataPane(final AbstractTableDataPane<?> uPanel, String paneName) { public void addDataPane(final AbstractTableDataPane<?> uPanel, String paneName) {
final NamePane nPanel = uPanel.asNamePane(); final NamePane nPanel = uPanel.asNamePane();
nPanel.setObjectName(paneName); nPanel.setObjectName(paneName);

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

@ -9,12 +9,14 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.PopupDialogSaveAction;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -273,6 +275,8 @@ abstract class UIControlPane extends JControlPane {
} }
saveSettings(); saveSettings();
setVisible(false); setVisible(false);
PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
saveAction.unregister();
} }
private void initListener() { private void initListener() {

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

@ -7,9 +7,11 @@ import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.UINameEdList; import com.fr.design.gui.ilist.UINameEdList;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.PopupDialogSaveAction;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JList; import javax.swing.JList;
@ -216,6 +218,8 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
((PopupEditDialog)popupEditDialog).setTitle(getSelectedName()); ((PopupEditDialog)popupEditDialog).setTitle(getSelectedName());
} }
popupEditDialog.setVisible(true); popupEditDialog.setVisible(true);
PopupDialogSaveAction osBasedAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
osBasedAction.register(this, popupEditDialog);
} }
} }

39
designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java

@ -0,0 +1,39 @@
package com.fr.design.os.impl;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import java.awt.*;
/**
* linux下超链弹窗等保存问题
*
* @author hades
* @version 10.0
* Created by hades on 2020/7/21
*/
public class PopupDialogSaveAction implements OSBasedAction {
private UIListControlPane currentControlPane;
private Window popupDialog;
@Override
public void execute(Object... objects) {
boolean canSave = OperatingSystem.isLinux() && popupDialog != null && popupDialog.isVisible() && currentControlPane != null;
if (canSave) {
currentControlPane.saveSettings();
}
}
public void register(UIListControlPane currentControlPane, Window popupDialog) {
this.currentControlPane = currentControlPane;
this.popupDialog = popupDialog;
}
public void unregister() {
this.currentControlPane = null;
this.popupDialog = null;
}
}

12
designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java

@ -2,8 +2,6 @@ package com.fr.design.os.impl;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
/** /**
@ -12,14 +10,10 @@ import com.fr.stable.os.support.OSBasedAction;
* @date 2019/10/9 * @date 2019/10/9
*/ */
public class UpdateDialogAction implements OSBasedAction { public class UpdateDialogAction implements OSBasedAction {
private static String UPDATE_ROUTE = "#management/backup";
@Override @Override
public void execute(Object... objects) { public void execute(Object... objects) {
if(!OperatingSystem.isLinux()) { UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); dialog.showDialog();
dialog.showDialog();
}else{
DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null);
}
} }
} }

11
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java

@ -11,6 +11,7 @@ import com.fr.design.style.color.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.os.OperatingSystem;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -124,14 +125,20 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab
protected void addMouseDragListener() { protected void addMouseDragListener() {
this.addMouseMotionListener(new MouseAdapter() { this.addMouseMotionListener(new MouseAdapter() {
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
int oldIndex = index;
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
if (list.get(i).contains(e.getX(), e.getY())) { if (list.get(i).contains(e.getX(), e.getY())) {
index = i; index = i;
break; break;
} }
} }
if(OperatingSystem.isLinux() && AssistUtils.equals(oldIndex,index)){
if(Math.abs(p1.getX() - e.getX()) > Math.abs(p2.getX() - e.getX())){
index = 1;
}else{
index = 0;
}
}
boolean x = e.getX() <= max && e.getX() >= min; boolean x = e.getX() <= max && e.getX() >= min;
if (x && e.getY() < MAX_VERTICAL) { if (x && e.getY() < MAX_VERTICAL) {
list.get(index).setX(e.getX()); list.get(index).setX(e.getX());

55
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -27,6 +27,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
@ -387,31 +388,35 @@ public final class GUICoreUtils {
* @param y y坐标 * @param y y坐标
*/ */
public static void showPopupMenu(JPopupMenu popup, Component parentComponent, int x, int y) { public static void showPopupMenu(JPopupMenu popup, Component parentComponent, int x, int y) {
if (popup == null) {// check null. if (popup == null) {// check null.
return; return;
} }
Point point = new Point(x, y); Point point = new Point(x, y);
SwingUtilities.convertPointToScreen(point, parentComponent); SwingUtilities.convertPointToScreen(point, parentComponent);
Dimension size = popup.getPreferredSize(); Dimension size = popup.getPreferredSize();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP); screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP);
//父元素右边界的坐标
int showOnScreenX = Math.min(screen.width, parentComponent.getLocationOnScreen().x + parentComponent.getWidth()); int parentComponentRightBorderPosition = parentComponent.getLocationOnScreen().x + parentComponent.getWidth();
//设计器右边界的坐标
// peter:调整X的高度. Rectangle rectangle = DesignerContext.getDesignerFrame().getBounds();
if (point.x + size.width > showOnScreenX && size.width < showOnScreenX) { int designerRightBorderPosition = rectangle.x + rectangle.width;
x += (showOnScreenX - point.x - size.width); rectangle = SwingUtilities.getWindowAncestor(parentComponent).getBounds();
} designerRightBorderPosition = Math.max(designerRightBorderPosition, rectangle.x + rectangle.width);
// peter:调整X的高度.
// peter:调整y高度. if (point.x + size.width > designerRightBorderPosition && size.width < designerRightBorderPosition) {
if (point.y + size.height > screen.height && size.height < screen.height) { x += (parentComponentRightBorderPosition - point.x - size.width);
y -= size.height; }
}
// peter:调整y高度.
popup.show(parentComponent, x, y); if (point.y + size.height > screen.height && size.height < screen.height) {
} y -= size.height;
}
popup.show(parentComponent, x, y);
}
/** /**
* Set enabled.<br> * Set enabled.<br>

27
designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java

@ -1,6 +1,9 @@
package com.fr.design.data; package com.fr.design.data;
import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.easymock.EasyMock;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -41,4 +44,26 @@ public class BasicTableDataUtilsTest extends TestCase {
Assert.assertFalse(result12); Assert.assertFalse(result12);
} }
}
@Test
public void testGetTableDataName() {
TableDataSource source = EasyMock.mock(TableDataSource.class);
TableData tableData = EasyMock.mock(TableData.class);
EasyMock.expect(source.getTableData("ds1")).andReturn(tableData).anyTimes();
EasyMock.expect(source.getTableData("test-ds1")).andReturn(tableData).anyTimes();
EasyMock.expect(source.getTableData("test-ds11")).andReturn(null).anyTimes();
EasyMock.replay(source, tableData);
Assert.assertEquals("test-ds1", BasicTableDataUtils.getTableDataName(true, source, "ds1", "test", false));
Assert.assertEquals("test-ds11", BasicTableDataUtils.getTableDataName(false, source, "ds1", "test", false));
source = EasyMock.mock(TableDataSource.class);
EasyMock.expect(source.getTableData("ds1")).andReturn(null).anyTimes();
EasyMock.expect(source.getTableData("test-ds1")).andReturn(null).anyTimes();
EasyMock.replay(source);
Assert.assertEquals("test-ds1", BasicTableDataUtils.getTableDataName(true, source, "ds1", "test", false));
Assert.assertEquals("ds1", BasicTableDataUtils.getTableDataName(false, source, "ds1", "test", false));
Assert.assertEquals("test-ds1", BasicTableDataUtils.getTableDataName(false, source, "ds1", "test", true));
}
}

56
designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java

@ -2,14 +2,16 @@ package com.fr.design.module;
import com.fr.base.ChartColorMatching; import com.fr.base.ChartColorMatching;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane; import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar; import com.fr.design.style.background.gradient.FixedGradientBar;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -19,7 +21,6 @@ import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -35,8 +36,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
private JPanel changeColorSetPane; private JPanel changeColorSetPane;
private CardLayout cardLayout; private CardLayout cardLayout;
private UIButton accButton; private UIButtonGroup groupButton;
private UIButton gradientButton;
private ChartColorAdjustPane colorAdjustPane; private ChartColorAdjustPane colorAdjustPane;
private FixedGradientBar colorGradient; private FixedGradientBar colorGradient;
@ -52,22 +52,20 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
JPanel customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); JPanel customPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
JPanel buttonPane = new JPanel(); groupButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Custom_Color"), Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")});
buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT)); groupButton.setPreferredSize(new Dimension(155, 20));
buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Color"))); groupButton.setSelectedIndex(0);
buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color"))); customPane.add(groupButton, BorderLayout.NORTH);
customPane.add(buttonPane, BorderLayout.NORTH);
changeColorSetPane = new JPanel(cardLayout = new CardLayout()); changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); changeColorSetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 150), "gradient");
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc"); changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
cardLayout.show(changeColorSetPane, "acc"); cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER); customPane.add(changeColorSetPane, BorderLayout.CENTER);
accButton.setSelected(true); customPane.setPreferredSize(new Dimension(155, 200));
colorGradient.setPreferredSize(new Dimension(155, 30));
customPane.setPreferredSize(new Dimension(200, 200));
colorGradient.setPreferredSize(new Dimension(120, 30));
colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE); colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE);
colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER); colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER);
@ -84,24 +82,20 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
} }
private void initListener() { private void initListener() {
groupButton.addActionListener(new ActionListener() {
accButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
accButton.setSelected(true); checkCardPane();
gradientButton.setSelected(false);
cardLayout.show(changeColorSetPane, "acc");
} }
}); });
}
gradientButton.addActionListener(new ActionListener() { private void checkCardPane() {
@Override if (groupButton.getSelectedIndex() == 0) {
public void actionPerformed(ActionEvent e) { cardLayout.show(changeColorSetPane, "acc");
gradientButton.setSelected(true); } else {
accButton.setSelected(false); cardLayout.show(changeColorSetPane, "gradient");
cardLayout.show(changeColorSetPane, "gradient"); }
}
});
} }
@Override @Override
@ -117,8 +111,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
boolean isGradient = condition.getGradient(); boolean isGradient = condition.getGradient();
List<Color> colorList = condition.getColorList(); List<Color> colorList = condition.getColorList();
if (isGradient) { if (isGradient) {
gradientButton.setSelected(true); groupButton.setSelectedIndex(1);
accButton.setSelected(false);
cardLayout.show(changeColorSetPane, "gradient"); cardLayout.show(changeColorSetPane, "gradient");
if (colorList.size() == 2) { if (colorList.size() == 2) {
@ -127,8 +120,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
colorGradient.repaint(); colorGradient.repaint();
} }
} else { } else {
accButton.setSelected(true); groupButton.setSelectedIndex(0);
gradientButton.setSelected(false);
cardLayout.show(changeColorSetPane, "acc"); cardLayout.show(changeColorSetPane, "acc");
if (colorList.isEmpty()) { if (colorList.isEmpty()) {
@ -148,7 +140,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
List<Color> colorList = new ArrayList<Color>(); List<Color> colorList = new ArrayList<Color>();
if (gradientButton.isSelected()) { if (groupButton.getSelectedIndex() == 1) {
chartColorMatching.setGradient(true); chartColorMatching.setGradient(true);
Color start = colorGradient.getSelectColorPointBtnP1().getColorInner(); Color start = colorGradient.getSelectColorPointBtnP1().getColorInner();

4
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -306,12 +306,12 @@ public class SelectionModel {
// 清除被选中的组件 // 清除被选中的组件
selection.reset(); selection.reset();
} }
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED);
setSelectedCreator(isInPara ? designer.getParaComponent() : designer.getRootComponent());
setSelectedCreator(isInPara ? designer.getParaComponent() : designer.getRootComponent());
// 触发事件 // 触发事件
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED);
designer.repaint(); designer.repaint();
} }
} }

16
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -298,7 +298,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
@Override @Override
public JComponent createToolPane(BaseJForm jform, FormDesigner formEditor) { public JComponent createToolPane(BaseJForm jform, FormDesigner formEditor) {
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
if (isDedicateContainer()) { if (isDedicateContainer() && this.getComponentCount() > 0) {
// 图表块和报表块由于控件树处不显示,但对应的属性表要显示,此处处理下 // 图表块和报表块由于控件树处不显示,但对应的属性表要显示,此处处理下
XCreator child = ((XLayoutContainer) this).getXCreator(0); XCreator child = ((XLayoutContainer) this).getXCreator(0);
return child.createToolPane(jform, formEditor); return child.createToolPane(jform, formEditor);
@ -408,7 +408,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public Component getParentShow(){ public Component getParentShow(){
return this.getParent(); return this.getParent();
} }
/** /**
* 重置组件的名称 * 重置组件的名称
* *
@ -418,18 +418,18 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void resetCreatorName(String name) { public void resetCreatorName(String name) {
toData().setWidgetName(name); toData().setWidgetName(name);
} }
/** /**
* 遍历所有命名相关的组件到集合中 * 遍历所有命名相关的组件到集合中
* *
* @param xCreators 集合 * @param xCreators 集合
*/ */
public void traversalNameRelatedXCreators(Set<XCreator> xCreators) { public void traversalNameRelatedXCreators(Set<XCreator> xCreators) {
xCreators.add(this); xCreators.add(this);
int componentCount = getComponentCount(); int componentCount = getComponentCount();
for (int i = 0; i < componentCount; i++) { for (int i = 0; i < componentCount; i++) {
Component component = getComponent(i); Component component = getComponent(i);
if (component instanceof XCreator) { if (component instanceof XCreator) {
XCreator xCreator = (XCreator) component; XCreator xCreator = (XCreator) component;
@ -439,7 +439,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
} }
} }
} }
/** /**
* 重置组件的可见性 * 重置组件的可见性
* *
@ -448,7 +448,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void resetVisible(boolean visible) { public void resetVisible(boolean visible) {
toData().setVisible(visible); toData().setVisible(visible);
} }
/** /**
* 返回编辑的子组件scale为其内部组件 * 返回编辑的子组件scale为其内部组件
* @return 组件 * @return 组件
@ -804,4 +804,4 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
return false; return false;
} }
} }

2
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -105,7 +105,7 @@ public class FormCreatorDropTarget extends DropTarget {
SharableEditorProvider sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId); SharableEditorProvider sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId);
SharableWidgetProvider bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); SharableWidgetProvider bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId);
if (sharableEditor != null && bindInfo != null) { if (sharableEditor != null && bindInfo != null) {
Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource()); Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource(), true);
//合并数据集之后,可能会有数据集名称变化,做一下联动 //合并数据集之后,可能会有数据集名称变化,做一下联动
//共享的组件拿的时候都是克隆的,这边改拖拽中克隆的对象而非新克隆对象,上面这个新克隆的对象只是为了拿数据集 //共享的组件拿的时候都是克隆的,这边改拖拽中克隆的对象而非新克隆对象,上面这个新克隆的对象只是为了拿数据集
for (Map.Entry<String, String> entry : tdNameMap.entrySet()) { for (Map.Entry<String, String> entry : tdNameMap.entrySet()) {

2
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -258,6 +258,7 @@ public class RichTextToolBar extends BasicPane{
boolean isSub = RichTextToolBar.this.subPane.isSelected(); boolean isSub = RichTextToolBar.this.subPane.isSelected();
MutableAttributeSet attr = new SimpleAttributeSet(); MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSub && RichTextToolBar.this.superPane.isSelected()) { if (!isSub && RichTextToolBar.this.superPane.isSelected()) {
RichTextToolBar.this.superPane.setSelected(false);
StyleConstants.setSuperscript(attr, false); StyleConstants.setSuperscript(attr, false);
} }
// 调用setCharacterAttributes函数设置文本区选择文本的字体 // 调用setCharacterAttributes函数设置文本区选择文本的字体
@ -273,6 +274,7 @@ public class RichTextToolBar extends BasicPane{
// 调用setCharacterAttributes函数设置文本区选择文本的字体 // 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet(); MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSuper && RichTextToolBar.this.subPane.isSelected()) { if (!isSuper && RichTextToolBar.this.subPane.isSelected()) {
RichTextToolBar.this.subPane.setSelected(false);
StyleConstants.setSubscript(attr, false); StyleConstants.setSubscript(attr, false);
} }
StyleConstants.setSuperscript(attr, !isSuper); StyleConstants.setSuperscript(attr, !isSuper);

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

@ -8,6 +8,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.unit.CM; import com.fr.stable.unit.CM;
import com.fr.stable.unit.INCH; import com.fr.stable.unit.INCH;
@ -52,9 +53,9 @@ public class UnitFieldPane extends JPanel {
this.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM")); this.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"));
} }
//ajust the heigt of unitLabel. //自适应label宽度
Dimension unitDimension = new Dimension(this.getPreferredSize().width, int width = GraphDrawHelper.getWidth(this.getText(), this.getFont());
preferredHeight); Dimension unitDimension = new Dimension(width, preferredHeight);
this.setMinimumSize(unitDimension); this.setMinimumSize(unitDimension);
this.setMinimumSize(unitDimension); this.setMinimumSize(unitDimension);
this.setSize(unitDimension); this.setSize(unitDimension);

1
designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java

@ -238,6 +238,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
dlg.setModal(false); dlg.setModal(false);
dlg.setVisible(true); dlg.setVisible(true);
dlg.setAlwaysOnTop(true);
} }
private void showDialogAfterAddCellAction() { private void showDialogAfterAddCellAction() {

7
designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java

@ -10,7 +10,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JSliderPane; import com.fr.design.mainframe.JSliderPane;
import com.fr.design.present.CellWriteAttrPane; import com.fr.design.os.impl.PopupDialogSaveAction;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
@ -26,6 +26,7 @@ import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.*;
@ -93,7 +94,9 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
if (!grid.hasFocus() && grid.isRequestFocusEnabled()) { if (!grid.hasFocus() && grid.isRequestFocusEnabled()) {
grid.requestFocus(); grid.requestFocus();
} }
// linux下 点击单元格时 失焦之前立即触发保存
PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
saveAction.execute();
if (SwingUtilities.isRightMouseButton(evt)) { if (SwingUtilities.isRightMouseButton(evt)) {
doWithRightButtonPressed(); doWithRightButtonPressed();
} else { } else {

Loading…
Cancel
Save