protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    setId("settings-tabs-wrapper");
    setLayout(new FitLayout());

    m_tabsPanel = new TabPanel();
    m_tabsPanel.setPlain(true);
    m_tabsPanel.setBorders(false);
    m_tabsPanel.setBodyBorder(false);
    m_tabsPanel.setStyleAttribute("padding-top", "5px");

    m_snapshotsConfig = new TabItem(MSGS.settingsSnapshots());
    m_snapshotsConfig.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.snapshots()));
    m_snapshotsConfig.setBorders(true);
    m_snapshotsConfig.setLayout(new FitLayout());
    m_snapshotsConfig.add(m_snapshotsTab);
    m_tabsPanel.add(m_snapshotsConfig);

    m_certificatesConfig = new TabItem(MSGS.settingsAddSSLCertificates());
    m_certificatesConfig.setBorders(true);
    m_certificatesConfig.setLayout(new FitLayout());
    m_certificatesConfig.add(m_certificatesTab);
    m_tabsPanel.add(m_certificatesConfig);

    m_permissionsConfig = new TabItem(MSGS.permissions());
    m_permissionsConfig.setBorders(true);
    m_permissionsConfig.setLayout(new FitLayout());
    m_permissionsConfig.add(m_permissionsTab);
    m_tabsPanel.add(m_permissionsConfig);

    add(m_tabsPanel);
  }
  protected void initUI() {
    TabItem west = (TabItem) Registry.get(AppView.TAB_STORAGE);
    ContentPanel clusters = new ContentPanel();
    clusters.setAnimCollapse(false);
    clusters.setHeading("Storage Engines");
    clusters.addListener(
        Events.Expand,
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent be) {
            Dispatcher.get().dispatch(AppEvents.NAV_STORAGE);
          }
        });

    storageEnginesPanel = new StorageEnginesPanel();
    storageEnginesPanel
        .getGrid()
        .getSelectionModel()
        .addSelectionChangedListener(
            new SelectionChangedListener<StorageEngine>() {
              @Override
              public void selectionChanged(SelectionChangedEvent<StorageEngine> se) {
                AppEvent evt = new AppEvent(AppEvents.VIEW_STORAGE_ENGINE, se.getSelectedItem());
                Dispatcher.forwardEvent(evt);
              }
            });
    clusters.add(storageEnginesPanel, new BorderLayoutData(LayoutRegion.CENTER));

    west.add(clusters);
  }
Exemple #3
0
 @Override
 public void updateLabel(Portlet portlet) {
   TabItem tab = getTab(portlet);
   if (tab != null) {
     tab.setText(getTabLabel(portlet, 0, 0));
     if (portlet instanceof AppPortlet)
       tab.getHeader().setToolTip(((AppPortlet) portlet).getPresenterToolTip());
   }
 }
Exemple #4
0
 @Override
 public void refreshAllPortletStates() {
   for (int col = 0; col < portletTabs.size(); col++) {
     List<TabItem> list = new ArrayList<TabItem>(portletTabs.get(col));
     for (int row = 0; row < list.size(); row++) {
       TabItem tab = list.get(row);
       if (tab.getItemCount() > 0 && tab.getItem(0) instanceof AppPortlet) {
         AppPortlet appPortlet = (AppPortlet) tab.getItem(0);
         appPortlet.updateUserPortlet(row, col);
       }
     }
   }
 }
Exemple #5
0
 /** Remove all portlets (without recording them as closed in the user portlet cache) */
 public void removeAllPortlets() {
   for (int col = 0; col < portletTabs.size(); col++) {
     List<TabItem> list = new ArrayList<TabItem>(portletTabs.get(col));
     for (int row = 0; row < list.size(); row++) {
       TabItem tab = list.get(row);
       if (tab.getItemCount() > 0 && tab.getItem(0) instanceof AppPortlet) {
         AppPortlet appPortlet = (AppPortlet) tab.getItem(0);
         tab.remove(appPortlet);
       }
       tabPanel.remove(tab);
     }
   }
   portletTabs = new ArrayList<List<TabItem>>();
 }
Exemple #6
0
  public TabItem getTab(Portlet portlet) {
    //	Search using the internal list, in case it's already been removed from the tabPanel by GXT
    for (List<TabItem> tabs : portletTabs) {
      for (TabItem tab : tabs) {
        for (Component component : tab.getItems()) {
          if (component.hashCode() == portlet.hashCode())
            if (component.getClass().getName().equals(portlet.getClass().getName())) {
              return tab;
            }
        }
      }
    }

    return null;
  }
Exemple #7
0
 @Override
 public void onEnter(Component component, PreviewEvent pe) {
   if (!isManaged()) return;
   if (component instanceof HeaderItem) {
     pe.preventDefault();
     TabItem item = (TabItem) component.getParent();
     stepInto(item, pe, true);
   } else if (component instanceof TabPanel) {
     pe.preventDefault();
     TabPanel panel = (TabPanel) component;
     TabItem item = panel.getSelectedItem();
     if (item != null && item.getItemCount() > 0) {
       item.getItem(0).focus();
     }
   }
 }
Exemple #8
0
  @Override
  public Portlet getByIdentity(String identity) {
    if (identity == null) return null;

    for (List<TabItem> tabs : portletTabs) {
      for (TabItem tab : tabs) {
        for (Component component : tab.getItems()) {
          if (component instanceof AppPortlet) {
            AppPortlet appPortlet = (AppPortlet) component;
            if (identity.equals(appPortlet.getPortletIdentity())) return appPortlet;
          }
        }
      }
    }

    return null;
  }
  private TabItem createFaceTabItem() {
    Viewport viewport = new Viewport();
    viewport.setLayout(new VBoxLayout(VBoxLayout.VBoxLayoutAlign.STRETCH));

    headerHtml.setStyleName("studentAccount");
    viewport.add(headerHtml);

    VBoxLayoutData flex = new VBoxLayoutData(10, 0, 0, 0);
    flex.setFlex(1);
    studentDataForm.setScrollMode(Style.Scroll.AUTOY);
    viewport.add(studentDataForm, flex);

    TabItem faceTabItem = new TabItem("Учетная карточка студента");
    faceTabItem.setLayout(new FitLayout());
    faceTabItem.add(viewport);

    return faceTabItem;
  }
  private Window createTabWindow() {
    Window w = new Window();
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setSize(740, 480);
    w.setIcon(IconHelper.createStyle("tabs"));
    w.setHeading("Configurator Testapp");

    w.setLayout(new FitLayout());

    TabPanel panel = new TabPanel();

    for (int i = 0; i < 4; i++) {
      TabItem item = new TabItem("Configurator Testapp " + (i + 1));
      item.addText("Something useful would be here");
      panel.add(item);
    }

    w.add(panel);
    return w;
  }
  private void initTabs() {
    m_certificatesTab = new CertificatesTab(m_currentSession);
    if (m_certificatesConfig != null) {
      m_certificatesConfig.add(m_certificatesTab);
      m_certificatesConfig.layout();
    }

    m_snapshotsTab = new SnapshotsTab(m_currentSession, m_servicesTree);
    if (m_snapshotsConfig != null) {
      m_snapshotsConfig.add(m_snapshotsTab);
      m_snapshotsConfig.layout();
    }

    m_permissionsTab = new PermissionsTab(m_currentSession);
    if (m_permissionsConfig != null) {
      m_permissionsConfig.add(m_permissionsTab);
      m_permissionsConfig.layout();
    }
  }
Exemple #12
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;
  }
Exemple #13
0
  @Override
  public void close(Portlet portlet) {
    TabItem tab = getTab(portlet);
    if (tab != null) {
      if (tab.getTabPanel() != null) tab.close();

      //	Take the tab out of the list of tabs
      for (List<TabItem> column : portletTabs) {
        for (TabItem targetTab : column) {
          if (tab.hashCode() == targetTab.hashCode()) {
            column.remove(targetTab);
            break;
          }
        }
      }
    }

    //	Make sure the portlet is out of the tab itself
    if (portlet.getParent() != null) portlet.removeFromParent();

    //	Update the portlet as "closed" in the user cache
    if (portlet instanceof AppPortlet) ((AppPortlet) portlet).updateUserPortlet();
  }
Exemple #14
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;
  }
Exemple #15
0
  Widget initwidget() {
    VerticalPanel v = new VerticalPanel();
    v.setSpacing(2);

    TabPanel tabpanel = new TabPanel();
    tabpanel.setPlain(true);
    tabpanel.setHeight(450);
    tabpanel.setWidth(760);
    TabItem t1 = new TabItem();
    t1.setText("配偶");
    VerticalPanel vt1 = new VerticalPanel();
    vt1.setSpacing(2);

    vt1.add(createbcode_Spouse_Form());
    t1.add(vt1);
    t1.setScrollMode(Scroll.AUTO);

    TabItem t2 = new TabItem();
    t2.setText("家庭成员");
    VerticalPanel vt2 = new VerticalPanel();
    vt2.setSpacing(2);
    vt2.add(create_bcode_famify_Grid());
    t2.add(vt2);
    t2.setScrollMode(Scroll.AUTO);

    TabItem t3 = new TabItem();
    t3.setText("紧急联络方式");
    VerticalPanel vt3 = new VerticalPanel();
    vt3.setSpacing(2);
    vt3.add(create_bcode_contact_Grid());
    t3.add(vt3);
    t3.setScrollMode(Scroll.AUTO);

    tabpanel.add(t3);
    tabpanel.add(t2);
    tabpanel.add(t1);

    v.add(tabpanel);

    this.add(v);
    return null;
  }
Exemple #16
0
 public static void setIcon(TabItem tabItem, String iconName) {
   if (TAB_ICONS && tabItem != null && iconName != null && iconName.length() > 0) {
     tabItem.setIcon(getTabIcon(iconName));
   }
 }
  @Inject
  public ProjectIndicatorsContainer(
      ProjectSiteGridPanel siteEditor,
      SiteMap siteMap,
      final DesignPanel designPanel,
      Dispatcher service,
      EventBus eventBus) {

    this.siteEditor = siteEditor;
    this.siteMap = siteMap;
    this.designPanel = designPanel;
    this.service = service;
    this.eventBus = eventBus;

    BorderLayout borderLayout = new BorderLayout();
    borderLayout.setContainerStyle("x-border-layout-ct main-background");
    setLayout(borderLayout);

    ContentPanel mainPanel = new ContentPanel();
    mainPanel.setIcon(null);
    mainPanel.setLayout(new FitLayout());
    mainPanel.setSize(600, 300);

    // setIcon(IconImageBundle.ICONS.design());
    // map tab panel
    tabPanel = new TabPanel();
    tabPanel.setPlain(true);

    // map tab item
    mapTabItem = new TabItem("map");
    mapTabItem.setLayout(new FitLayout());
    mapTabItem.setEnabled(false);
    mapTabItem.setAutoHeight(true);
    mapTabItem.setEnabled(true);
    mapTabItem.add(siteMap);
    tabPanel.add(mapTabItem);

    // sites tab item
    sitesTabItem = new TabItem("sites");
    sitesTabItem.setLayout(new FitLayout());
    sitesTabItem.setEnabled(false);
    sitesTabItem.setAutoHeight(true);
    sitesTabItem.setEnabled(true);
    sitesTabItem.add(siteEditor);
    tabPanel.add(sitesTabItem);

    // buttons for indicator view
    newIndicatorButton = new Button("new indicator");
    newGroupButton = new Button("new group");
    reloadButton = new Button("reload button");

    mainPanel.add(newIndicatorButton);
    mainPanel.add(newGroupButton);
    mainPanel.add(reloadButton);

    BorderLayoutData centerLayout = new BorderLayoutData(Style.LayoutRegion.CENTER);
    centerLayout.setMargins(new Margins(0, 0, 0, 0));
    centerLayout.setSplit(true);
    centerLayout.setCollapsible(true);

    BorderLayoutData layout = new BorderLayoutData(Style.LayoutRegion.EAST);
    layout.setSplit(true);
    layout.setCollapsible(true);
    layout.setSize(375);
    layout.setMargins(new Margins(0, 0, 0, 5));

    add(designPanel, centerLayout);
    designPanel
        .getMappedIndicator()
        .addValueChangeHandler(
            new ValueChangeHandler<IndicatorDTO>() {

              @Override
              public void onValueChange(ValueChangeEvent<IndicatorDTO> event) {
                onMappedIndicatorChanged(event.getValue());
              }
            });

    add(tabPanel, layout);
    // setHeading(I18N.CONSTANTS.design() + " - " );

    siteEditor.addActionListener(
        new Listener<ComponentEvent>() {

          @Override
          public void handleEvent(ComponentEvent be) {
            if (UIActions.add.equals(be.getComponent().getItemId())) {
              addSite();
            }
          }
        });
  }
  private TabItem createLoginTab() {
    TabItem tabItem = new TabItem("Login");

    FormPanel form = new FormPanel();
    form.setHeading("Login using existing user.");
    form.setWidth(350);
    form.setLayout(new FlowLayout());

    FieldSet fieldSet = new FieldSet();

    FormLayout layout = new FormLayout();
    layout.setLabelWidth(75);
    fieldSet.setLayout(layout);

    final TextField<String> fieldName = new TextField<String>();
    fieldName.setFieldLabel("Name");
    fieldSet.add(fieldName);

    final TextField<String> fieldPassword = new TextField<String>();
    fieldPassword.setPassword(true);
    fieldPassword.setFieldLabel("Password");
    fieldSet.add(fieldPassword);

    form.add(fieldSet);
    form.setButtonAlign(HorizontalAlignment.CENTER);
    Button loginButton = new Button("Login");
    form.addButton(loginButton);

    loginButton.addListener(
        Events.Select,
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            final String name = fieldName.getValue();
            String pass = fieldPassword.getValue();

            if (name == null || pass == null) {
              Info.display("Loggin in Error!", "Name or password is empty!");
              return;
            }

            // Sprawdza usera
            userService.login(
                name,
                pass,
                new AsyncCallback<UserLoginRegisterResponse>() {
                  public void onSuccess(UserLoginRegisterResponse result) {
                    if (!result.isSuccess()) {
                      Info.display("Couldn't log in", result.getMessage());
                    } else {
                      User user = result.getUser();
                      Info.display(
                          "Logged in",
                          "Logged in successfuly as "
                              + user.getName()
                              + " level: "
                              + user.getUserType());
                      hide();
                      tabs.init(user);
                    }
                  }

                  public void onFailure(Throwable caught) {
                    Info.display("Error while loggin in.", caught.getMessage());
                  };
                });
          }
        });
    tabItem.add(form);
    return tabItem;
  }
  private TabItem createRegisterTab() {
    TabItem tabItem = new TabItem("Register");

    FormPanel form = new FormPanel();
    form.setFrame(false);
    form.setHeading("Create a new account.");
    form.setWidth(350);
    form.setLayout(new FlowLayout());

    FieldSet fieldSet = new FieldSet();

    FormLayout layout = new FormLayout();
    layout.setLabelWidth(75);
    fieldSet.setLayout(layout);

    final TextField<String> nameField = new TextField<String>();
    nameField.setFieldLabel("Name");
    fieldSet.add(nameField);

    final TextField<String> passField = new TextField<String>();
    passField.setPassword(true);
    passField.setFieldLabel("Password");
    fieldSet.add(passField);

    final TextField<String> emailField = new TextField<String>();
    emailField.setFieldLabel("Email");
    fieldSet.add(emailField);

    form.add(fieldSet);
    form.setButtonAlign(HorizontalAlignment.CENTER);
    Button registerButton = new Button("Register");
    form.addButton(registerButton);

    registerButton.addListener(
        Events.Select,
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            String name = nameField.getValue();
            String pass = passField.getValue();
            String email = emailField.getValue();

            if (name == null || pass == null || email == null) {
              Info.display(
                  "Incorrect register data", "Name, password and email must not be empty!");
              return;
            }

            userService.register(
                name,
                pass,
                email,
                new AsyncCallback<UserLoginRegisterResponse>() {
                  // @Override
                  public void onFailure(Throwable caught) {
                    Info.display("Error while registering account!", caught.getMessage());
                  }
                  // @Override
                  public void onSuccess(UserLoginRegisterResponse result) {
                    if (!result.isSuccess()) {
                      Info.display("The account not registered!", result.getMessage());
                    } else {
                      User user = result.getUser();
                      Info.display(
                          "Registered :)",
                          "Registered successfuly. You've been automaticly logged in as "
                              + user.getName()
                              + " level: "
                              + user.getUserType());
                      hide();
                      tabs.init(user);
                    }
                  }
                });
          }
        });

    tabItem.add(form);
    return tabItem;
  }
Exemple #20
0
  @Override
  public boolean reinsert(Portlet portlet, int index, int column, int portletId) {
    //	Do any AppPortlet specific tasks
    if (portlet instanceof AppPortlet) {
      AppPortlet appPortlet = (AppPortlet) portlet;
      //	Make sure there's not already a duplicate portlet, and if so, don't add this one, just jump
      // to that one
      AppPortlet existingPortlet = (AppPortlet) getByIdentity(appPortlet.getPortletIdentity());
      if (existingPortlet != null && !existingPortlet.allowDuplicatePortlets()) {
        scrollToPortlet(existingPortlet);
        return false;
      }
      //	Otherwise, set the id and stuff
      appPortlet.setPortletId(portletId);
      appPortlet.setPresenter(this);
    }

    if (index < 0) index = 0;
    if (column < 0) column = 0;

    //	Get the tab we'll add (with the portlet in it)
    TabItem tab = getNewPortletTab(portlet, index, column);

    //	Create all the columns we need
    while (portletTabs.size() <= column) {
      portletTabs.add(new ArrayList<TabItem>());
    }

    //	Get the column we'll add to
    List<TabItem> tabColumn = portletTabs.get(column);

    //	Now we'll add the tab to the proper column, and to the display

    //	If this is at the end of the column, the tab has to go before the first item in the next
    // column
    if (index >= tabColumn.size()) {
      //	Append to end of the column
      tabColumn.add(tab);

      //	Find the next actual tab item
      TabItem nextTab = null;
      int nextColumn = column + 1;

      while (nextTab == null && nextColumn < portletTabs.size()) {
        //	Insert before first tab in next column
        List<TabItem> nextTabColumn = portletTabs.get(nextColumn);
        nextColumn++;
        if (nextTabColumn.size() > 0) {
          nextTab = nextTabColumn.get(0);
          break;
        }
      }

      //	Add the tab
      if (nextTab == null) {
        //	No next column, just add to end
        tabPanel.add(tab);
      } else {
        tabPanel.insert(tab, tabPanel.indexOf(nextTab));
      }
    } else {
      //	Insert before the specified tab in this column
      TabItem beforeTab = tabColumn.get(index);
      if (beforeTab != null) {
        tabColumn.add(index, tab);
        int tabIndex = tabPanel.indexOf(beforeTab);
        if (tabIndex < 0) tabIndex = 0;
        tabPanel.insert(tab, tabIndex);
      } else {
        tabColumn.add(0, tab);
        tabPanel.insert(tab, 0);
      }
    }

    //	Lastly, set the row and column for the portlet, and fix the local next portlet ID
    if (portlet instanceof AppPortlet) {
      AppPortlet appPortlet = (AppPortlet) portlet;

      // Set the tooltip for the tab
      tab.getHeader().setToolTip(appPortlet.getPresenterToolTip());
      //	appPortlet.registerUserPortlet(appPortlet.getPortletId(), index, column);
      appPortlet.setPortalColumn(column);
      appPortlet.setPortalRow(index);
      if (appPortlet.getPortletId() >= nextPortalId) nextPortalId = appPortlet.getPortletId() + 1;
    }

    return true;
  }