forked from fanruan/design
kerry
5 years ago
4 changed files with 83 additions and 9 deletions
@ -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; |
||||||
|
} |
||||||
|
} |
@ -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)); |
||||||
|
} |
||||||
|
} |
@ -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…
Reference in new issue