private void initGUI() {
    mainContainer = new BorderLayoutContainer();
    refresButton = new TextButton("", ELearningController.ICONS.refresh());
    removeFromLectureButton =
        new TextButton("Remove form lecture", ELearningController.ICONS.delete());
    ListStore<Lecture> lectureListStore = new ListStore<Lecture>(lectureDataProperties.key());
    lectureComboBox =
        new ComboBox<Lecture>(
            lectureListStore,
            new LabelProvider<Lecture>() {
              public String getLabel(Lecture item) {
                return item.getLectureName();
              }
            });
    ListStore<Professor> professorListStore = new ListStore<Professor>(professorProperties.key());
    professorComboBox =
        new ComboBox<Professor>(
            professorListStore,
            new LabelProvider<Professor>() {
              public String getLabel(Professor item) {
                return item.getUsername();
              }
            });
    userGrid = createGrid();
    ToolBar toolBar = new ToolBar();

    lectureComboBox.setTriggerAction(ComboBoxCell.TriggerAction.ALL);
    lectureComboBox.setEditable(false);
    lectureComboBox.setAllowBlank(false);
    professorComboBox.setTriggerAction(ComboBoxCell.TriggerAction.ALL);
    professorComboBox.setEditable(false);
    professorComboBox.setAllowBlank(false);

    toolBar.setHorizontalSpacing(5);
    toolBar.add(refresButton);
    toolBar.add(new SeparatorToolItem());
    toolBar.add(new Label("Professor: "));
    toolBar.add(professorComboBox);
    toolBar.add(new Label("Lecture: "));
    toolBar.add(lectureComboBox);
    toolBar.add(new SeparatorToolItem());
    toolBar.add(removeFromLectureButton);

    mainContainer.setNorthWidget(toolBar, new BorderLayoutContainer.BorderLayoutData(30));
    mainContainer.setCenterWidget(userGrid);
    setState(ManageEnrolledStudentsController.IManageEnrolledStudentsState.NONE);
  }
Esempio n. 2
0
  private void initGUI() {
    toolBar = new ToolBar();
    TextButton userButton = new TextButton("Profile");
    forumButton = new TextButton("Forum");
    TextButton chatButton = new TextButton("Chat");
    lecturesButton = new TextButton("Lectures", ELearningController.ICONS.lectures());
    showProfileItem = new MenuItem("Show profile");
    changePasswordItem = new MenuItem("Change Password");
    viewLogsItem = new MenuItem("View logs");
    logoutItem = new MenuItem("Logout");
    userMenu = new Menu();
    Menu lecturesMenu = new Menu();
    userLecturesItem = new MenuItem("My Lectures");
    unenrolledLecturesItem = new MenuItem("Unenrolled Lectures");

    unenrolledLecturesItem.setSubMenu(new GridMenu(userLecturesView));

    logoutItem.setIcon(ELearningController.ICONS.logout());
    userMenu.add(showProfileItem);
    userMenu.add(viewLogsItem);
    userMenu.add(changePasswordItem);
    userMenu.add(logoutItem);

    lecturesMenu.add(userLecturesItem);
    lecturesMenu.add(unenrolledLecturesItem);
    lecturesButton.setMenu(lecturesMenu);

    lecturesButton.setWidth(100);
    userButton.setWidth(100);
    userButton.setIcon(ELearningController.ICONS.profile());
    userButton.setMenu(userMenu);
    forumButton.setWidth(80);
    forumButton.setIcon(ELearningController.ICONS.forum());
    chatButton.setWidth(80);
    chatButton.setIcon(ELearningController.ICONS.chat());

    toolBar.setHorizontalSpacing(5);
    toolBar.add(lecturesButton);
    toolBar.add(userButton);
    toolBar.add(forumButton);
    toolBar.add(chatButton);

    if (addSettingsButton) {
      settingsButton = new TextButton("", ELearningController.ICONS.settings());
      toolBar.add(settingsButton);
    }
    toolBar.setWidth(455);
  }