Ejemplo n.º 1
0
  public TabItem getNewPortletTab(Portlet portlet, int index, int column) {
    TabItem tab = new TabItem(getTabLabel(portlet, index, column));
    tab.setLayout(new FitLayout());
    tab.setClosable(true);
    tab.setScrollMode(Scroll.NONE);
    tab.add(portlet);

    if (portlet instanceof AppPortlet) {
      final AppPortlet appPortlet = (AppPortlet) portlet;
      tab.addListener(
          Events.Close,
          new Listener<BaseEvent>() {
            public void handleEvent(BaseEvent be) {
              if (be.getType().getEventCode() == Events.Close.getEventCode()) {
                appPortlet.closePortlet();
              }
            };
          });
    }

    return tab;
  }
Ejemplo n.º 2
0
  public ContentPanel initWeiget() {
    // ----

    // ----
    ContentPanel panel = new ContentPanel();
    panel.setLayout(new BorderLayout());
    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
    westData.setSplit(true);
    westData.setCollapsible(true);
    westData.setMargins(new Margins(0));
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(5, 0, 5, 0));

    panel.add(CreateCcodeLeftPanel(), westData);

    TabPanel tabpanel = new TabPanel();

    tabpanel.setWidth(450);
    tabpanel.setHeight(450);
    tabpanel.setAutoHeight(true);
    TabItem normal = new TabItem("基本信息");
    normal.add(CreateCCodeDetailPanel());

    ContentPanel branchorg = new ContentPanel(); // createCcodebranchorgaddPanel
    TabItem bangogndizhi = new TabItem("办公地点和分支机构");

    branchorg.setHeight(400);
    branchorg.setHeaderVisible(false);
    branchorg.setLayout(new RowLayout(Orientation.VERTICAL));
    branchorg.add(createOfficePanel(), new RowData(1, 0.5));
    branchorg.add(createCcodebranchorgaddPanel(), new RowData(1, 0.5));
    bangogndizhi.add(branchorg);

    TabItem lianxiren = new TabItem("联系人信息");
    lianxiren.add(createLinkManPanel());

    final TabItem searchframe = new TabItem("查询相关信息");
    searchframe.setAutoHeight(true);
    final BaseSerchHtml bsh = new BaseSerchHtml();
    searchframe.add(bsh.getSearchFrame());
    searchframe.addListener(
        Events.Select,
        new Listener() {

          @Override
          public void handleEvent(BaseEvent be) {
            bsh.SearchHtml(
                store.getValue("cname") == null ? "" : store.getValue("cname").toString());
          }
        });
    /** store 换行的时候进行关键字的搜索 */
    store.addBaseStoreListener(
        BaseStoreEvent.EventType.ROW_CHANGED,
        new BaseStoreListener() {

          @Override
          public void BaseStoreEventHandle(BaseStoreEvent evt) {
            if (evt.getEventType() == BaseStoreEvent.EventType.ROW_CHANGED) {

              if (searchframe.isVisible()) {
                bsh.SearchHtml(
                    store.getValue("cname") == null ? "" : store.getValue("cname").toString());
              }
            }
          }

          @Override
          public void onBrowserEvent(Event event) {
            // TODO Auto-generated method stub

          }
        });
    tabpanel.add(normal);
    tabpanel.add(bangogndizhi);
    tabpanel.add(lianxiren);
    tabpanel.add(searchframe);

    panel.add(tabpanel, centerData);

    registerMainStore(store);
    registerStore(store);
    return panel;
  }