예제 #1
0
 /**
  * 组件删除
  *
  * @param e 容器事件
  */
 @Override
 public void componentRemoved(ContainerEvent e) {
   if (isRefreshing) {
     return;
   }
   XWidgetCreator xwc = ((XWidgetCreator) e.getChild());
   Widget wgt = xwc.toData();
   WTitleLayout wlayout = this.toData();
   wlayout.removeWidget(wgt);
 }
예제 #2
0
 /**
  * 组件增加
  *
  * @param e 容器事件
  */
 @Override
 public void componentAdded(ContainerEvent e) {
   if (isRefreshing) {
     return;
   }
   WTitleLayout layout = this.toData();
   XWidgetCreator creator = (XWidgetCreator) e.getChild();
   FRTitleLayout lay = (FRTitleLayout) getLayout();
   Object constraints = lay.getConstraints(creator);
   if (ComparatorUtils.equals(WTitleLayout.TITLE, constraints)) {
     layout.addTitle(creator.toData(), creator.getBounds());
   } else if (ComparatorUtils.equals(WTitleLayout.BODY, constraints)) {
     layout.addBody(creator.toData(), creator.getBounds());
   }
 }
예제 #3
0
 /** 将WLayout转换为XLayoutContainer */
 @Override
 public void convert() {
   isRefreshing = true;
   WTitleLayout layout = this.toData();
   this.removeAll();
   for (int i = 0, num = layout.getWidgetCount(); i < num; i++) {
     BoundsWidget bw = (BoundsWidget) layout.getWidget(i);
     if (bw != null) {
       Rectangle bounds = bw.getBounds();
       XWidgetCreator comp = (XWidgetCreator) XCreatorUtils.createXCreator(bw.getWidget());
       String constraint =
           bw.getWidget().acceptType(Label.class) ? WTitleLayout.TITLE : WTitleLayout.BODY;
       this.add(comp, constraint);
       comp.setBounds(bounds);
     }
   }
   isRefreshing = false;
 }