|
|
@ -78,7 +78,23 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean addBean(XCreator creator, int x, int y) { |
|
|
|
public boolean addBean(XCreator creator, int x, int y) { |
|
|
|
if (!accept(creator, x, y)) { |
|
|
|
boolean accept = accept(creator, x, y); |
|
|
|
|
|
|
|
return addBean(creator, x, y, accept); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 |
|
|
|
|
|
|
|
* addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param creator 被添加的新组件 |
|
|
|
|
|
|
|
* @param x 添加的位置x,该位置是相对于container的 |
|
|
|
|
|
|
|
* @param y 添加的位置y,该位置是相对于container的 |
|
|
|
|
|
|
|
* @param accept 是否添加新组件 |
|
|
|
|
|
|
|
* @return 是否添加成功,成功返回true,否则false |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean addBean(XCreator creator, int x, int y, boolean accept) { |
|
|
|
|
|
|
|
if (!accept) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
addComp(creator, x, y); |
|
|
|
addComp(creator, x, y); |
|
|
@ -86,6 +102,7 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除组件 |
|
|
|
* 删除组件 |
|
|
|
* |
|
|
|
* |
|
|
@ -186,4 +203,4 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { |
|
|
|
public XLayoutContainer getContainer() { |
|
|
|
public XLayoutContainer getContainer() { |
|
|
|
return this.container; |
|
|
|
return this.container; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|