Browse Source

Merge branch 'release/9.0' of http://cloud.finedevelop.com:2015/scm/~plough/design into release/9.0

master
plough 7 years ago
parent
commit
49bf65fcca
  1. 10
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 10
      designer_base/src/com/fr/design/actions/UpdateAction.java
  3. 7
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  4. 117
      designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java
  5. 2
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

10
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -676,7 +676,7 @@ public class AlphaFineDialog extends UIDialog {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() - 1);
} else escAlphaFine(e);
} else escAlphaFineDialog(e);
}
});
@ -888,7 +888,7 @@ public class AlphaFineDialog extends UIDialog {
*
* @param e
*/
private void escAlphaFine(KeyEvent e) {
private void escAlphaFineDialog(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) {
AlphaFineDialog.this.setVisible(false);
@ -896,6 +896,10 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.setText(null);
removeSearchResult();
}
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (searchResultList.getModel().getSize() > 1) {
dealWithSearchResult(searchResultList.getSelectedValue());
}
}
}
@ -969,7 +973,7 @@ public class AlphaFineDialog extends UIDialog {
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
escAlphaFine(e);
escAlphaFineDialog(e);
}
});

10
designer_base/src/com/fr/design/actions/UpdateAction.java

@ -504,10 +504,12 @@ public abstract class UpdateAction extends ShortCut implements Action {
} else if (component instanceof JComboBox) {
for (int i = 0; i < ((JComboBox) component).getItemCount(); i++) {
text.append(((JComboBox) component).getItemAt(i));
String title = String.valueOf(((JComboBox) component).getItemAt(i));
handleSearchText(separator, text, pinyin, shortPinyin, title);
Object componentName = ((JComboBox) component).getItemAt(i);
if (componentName instanceof String && StringUtils.isNotBlank(String.valueOf(componentName))) {
String title = String.valueOf(componentName);
text.append(title);
handleSearchText(separator, text, pinyin, shortPinyin, title);
}
}
} else if (component instanceof JTabbedPane) {
getTabPaneTexts((JTabbedPane) component, separator, text, pinyin, shortPinyin);

7
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -258,12 +258,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
private void setPatternComboBoxAndList(int formatStyle, String pattern) {
this.typeComboBox.setSelectedItem(formatStyle);
int i = isArrayContainPattern(FormatField.getInstance().getFormatArray(formatStyle), pattern);
if (i == -1) {
this.textField.setSelectedItem(pattern);
} else {
this.textField.setSelectedIndex(i);
}
this.textField.setSelectedItem(pattern);
}
private boolean isTimeType(String pattern) {

117
designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java

@ -5,24 +5,45 @@ import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.AbstractLayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWScaleLayout;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import java.awt.*;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 表单选中工具类
*
* @author yaoh.wu
* @version 2017年11月15日13点51分
* @since 8.0
*/
public class FormSelectionUtils {
//组件复制时坐标偏移
/**
* 组件复制时坐标偏移
*/
private static final int DELAY_X_Y = 20;
//组件重命名后缀
/**
* 组件重命名后缀
*/
private static final String POSTFIX = "_c";
private FormSelectionUtils() {
@ -47,6 +68,25 @@ public class FormSelectionUtils {
Toolkit.getDefaultToolkit().beep();
}
public static void rebuildSelection(FormDesigner designer) {
ArrayList<XCreator> newSelection = new ArrayList<>();
List<Widget> widgetList = new ArrayList<>();
for (XCreator comp : designer.getSelectionModel().getSelection().getSelectedCreators()) {
widgetList.add(comp.toData());
}
designer.getSelectionModel().setSelectedCreators(
rebuildSelection(designer.getRootComponent(), widgetList, newSelection));
}
public static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, Widget[] selectWidgets) {
List<Widget> selectionWidget = new ArrayList<>();
if (selectWidgets != null) {
selectionWidget.addAll(Arrays.asList(selectWidgets));
}
return FormSelectionUtils.rebuildSelection(rootComponent, selectionWidget, new ArrayList<XCreator>());
}
/**
* 绝对布局粘贴
*/
@ -92,26 +132,15 @@ public class FormSelectionUtils {
designer.getSelectionModel().getSelection().reset();
for (XCreator creator : clipboard.getSelectedCreators()) {
try {
Widget copied = copyWidget(designer, creator);
XCreator copiedCreator = XCreatorUtils.createXCreator(copied, creator.getSize());
if (adapter.getClass().equals(FRTabFitLayoutAdapter.class)) {
if (!adapter.accept(copiedCreator, x - tabContainerRect.x, y - tabContainerRect.y)) {
designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste"));
return;
}
} else {
if (!adapter.accept(copiedCreator, x, y)) {
designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste"));
return;
}
}
boolean addSuccess = adapter.addBean(copiedCreator, x, y);
if (addSuccess) {
designer.getSelectionModel().getSelection().addSelectedCreator(copiedCreator);
if (creator instanceof XWScaleLayout) {
//XWScaleLayout封装了在自适应布局中需要保持默认高度的控件,由于自适应粘贴时会再次包装,因此复制时要进行解包
Component[] innerComponents = creator.getComponents();
for (Component innerComponent : innerComponents) {
XCreator innerXCreator = (XCreator) innerComponent;
relativePasteXCreator(designer, innerXCreator, adapter, tabContainerRect, x, y);
}
} catch (CloneNotSupportedException e) {
FRContext.getLogger().error(e.getMessage(), e);
} else {
relativePasteXCreator(designer, creator, adapter, tabContainerRect, x, y);
}
}
rebuildSelection(designer);
@ -119,6 +148,31 @@ public class FormSelectionUtils {
designer.getSelectionModel().getSelection().getSelectedCreator(), DesignerEvent.CREATOR_PASTED);
}
private static void relativePasteXCreator(FormDesigner designer, XCreator creator, LayoutAdapter adapter, Rectangle tabContainerRect, int x, int y) {
try {
Widget copied = copyWidget(designer, creator);
XCreator copiedXCreator = XCreatorUtils.createXCreator(copied, creator.getSize());
if (adapter.getClass().equals(FRTabFitLayoutAdapter.class)) {
if (!adapter.accept(copiedXCreator, x - tabContainerRect.x, y - tabContainerRect.y)) {
designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste"));
return;
}
} else {
if (!adapter.accept(copiedXCreator, x, y)) {
designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste"));
return;
}
}
boolean addSuccess = adapter.addBean(copiedXCreator, x, y);
if (addSuccess) {
designer.getSelectionModel().getSelection().addSelectedCreator(copiedXCreator);
}
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error(e.getMessage(), e);
}
}
/**
* 组件复用绝对布局获取粘贴组件位置
*/
@ -182,23 +236,6 @@ public class FormSelectionUtils {
return name.toString();
}
public static void rebuildSelection(FormDesigner designer) {
ArrayList<XCreator> newSelection = new ArrayList<>();
List<Widget> widgetList = new ArrayList<>();
for (XCreator comp : designer.getSelectionModel().getSelection().getSelectedCreators()) {
widgetList.add(comp.toData());
}
designer.getSelectionModel().setSelectedCreators(
rebuildSelection(designer.getRootComponent(), widgetList, newSelection));
}
public static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, Widget[] selectWidgets) {
List<Widget> selectionWidget = new ArrayList<>();
if (selectWidgets != null) {
selectionWidget.addAll(Arrays.asList(selectWidgets));
}
return FormSelectionUtils.rebuildSelection(rootComponent, selectionWidget, new ArrayList<XCreator>());
}
private static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, List<Widget> selectionWidget,
ArrayList<XCreator> newSelection) {

2
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -144,8 +144,8 @@ public class WidgetBoundPane extends BasicPane {
difference = bounds.height - h;
bounds.height = h;
}
height.setValue(bounds.height);
wabs.setBounds(creator.toData(), bounds);
creator.setBounds(bounds);
adjustComponents(bounds, difference, 1);
}

Loading…
Cancel
Save