Browse Source

修改PMD

master
kerry 7 years ago
parent
commit
b610efc4a3
  1. 6
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  2. 27
      designer_form/src/com/fr/design/designer/creator/XDateEditor.java
  3. 18
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  4. 2
      designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java
  5. 2
      designer_form/src/com/fr/design/widget/ui/designer/LabelDefinePane.java

6
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -227,7 +227,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
} }
protected String getIconName() { protected String getIconName() {
return ""; return StringUtils.EMPTY;
} }
public String getIconPath() { public String getIconPath() {
@ -472,13 +472,11 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
selectionModel.selectACreatorAtMouseEvent(e); selectionModel.selectACreatorAtMouseEvent(e);
} }
if (editingMouseListener.stopEditing()) { if (editingMouseListener.stopEditing() && this != designer.getRootComponent()) {
if (this != designer.getRootComponent()) {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this);
editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter); editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter);
} }
} }
}
/** /**
* 删除相关组件 * 删除相关组件

27
designer_form/src/com/fr/design/designer/creator/XDateEditor.java

@ -41,13 +41,14 @@ public class XDateEditor extends XDirectWriteEditor {
/** /**
* 控件的属性列表 * 控件的属性列表
*
* @return 此控件所用的属性列表 * @return 此控件所用的属性列表
* @throws IntrospectionException 异常 * @throws IntrospectionException 异常
*/ */
@Override @Override
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor [] tempt=(CRPropertyDescriptor[]) ArrayUtils.addAll( CRPropertyDescriptor[] tempt = (CRPropertyDescriptor[]) ArrayUtils.addAll(
new CRPropertyDescriptor[] { new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName( new CRPropertyDescriptor("widgetValue", this.data.getClass()).setI18NName(
Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass( Inter.getLocText(new String[]{"Widget", "Value"})).setEditorClass(
WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, WidgetValueEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY,
@ -57,9 +58,9 @@ public class XDateEditor extends XDirectWriteEditor {
public void propertyChange() { public void propertyChange() {
initFieldText(); initFieldText();
} }
})},super.supportedDescriptor()); })}, super.supportedDescriptor());
return (CRPropertyDescriptor[]) ArrayUtils.addAll(tempt, return (CRPropertyDescriptor[]) ArrayUtils.addAll(tempt,
new CRPropertyDescriptor[] { new CRPropertyDescriptor[]{
new CRPropertyDescriptor("formatText", this.data.getClass()).setI18NName( new CRPropertyDescriptor("formatText", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Engine_Format")).setEditorClass(formatClass()).setRendererClass( Inter.getLocText("FR-Engine_Format")).setEditorClass(formatClass()).setRendererClass(
DateCellRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), DateCellRenderer.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
@ -93,12 +94,12 @@ public class XDateEditor extends XDirectWriteEditor {
//格式 //格式
String format = dateEditor.getFormatText(); String format = dateEditor.getFormatText();
if(value instanceof Date){ if (value instanceof Date) {
valueStr = DateUtils.getDate2Str(format, (Date) value); valueStr = DateUtils.getDate2Str(format, (Date) value);
} }
//日期控件默认值 //日期控件默认值
if(StringUtils.isEmpty(valueStr)){ if (StringUtils.isEmpty(valueStr)) {
valueStr = DateUtils.getDate2Str(format, new Date()); valueStr = DateUtils.getDate2Str(format, new Date());
dateEditor.setWidgetValue(new WidgetValue(new Date())); dateEditor.setWidgetValue(new WidgetValue(new Date()));
} }
@ -140,14 +141,10 @@ public class XDateEditor extends XDirectWriteEditor {
* 获取当前XCreator的一个封装父容器 * 获取当前XCreator的一个封装父容器
* *
* @param widgetName 当前组件名 * @param widgetName 当前组件名
*
* @return 封装的父容器 * @return 封装的父容器
*
*
* @date 2014-11-25-下午4:47:23 * @date 2014-11-25-下午4:47:23
*
*/ */
protected XLayoutContainer getCreatorWrapper(String widgetName){ protected XLayoutContainer getCreatorWrapper(String widgetName) {
return new XWScaleLayout(); return new XWScaleLayout();
} }
@ -155,12 +152,9 @@ public class XDateEditor extends XDirectWriteEditor {
* 将当前对象添加到父容器中 * 将当前对象添加到父容器中
* *
* @param parentPanel 父容器组件 * @param parentPanel 父容器组件
*
*
* @date 2014-11-25-下午4:57:55 * @date 2014-11-25-下午4:57:55
*
*/ */
protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight){ protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight) {
this.setSize(width, minHeight); this.setSize(width, minHeight);
parentPanel.add(this); parentPanel.add(this);
} }
@ -177,9 +171,8 @@ public class XDateEditor extends XDirectWriteEditor {
/** /**
* data属性改变触发其他操作 * data属性改变触发其他操作
*
*/ */
public void firePropertyChange(){ public void firePropertyChange() {
initFieldText(); initFieldText();
} }
} }

18
designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -20,6 +20,7 @@ import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -149,19 +150,12 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
private void initDefinePane() { private void initDefinePane() {
currentEditorDefinePane = null; currentEditorDefinePane = null;
XCreator creator = xCreator; boolean dedicateLayout = xCreator.acceptType(XWScaleLayout.class) && xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator() || xCreator.acceptType(XWTitleLayout.class);
if (xCreator.acceptType(XWScaleLayout.class)) { XCreator creator = dedicateLayout ? (XCreator) xCreator.getComponent(0) : xCreator;
if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) {
creator = (XCreator) xCreator.getComponent(0);
}
}
if(xCreator.acceptType(XWTitleLayout.class)){
creator = (XCreator) xCreator.getComponent(0);
}
FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, creator.toData(), new Operator() { FormWidgetDefinePaneFactoryBase.RN rn = FormWidgetDefinePaneFactoryBase.createWidgetDefinePane(creator, creator.toData(), new Operator() {
@Override @Override
public void did(DataCreatorUI ui, String cardName) { public void did(DataCreatorUI ui, String cardName) {
//todo
} }
}); });
DataModify<Widget> definePane = rn.getDefinePane(); DataModify<Widget> definePane = rn.getDefinePane();
@ -189,7 +183,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
if (cellWidget.acceptType(WScaleLayout.class)) { if (cellWidget.acceptType(WScaleLayout.class)) {
Widget crBoundsWidget = ((WScaleLayout) cellWidget).getBoundsWidget(); Widget crBoundsWidget = ((WScaleLayout) cellWidget).getBoundsWidget();
innerWidget = ((CRBoundsWidget) crBoundsWidget).getWidget(); innerWidget = ((CRBoundsWidget) crBoundsWidget).getWidget();
} else if(cellWidget.acceptType(WTitleLayout.class)){ } else if (cellWidget.acceptType(WTitleLayout.class)) {
CRBoundsWidget crBoundsWidget = ((WTitleLayout) cellWidget).getBodyBoundsWidget(); CRBoundsWidget crBoundsWidget = ((WTitleLayout) cellWidget).getBodyBoundsWidget();
innerWidget = crBoundsWidget.getWidget(); innerWidget = crBoundsWidget.getWidget();
} }
@ -227,7 +221,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
} }
public String getIconPath() { public String getIconPath() {
return ""; return StringUtils.EMPTY;
} }

2
designer_form/src/com/fr/design/parameter/RootDesignDefinePane.java

@ -51,7 +51,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane); UIExpandablePane advanceExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, advancePane);
this.add(advanceExpandablePane, BorderLayout.NORTH); this.add(advanceExpandablePane, BorderLayout.NORTH);
JPanel layoutPane = createBoundsPane(); JPanel layoutPane = createBoundsPane();
UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("Size"), 280, 20, layoutPane); UIExpandablePane layoutExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Size"), 280, 20, layoutPane);
this.add(layoutExpandablePane, BorderLayout.CENTER); this.add(layoutExpandablePane, BorderLayout.CENTER);
} }

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

@ -95,7 +95,7 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
formWidgetValuePane.update(layout); formWidgetValuePane.update(layout);
layout.setAutoLine(isStyleAlignmentWrapText.isSelected()); layout.setAutoLine(isStyleAlignmentWrapText.isSelected());
layout.setVerticalCenter(isPageSetupVertically.isSelected()); layout.setVerticalCenter(isPageSetupVertically.isSelected());
layout.setTextalign((int)hAlignmentPane.getSelectedItem()); layout.setTextalign((int) hAlignmentPane.getSelectedItem());
layout.setFont(frFontPane.update(layout.getFont())); layout.setFont(frFontPane.update(layout.getFont()));
return layout; return layout;
} }

Loading…
Cancel
Save