Browse Source

REPORT-24957 frm打不开

bugfix/10.0
kerry 5 years ago
parent
commit
c58b21eb63
  1. 39
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapter.java
  2. 10
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  3. 23
      designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapterTest.java
  4. 18
      designer-form/src/test/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayoutTest.java

39
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapter.java

@ -0,0 +1,39 @@
package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
/**
* 针对tabpane的布局适配器
* Created by kerry on 2019-12-10
*/
public class FRWCardTagLayoutAdapter extends AbstractLayoutAdapter {
public FRWCardTagLayoutAdapter(XLayoutContainer container) {
super(container);
}
/**
* 对于这种布局方式不允许其他组件添加
*
* @param creator
* @param x
* @param y
*/
@Override
protected void addComp(XCreator creator, int x, int y) {
}
/**
* 对于这种布局方式不允许其他组件添加
*
* @param creator 组件
* @param x 添加的位置x该位置是相对于container的
* @param y 添加的位置y该位置是相对于container的
* @return
*/
@Override
public boolean accept(XCreator creator, int x, int y) {
return false;
}
}

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

@ -8,8 +8,7 @@ import com.fr.base.ScreenResolution;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRHorizontalLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRWCardTagLayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRVerticalLayoutAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
@ -311,12 +310,7 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
@Override @Override
public LayoutAdapter getLayoutAdapter() { public LayoutAdapter getLayoutAdapter() {
if (isHori()) { return new FRWCardTagLayoutAdapter(this);
return new FRHorizontalLayoutAdapter(this);
}else{
return new FRVerticalLayoutAdapter(this);
}
} }
private boolean isHori(){ private boolean isHori(){

23
designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapterTest.java

@ -0,0 +1,23 @@
package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.designer.creator.XElementCase;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import org.junit.Assert;
import org.junit.Test;
import java.awt.Dimension;
/**
* Created by kerry on 2019-12-10
*/
public class FRWCardTagLayoutAdapterTest {
@Test
public void testAccept() {
FRWCardTagLayoutAdapter adapter = new FRWCardTagLayoutAdapter(
new XWCardTagLayout(new WCardTagLayout(), new Dimension(100, 100)));
Assert.assertFalse(adapter.accept(new XElementCase(
new ElementCaseEditor(), new Dimension(100, 100)), 1, 1));
}
}

18
designer-form/src/test/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayoutTest.java

@ -0,0 +1,18 @@
package com.fr.design.designer.creator.cardlayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import org.junit.Assert;
import org.junit.Test;
import java.awt.Dimension;
/**
* Created by kerry on 2019-12-10
*/
public class XWCardTagLayoutTest {
@Test
public void testGetLayoutAdapter() {
XWCardTagLayout tagLayout = new XWCardTagLayout(new WCardTagLayout(), new Dimension(100, 100));
Assert.assertEquals("com.fr.design.designer.beans.adapters.layout.FRWCardTagLayoutAdapter", tagLayout.getLayoutAdapter().getClass().getName());
}
}
Loading…
Cancel
Save