@Override
  protected EnhancedVLayout buildContentPane() {
    EnhancedVLayout contentPane = new EnhancedVLayout();
    contentPane.setWidth100();
    contentPane.setHeight100();
    contentPane.setOverflow(Overflow.AUTO);

    EnhancedDynamicForm form = buildForm();
    setForm(form);

    EnhancedVLayout topPane = new EnhancedVLayout();
    topPane.setWidth100();
    topPane.setHeight(80);
    topPane.addMember(form);

    contentPane.addMember(topPane);

    TabSet tabSet = new TabSet();
    tabSet.setWidth100();
    tabSet.setHeight100();

    this.bundlesTab = buildBundlesTab(tabSet);
    tabSet.addTab(bundlesTab);

    contentPane.addMember(tabSet);

    return contentPane;
  }
 public void selectTabByModel(String model) {
   for (Tab t : tabs.getTabs()) {
     if (t.getTitle().equals(modelToTitleMap.get(model))) {
       tabs.selectTab(t);
       break;
     }
   }
 }
Exemple #3
0
  private void initGUI(final GUIInfo info) {
    // Prepare a value manager that will include all forms spanned in each
    // tab
    vm = new ValuesManager();

    // Create all the tabs each one for a specific setup step
    tabs = new TabSet();
    tabs.setWidth(500);
    tabs.setHeight(250);

    Tab registrationTab = setupRegistration(vm);
    Tab repositoryTab = setupRepository(vm);
    Tab databaseTab = setupDatabase(vm);
    Tab languageTab = setupLanguage(vm);
    Tab smtpTab = setupSmtp(vm);
    tabs.setTabs(registrationTab, repositoryTab, databaseTab, languageTab, smtpTab);

    // This is the button used to confirm each step
    submit = new IButton();
    submit.setTitle(I18N.message("next"));
    submit.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onSubmit(info);
          }
        });

    // Prepare the heading panel with Logo and Title
    // Prepare the logo image to be shown inside the login form
    Label header = new Label(I18N.message("setup"));
    header.setStyleName("setupHeader");
    header.setIcon(Util.brandUrl("logo.png"));
    header.setIconWidth(205);
    header.setIconHeight(40);
    header.setHeight(45);

    // Prepare a panel to layout setup components
    VLayout layout = new VLayout();
    layout.setHeight(500);
    layout.setWidth(400);
    layout.setMembersMargin(5);
    layout.addMember(header);
    layout.addMember(tabs);
    layout.addMember(submit);

    // Panel for horizontal centering
    VLayout vPanel = new VLayout();
    vPanel.setDefaultLayoutAlign(Alignment.CENTER);
    vPanel.setWidth100();
    vPanel.setHeight(300);
    vPanel.addMember(layout);

    RootPanel.get().add(vPanel);

    // Remove the loading frame
    RootPanel.getBodyElement().removeChild(RootPanel.get("loadingWrapper").getElement());
  }
  @Override
  public void attachToCanvas() {
    // remove all previous members, except crumbs
    for (int i = 1; i < canvas.getMembers().length; i++) {
      Canvas m = canvas.getMember(i);
      canvas.removeMember(m);
    }

    if (tabs.getTabs().length == 1) {
      Canvas c = tabs.getTabs()[0].getPane();
      c.setHeight100();
      canvas.addMember(c); // add the pane directly
    } else canvas.addMember(tabs);
  }
 @Override
 public void setStyleName(String styleName) {
   super.setStyleName(styleName);
   for (int i = 0; i < tabs.getNumTabs(); i++) {
     getRibbonBar(i).asWidget().setStyleName(getStyleName());
   }
 }
 public Tab searchTab(JcrExplorer jackrabbitExplorer) {
   Tab searchTab = new Tab();
   searchTab.setTitle("Search");
   TabSet searchTabSet = new TabSet();
   searchTabSet.setTitle("SearchSet");
   searchTabSet.setTabs(
       fullTextSearchTab(jackrabbitExplorer),
       xpathSearchTab(jackrabbitExplorer),
       sqlSearchTab(jackrabbitExplorer));
   searchTabSet.setWidth100();
   searchTabSet.setHeight100();
   VLayout vlLayout = new VLayout();
   vlLayout.addChild(searchTabSet);
   searchTab.setPane(vlLayout);
   return searchTab;
 }
Exemple #7
0
  private DashboardPanel() {
    userTab = new Tab(I18N.message("user"));
    userTab.setID("user");
    userTab.setPane(new UserDashboard());

    tagsTab = new Tab(I18N.message("tags"));
    tagsTab.setID("tags");
    tagsTab.setPane(new TagsDashboard());

    messagesTab = new Tab(I18N.message("messages"));
    messagesTab.setID("messages");
    messagesTab.setPane(new MessagesPanel());

    subscriptionsTab = new Tab(I18N.message("subscriptions"));
    subscriptionsTab.setID("subscriptions");
    subscriptionsTab.setPane(new SubscriptionsPanel());

    workflowTab = new Tab(I18N.message("workflow"));
    workflowTab.setID("workflow");
    workflowTab.setPane(new WorkflowDashboard());

    tabSet.addTab(userTab);

    if (Feature.visible(Feature.TAGS)) {
      tabSet.addTab(tagsTab);
      if (!Feature.enabled(Feature.TAGS)) tagsTab.setPane(new TagsDashboard());
    }

    if (Feature.visible(Feature.MESSAGES)) {
      tabSet.addTab(messagesTab);
      if (!Feature.enabled(Feature.MESSAGES)) messagesTab.setPane(new FeatureDisabled());
    }

    if (Feature.visible(Feature.AUDIT)) {
      tabSet.addTab(subscriptionsTab);
      if (!Feature.enabled(Feature.AUDIT)) subscriptionsTab.setPane(new FeatureDisabled());
    }

    if (Feature.visible(Feature.WORKFLOW)) {
      tabSet.addTab(workflowTab);
      if (!Feature.enabled(Feature.WORKFLOW)) workflowTab.setPane(new FeatureDisabled());
    }

    setMembers(tabSet);

    Session.get().getUser().addObserver(this);
  }
Exemple #8
0
  public static void newTabCustomDisciplina(String module) {

    parentTab = new Tab(module);
    parentTab.setCanClose(true);
    topTabSet.addTab(parentTab);
    DisciplinaUI disciplinaView = new DisciplinaUI();
    disciplinaView.StartUp(parentTab);
  }
Exemple #9
0
  public static void newTabCustomAluno(String module) {

    parentTab = new Tab(module);
    parentTab.setCanClose(true);
    topTabSet.addTab(parentTab);
    AlunoUI alunoView = new AlunoUI();
    alunoView.StartUp(parentTab);
  }
Exemple #10
0
  protected void newTabCustomMatricula(String module) {

    parentTab = new Tab(module);
    parentTab.setCanClose(true);
    topTabSet.addTab(parentTab);
    MatriculaUI matriculaView = new MatriculaUI();
    matriculaView.StartUp(parentTab);
  }
Exemple #11
0
  protected void newTabCustomCurso(String module) {

    parentTab = new Tab(module);
    parentTab.setCanClose(true);
    topTabSet.addTab(parentTab);
    //	CursoUI cursoView = new CursoUI();
    //	cursoView.StartUp(parentTab);

  }
  public Canvas getViewPanel() {

    final TabSet topTabSet = new TabSet();
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setTabBarAlign(Side.LEFT);
    topTabSet.setWidth(400);
    topTabSet.setHeight(200);

    Tab tTab1 = new Tab("Blue", "pieces/16/pawn_blue.png");

    tTab1.setCanClose(true);
    Img tImg1 = new Img("pieces/48/pawn_blue.png", 48, 48);
    tTab1.setPane(tImg1);

    Tab tTab2 = new Tab("Green", "pieces/16/pawn_green.png");
    Img tImg2 = new Img("pieces/48/pawn_green.png", 48, 48);
    tTab2.setPane(tImg2);

    topTabSet.addTab(tTab1);
    topTabSet.addTab(tTab2);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);

    IButton addButton = new IButton("Add Tab");
    addButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            String title = topTabSet.getTabs().length % 2 == 0 ? "Yellow" : "Green";
            String iconType = topTabSet.getTabs().length % 2 == 0 ? "pawn" : "cube";
            Tab tTab = new Tab(title, "pieces/16/" + iconType + "_" + title.toLowerCase() + ".png");
            tTab.setCanClose(true);
            Img tImg =
                new Img("pieces/48/" + iconType + "_" + title.toLowerCase() + ".png", 48, 48);
            tTab.setPane(tImg);
            topTabSet.addTab(tTab);
          }
        });

    IButton removeButton = new IButton("Remove Tab");
    removeButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            topTabSet.removeTab(topTabSet.getTabs().length - 1);
          }
        });

    buttons.addMember(addButton);
    buttons.addMember(removeButton);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(15);
    vLayout.addMember(topTabSet);
    vLayout.addMember(buttons);
    vLayout.setHeight("auto");

    return vLayout;
  }
  private void viewBundleVersion(BundleVersion version, ViewId nextViewId) {
    // Whenever a new view request comes in, make sure to clean house to avoid ID conflicts for
    // sub-widgets
    this.destroyMembers();

    this.version = version;

    addMember(
        new BackButton(
            MSG.view_bundle_version_backToBundle() + ": " + version.getBundle().getName(),
            LinkManager.getBundleLink(version.getBundle().getId())));

    addMember(
        new HeaderLabel(
            Canvas.getImgURL("subsystems/bundle/BundleVersion_24.png"),
            version.getName() + ": " + version.getVersion()));

    // conditionally add tags. Defaults to true, not available in JON builds.
    if (CoreGUI.isTagsEnabledForUI()) {
      addMember(createTagEditor());
    }

    addMember(createSummaryForm());

    TabSet tabs = new TabSet();
    tabs.addTab(createRecipeTab());
    tabs.addTab(createLiveDeploymentsTab());
    tabs.addTab(createFilesTab());
    addMember(tabs);

    if (nextViewId != null) {
      if (nextViewId.getPath().equals("recipe")) {
        tabs.selectTab(0);
      } else if (nextViewId.getPath().equals("deployments")) {
        tabs.selectTab(1);
      } else if (nextViewId.getPath().equals("files")) {
        tabs.selectTab(2);
      } else {
        // should we throw an exception? someone gave a bad URL; just bring them to first tab
        tabs.selectTab(0);
      }
    }

    markForRedraw();
  }
  public Canvas getViewPanel() {

    final TabSet tabSet = new TabSet();
    tabSet.setTabBarPosition(Side.TOP);

    // required so that the select item doesnt touch the tab pane
    tabSet.setTabBarThickness(25);
    tabSet.setTabBarAlign(Side.LEFT);
    tabSet.setWidth(400);
    tabSet.setHeight(200);

    final Tab statusTab = new Tab("Status");

    final Canvas statusPane = new Canvas();
    statusTab.setPane(statusPane);
    tabSet.addTab(statusTab);

    SelectItem selectItem = new SelectItem();
    selectItem.setValueMap("Development", "Staging", "Production");
    selectItem.setShowTitle(false);

    selectItem.setDefaultValue("Development");
    selectItem.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            statusPane.setContents(
                event.getValue()
                    + ": <span style='color:green;font-weight:bold'>Normal</span><br>");
          }
        });

    DynamicForm form = new DynamicForm();
    // form.setHeight(1);
    form.setPadding(0);
    form.setMargin(0);
    form.setCellPadding(1);
    form.setNumCols(1);
    form.setFields(selectItem);

    tabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, form);
    return tabSet;
  }
  /**
   * Create a ribbon bar widget using a back-end spring bean identifier and a map.
   *
   * @param mapWidget The map widget onto which many actions in this ribbon apply.
   * @param application The name of the application wherein to search for the ribbon configuration.
   * @param beanId A unique spring bean identifier for a bean of class {@link RibbonInfo}. This
   *     configuration is then fetched and applied.
   * @param ribbonBarMembersMargin Sets the margin between the different {@link
   *     org.geomajas.widget.utility.common.client.ribbon.RibbonGroup}s. If null, the {@link
   *     GuwLayout#ribbonBarInternalMargin} is used.
   */
  public RibbonTabLayout(
      final MapWidget mapWidget,
      String application,
      String beanId,
      final Integer ribbonBarMembersMargin) {
    tabs = new TabSet();
    tabs.setPaneMargin(0);
    addMember(tabs);

    setOverflow(GuwLayout.ribbonBarOverflow);

    ClientConfigurationService.getApplicationWidgetInfo(
        application,
        beanId,
        new WidgetConfigurationCallback<RibbonInfo>() {

          public void execute(RibbonInfo ribbonInfo) {
            for (RibbonBarInfo tabInfo : ribbonInfo.getTabs()) {
              RibbonBarLayout ribbon = new RibbonBarLayout(tabInfo, mapWidget);
              if (null != ribbonBarMembersMargin) {
                ribbon.setMembersMargin(ribbonBarMembersMargin);
              } else {
                ribbon.setMembersMargin(GuwLayout.ribbonBarInternalMargin);
              }
              // if no custom style is set, replace smartgwt's default 'normal' with our default
              // 'ribbon'.
              String styleName = !"normal".equals(getStyleName()) ? getStyleName() : "ribbon";
              ribbon.setStyleName(styleName);
              ribbon.setBorder("0px");
              Tab tab = new Tab(tabInfo.getTitle());
              tab.setTitleStyle(styleName + "TabTitle");
              tab.setPane(ribbon);
              tabs.addTab(tab);
              tabs.setStyleName(getStyleName() + "TabSet");
            }
          }
        });
  }
Exemple #16
0
 public void updateTagsTab() {
   tabSet.setTabPane("tags", new TagsDashboard());
   tabSet.selectTab("tags");
 }
Exemple #17
0
 public void updateUserTab() {
   tabSet.setTabPane("user", new UserDashboard());
   tabSet.selectTab("user");
 }
  @Override
  public void init() {
    Criteria criteria = null;
    if (parentRecord != null) {
      criteria = new Criteria();
      criteria.setAttribute("Class_id", (Long) parentRecord.getAttributeAsLong("Class_id"));
    } else {

      Record rec = this.selectedRecord;
      criteria = new Criteria();
      criteria.setAttribute("Class_id", (Long) rec.getAttributeAsLong("Class_id"));
    }

    tabs.setHeight100();
    tabs.setWidth100();
    final ClassModelMessages ClassMessagesd =
        (ClassModelMessages) GWT.create(ClassModelMessages.class);

    // let First tab be the Detail page of the current row, ie. the form thing.
    Tab tab_details = new Tab(ClassMessagesd.name_single());
    tab_details.addTabDeselectedHandler(
        detailView); // has to respond with a form save, when we select a different tab
    tab_details.setPane(detailView);
    tabs.addTab(tab_details);
    tab_details.addTabSelectedHandler(
        new TabSelectedHandler() {
          @Override
          public void onTabSelected(TabSelectedEvent event) {
            getBreadcrumbs().removeAfter("Class_single");
          }
        });

    if (userDetails.hasAuthority("CAN_READ_TEAM_TAB")
        || userDetails.hasAuthority("CAN_READ_TAB_TEAM")
        || userDetails.hasAuthority("CAN_READ_CLASS_TAB_REF")) {
      Log.debug("Detected rights: CAN_READ_TEAM_TAB, showing tab");

      teamsInClass_Team_Widget teamsInClass_Team =
          new teamsInClass_Team_Widget(criteria, userDetails);
      this.refs.add(teamsInClass_Team);

      final TeamModelMessages TeamMessages =
          (TeamModelMessages) GWT.create(TeamModelMessages.class);

      Tab tab_teamsInClass_Team_Widget = new Tab(TeamMessages.tab_name_TeamModel());
      tab_teamsInClass_Team_Widget.setPane(teamsInClass_Team);
      modelToTitleMap.put("Team", TeamMessages.tab_name_TeamModel());

      tab_teamsInClass_Team_Widget.addTabSelectedHandler(
          new TabSelectedHandler() {
            @Override
            public void onTabSelected(TabSelectedEvent event) {
              // if the last element's key doesn't end with _single, pop it first
              if (!getBreadcrumbs().lastCrumbIsSingle()) {
                getBreadcrumbs().popLast();
              }

              // then add the target's normal crumb
              getBreadcrumbs().addCrumb("Team", TeamMessages.tab_name_TeamModel());
            }
          });

      tabs.addTab(tab_teamsInClass_Team_Widget);
    } else {
      Log.debug("No rights: CAN_READ_TEAM_TAB detected, not showing tab");
    }

    attachToCanvas();
  }
 public RibbonBar getRibbonBar(int index) {
   return (RibbonBarLayout) tabs.getTab(index).getPane();
 }
 /** switches tab to detail view */
 public void selectDetailView() {
   tabs.selectTab(0);
 }
Exemple #21
0
  public void onModuleLoad() {
    /*
     * SmartGWT components
     */
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setTabBarAlign(Side.LEFT);
    topTabSet.setHeight100();
    topTabSet.setWidth100();
    topTabSet.addTab(loadTab);
    topTabSet.addTab(editTab);
    topTabSet.addTab(errorTab);
    topTabSet.setTabBarControls(
        TabBarControls.TAB_SCROLLER,
        TabBarControls.TAB_PICKER,
        suggestCanvasItem,
        confirmFactorValues,
        exportIDFButton,
        exportSDRFButton,
        revalidateButton);
    RootPanel.get("contentsarea").add(topTabSet);

    /*
     * Buttons
     */
    // Confirm Factor Values
    confirmFactorValues.setWidth(150);
    confirmFactorValues.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            guiMediator.showIDFFactorValue_ValidatorWindow();
          }
        });
    // Export SDRF
    exportSDRFButton.setIcon("[SKIN]actions/download.png");
    exportSDRFButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!guiMediator.getCurrentSDRFTitle().equals("null")) {
              logger.log(Level.INFO, "Export SDRF Button was pressed");
              fileService.writeFile(
                  guiMediator.getCurrentSDRFTitle(),
                  guiMediator.getSDRFAsString(),
                  new FileServiceCallback(guiMediator.getCurrentSDRFTitle()));
            }
          }
        });
    // Export IDF
    exportIDFButton.setIcon("[SKIN]actions/download.png");
    exportIDFButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!guiMediator.getCurrentIDFTitle().equals("null")) {
              logger.log(Level.INFO, "Export IDF Button was pressed");
              fileService.writeFile(
                  guiMediator.getCurrentIDFTitle(),
                  guiMediator.getIDFAsString(),
                  new FileServiceCallback(guiMediator.getCurrentIDFTitle()));
            }
          }
        });
    // Revalidate Button
    revalidateButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!guiMediator.getCurrentSDRFTitle().equals("null")
                && !guiMediator.getCurrentIDFTitle().equals("null")) {
              validationService.validate(
                  guiMediator.getCurrentIDFTitle(),
                  guiMediator.getIDFAsString(),
                  guiMediator.getCurrentSDRFTitle(),
                  guiMediator.getSDRFAsString(),
                  new ValidationServiceCallback(guiMediator));
            }
          }
        });

    // *****************************
    // Layout
    // *****************************

    TagCloudWindow tagCloudWindow = new TagCloudWindow(guiMediator);
    tagCloudWindow.show();
    tagCloudWindow.moveTo(250, 85);
    // tagCloudWindow.moveAbove(canvas)

    // mainLayout.setHtmlElement(DOM.getElementById("webapp"));
    // mainLayout.show();

    // topTabSet.setHtmlElement(DOM.getElementById("webapp"));

    Window.addWindowClosingHandler(
        new Window.ClosingHandler() {
          public void onWindowClosing(Window.ClosingEvent closingEvent) {
            closingEvent.setMessage("Do you really want to leave the page?");
          }
        });
  }
Exemple #22
0
 public void updateWorkflowTab() {
   tabSet.setTabPane("workflow", new WorkflowDashboard());
   tabSet.selectTab("workflow");
 }
Exemple #23
0
 public void updateMessageTab() {
   tabSet.setTabPane("messages", new MessagesPanel());
   tabSet.selectTab("messages");
 }
Exemple #24
0
  private void onSubmit(final GUIInfo info) {
    vm.validate();
    Tab tab = tabs.getSelectedTab();
    int tabIndex = tabs.getSelectedTabNumber();
    DynamicForm form = (DynamicForm) tab.getPane();
    if (form.hasErrors()) {

    } else {
      if (step == 4) {
        if (!vm.validate()) SC.warn("invalidfields");

        SetupInfo data = new SetupInfo();
        data.setDbDriver(vm.getValueAsString(DB_DRIVER));
        data.setDbUrl(vm.getValueAsString(DB_URL));
        data.setDbUsername(vm.getValueAsString(DB_USERNAME));
        data.setDbPassword(vm.getValueAsString(DB_PASSWORD));
        data.setDbEngine(vm.getValueAsString(DB_ENGINE));
        data.setDbType(vm.getValueAsString(DB_TYPE));
        data.setLanguage(vm.getValueAsString(LANGUAGE));
        data.setSmtpHost(vm.getValueAsString(SMTP_HOST));
        data.setSmtpPort((Integer) vm.getValues().get(SMTP_PORT));
        data.setSmtpUsername(vm.getValueAsString(SMTP_USERNAME));
        data.setSmtpPassword(vm.getValueAsString(SMTP_PASSWORD));
        data.setSmtpSender(vm.getValueAsString(SMTP_SENDER));
        data.setSmtpSecureAuth((Boolean) vm.getValues().get(SMTP_SECURE_AUTH));
        data.setSmtpSecuryConntection(vm.getValueAsString(SMTP_SECURITY_CONNECTION));
        data.setRepositoryFolder(vm.getValueAsString(REPOSITORY_FOLDER));
        data.setDbDialect(engines.get(data.getDbEngine())[3]);
        data.setDbValidationQuery(engines.get(data.getDbEngine())[4]);
        data.setRegEmail(vm.getValueAsString(REG_EMAIL));
        data.setRegName(vm.getValueAsString(REG_NAME));
        data.setRegOrganization(vm.getValueAsString(REG_ORGANIZATION));
        data.setRegWebsite(vm.getValueAsString(REG_WEBSITE));
        if (data.getDbType().equals(I18N.message(INTERNAL))) {
          data.setDbEngine("Hsqldb");
          data.setDbDriver("org.hsqldb.jdbcDriver");
          data.setDbUrl(
              ("jdbc:hsqldb:" + data.getRepositoryFolder() + "/db/").replaceAll("//", "/"));
          data.setDbUsername("sa");
          data.setDbPassword("");
          data.setDbValidationQuery("SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS");
          data.setDbDialect("org.hibernate.dialect.HSQLDialect");
        }

        SetupServiceAsync setupService = (SetupServiceAsync) GWT.create(SetupService.class);
        setupService.setup(
            data,
            new AsyncCallback<Void>() {
              @Override
              public void onFailure(Throwable caught) {
                SC.warn(caught.getMessage());
                submit.setDisabled(false);
              }

              @Override
              public void onSuccess(Void arg) {
                SC.say(
                    I18N.message("installationperformed"),
                    I18N.message("installationend", info.getProductName()),
                    new BooleanCallback() {
                      @Override
                      public void execute(Boolean value) {
                        Util.redirect(Util.contextPath() + "frontend.jsp");
                      }
                    });
                submit.setDisabled(false);
              }
            });
        submit.setDisabled(true);

        // Clear an eventually saved documents list grid settings.
        Offline.put("doclist", "");
      } else {
        // Go to the next tab and enable the contained panel
        tabs.selectTab(tabIndex + 1);
        tabs.getSelectedTab().getPane().setDisabled(false);
        if (step < tabs.getSelectedTabNumber()) step++;
        if (step == 4) submit.setTitle(I18N.message("setup"));
      }
    }
  }
Exemple #25
0
 public void updateSubscriptionsTab() {
   tabSet.setTabPane("subscriptions", new SubscriptionsPanel());
   tabSet.selectTab("subscriptions");
 }
Exemple #26
0
  public void onModuleLoad() {

    topTabSet = new TabSet();
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setWidth(1024);
    topTabSet.setHeight(768);
    topTabSet.setTabBarThickness(50);

    Tab tTab1 = new Tab("Menu", "assets/mainMenu.png");
    Img tImg1 = new Img("pieces/48/pawn_blue.png", 96, 96);

    topTabSet.addTab(tTab1);

    Tab lTab1 = new Tab();
    lTab1.setIcon("pieces/16/pawn_blue.png", 16);
    Img lImg1 = new Img("pieces/48/pawn_blue.png", 48, 48);
    lTab1.setPane(lImg1);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(15);
    vLayout.addMember(topTabSet);
    vLayout.addMember(buttons);
    // vLayout.addMember(leftTabSet);
    vLayout.setHeight("*");

    vLayout.draw();

    final HLayout hLayout = new HLayout();
    hLayout.setWidth100();
    hLayout.setHeight100();
    hLayout.setLayoutMargin(20);

    // tree menu
    TreeGrid tree = new TreeGrid();
    tree.setShowConnectors(true);
    tree.setShowResizeBar(true);

    Tree dataTree = new Tree();
    dataTree.setModelType(TreeModelType.CHILDREN);
    dataTree.setRoot(
        new TreeNode(
            "root",
            new TreeNode("Aluno"),
            new TreeNode("Funcionario"),
            new TreeNode("Contato"),
            new TreeNode("Veiculo"),
            new TreeNode("Disciplina")));

    tree.setData(dataTree);

    TreeGridField fieldTree = new TreeGridField("Navegacao");
    fieldTree.setCellFormatter(
        new CellFormatter() {
          public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
            return record.getAttribute("name");
          }
        });
    tree.setFields(fieldTree);

    // layout esquerda
    SectionStack leftSideLayout = new SectionStack();
    leftSideLayout.setWidth(200);
    leftSideLayout.setShowResizeBar(true);
    leftSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE);
    leftSideLayout.setAnimateSections(true);

    leftSideLayout.setMembers(tree);

    // UIs
    final AlunoUI alunoUI = new AlunoUI();
    final FuncionarioUI funcionarioUI = new FuncionarioUI();
    final ContatoUI contatoUI = new ContatoUI();
    final VeiculoUI veiculoUI = new VeiculoUI();
    final DisciplinaUI disciplinaUI = new DisciplinaUI();

    // layout direita
    final SectionStack rightSideLayout = new SectionStack();
    rightSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE);
    rightSideLayout.setAnimateSections(true);

    grid = alunoUI.getGrid();
    formBotoes = alunoUI.getFormBotoes();
    menuItens = new DynamicForm();
    menuItens.setWidth(100);
    menuItens.setAlign(Alignment.RIGHT);

    ButtonItem aluno = new ButtonItem("Aluno");
    aluno.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomAluno("Aluno");
          }
        });

    ButtonItem disc = new ButtonItem("Disciplina");
    disc.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomDisciplina("Disciplina");
          }
        });

    ButtonItem curso = new ButtonItem("Curso");
    curso.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomCurso("Curso");
          }
        });

    ButtonItem matric = new ButtonItem("Matricula");
    matric.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomMatricula("Matricula");
          }
        });

    menuItens.setFields(aluno, disc, curso, matric);

    rightSideLayout.setMembers(menuItens);
    rightSideLayout.setWidth(200);
    // seleciona tree
    tree.addNodeClickHandler(
        new NodeClickHandler() {
          public void onNodeClick(NodeClickEvent event) {
            String node = event.getNode().getAttribute("name");
            if (node.equals("Aluno")) {
              // rightSideLayout.removeMembers(formBotoes,grid);
              // Tab tab = new Tab(node);
              newTabCustomAluno(node);
            } else {
              if (node.equals("Disciplina")) {
                newTabCustomDisciplina(node);
              } else {
                if (node.equals("Curso")) {
                  //	newTabCustom(node);
                } else {
                  if (node.equals("Matricula")) {
                    //	newTabCustom(node);
                  } else {
                    if (node.equals("Disciplina")) {
                      rightSideLayout.removeMembers(formBotoes, grid);
                      grid = disciplinaUI.getGrid();
                      formBotoes = disciplinaUI.getFormBotoes();
                      rightSideLayout.setMembers(formBotoes, grid);
                    }
                  }
                }
              }
            }
          }
        });

    // hLayout

    hLayout.addMember(leftSideLayout);
    hLayout.addMember(rightSideLayout);
    hLayout.draw();

    tTab1.setPane(hLayout);
  }
  public TabCalendar() {
    try {
      setTitle(CallCenter.constants.menuCalendar());
      setCanClose(true);

      datasource = DataSource.get("CalSecDS");

      mainLayout = new VLayout(5);
      mainLayout.setWidth100();
      mainLayout.setHeight100();
      mainLayout.setMargin(5);

      searchForm = new DynamicForm();
      searchForm.setAutoFocus(true);
      searchForm.setWidth(780);
      searchForm.setTitleWidth(300);
      searchForm.setNumCols(4);
      mainLayout.addMember(searchForm);

      calendarStateItem = new ComboBoxItem();
      calendarStateItem.setTitle(CallCenter.constants.type());
      calendarStateItem.setWidth(300);
      calendarStateItem.setName("calendar_state_id");
      calendarStateItem.setValueMap(ClientMapUtil.getInstance().getCalendarStates());
      calendarStateItem.setAddUnknownValues(false);

      secCalendarTypeItem = new ComboBoxItem();
      secCalendarTypeItem.setTitle(CallCenter.constants.moonPhase());
      secCalendarTypeItem.setWidth(300);
      secCalendarTypeItem.setName("calendar_event_id");
      secCalendarTypeItem.setValueMap(ClientMapUtil.getInstance().getSecCalendarTypes());
      secCalendarTypeItem.setAddUnknownValues(false);

      calendarDayItem = new DateItem();
      calendarDayItem.setTitle(CallCenter.constants.date());
      calendarDayItem.setWidth(300);
      calendarDayItem.setValue(new Date());
      calendarDayItem.setName("calendar_day");
      calendarDayItem.setHint(CallCenter.constants.choose());

      descriptionItem = new TextItem();
      descriptionItem.setTitle(CallCenter.constants.description());
      descriptionItem.setName("calendar_description");
      descriptionItem.setWidth(300);

      commentItem = new TextItem();
      commentItem.setTitle(CallCenter.constants.comment());
      commentItem.setName("calendar_comment");
      commentItem.setWidth(300);

      byCalendarDayItem = new CheckboxItem();
      byCalendarDayItem.setTitle(CallCenter.constants.searchByDate());
      byCalendarDayItem.setWidth(300);
      byCalendarDayItem.setName("buCalDaySearch");
      byCalendarDayItem.setValue(false);

      searchForm.setFields(
          calendarStateItem,
          secCalendarTypeItem,
          descriptionItem,
          commentItem,
          byCalendarDayItem,
          calendarDayItem);

      HLayout buttonLayout = new HLayout(5);
      buttonLayout.setWidth(780);
      buttonLayout.setHeight(30);
      buttonLayout.setAlign(Alignment.RIGHT);

      clearButton = new IButton();
      clearButton.setTitle(CallCenter.constants.clear());

      findButton = new IButton();
      findButton.setTitle(CallCenter.constants.find());

      buttonLayout.setMembers(findButton, clearButton);
      mainLayout.addMember(buttonLayout);

      ToolStrip toolStrip = new ToolStrip();
      toolStrip.setWidth(780);
      toolStrip.setPadding(5);
      mainLayout.addMember(toolStrip);

      addBtn = new ToolStripButton(CallCenter.constants.add(), "addIcon.png");
      addBtn.setLayoutAlign(Alignment.LEFT);
      addBtn.setWidth(50);
      toolStrip.addButton(addBtn);

      editBtn = new ToolStripButton(CallCenter.constants.modify(), "editIcon.png");
      editBtn.setLayoutAlign(Alignment.LEFT);
      editBtn.setWidth(50);
      toolStrip.addButton(editBtn);

      disableBtn = new ToolStripButton(CallCenter.constants.disable(), "deleteIcon.png");
      disableBtn.setLayoutAlign(Alignment.LEFT);
      disableBtn.setWidth(50);
      toolStrip.addButton(disableBtn);

      activateBtn = new ToolStripButton(CallCenter.constants.enable(), "restoreIcon.gif");
      activateBtn.setLayoutAlign(Alignment.LEFT);
      activateBtn.setWidth(50);
      toolStrip.addButton(activateBtn);

      toolStrip.addSeparator();

      copyBtn = new ToolStripButton(CallCenter.constants.copy(), "copy.png");
      copyBtn.setLayoutAlign(Alignment.LEFT);
      copyBtn.setWidth(50);
      toolStrip.addButton(copyBtn);

      listGrid =
          new ListGrid() {
            protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) {
              ListGridRecord countryRecord = (ListGridRecord) record;
              if (countryRecord == null) {
                return super.getCellCSSText(record, rowNum, colNum);
              }
              Integer deleted = countryRecord.getAttributeAsInt("deleted");
              if (deleted != null && !deleted.equals(0)) {
                return "color:red;";
              } else {
                return super.getCellCSSText(record, rowNum, colNum);
              }
            };
          };

      listGrid.setWidth(780);
      listGrid.setHeight(260);
      listGrid.setAlternateRecordStyles(true);
      listGrid.setDataSource(datasource);
      listGrid.setAutoFetchData(false);
      listGrid.setShowFilterEditor(false);
      listGrid.setCanEdit(false);
      listGrid.setCanRemoveRecords(false);
      listGrid.setFetchOperation("searchAllSecularCalendars");
      listGrid.setShowRowNumbers(true);
      listGrid.setCanHover(true);
      listGrid.setShowHover(true);
      listGrid.setShowHoverComponents(true);

      datasource.getField("calendar_day").setTitle(CallCenter.constants.date());
      datasource.getField("event").setTitle(CallCenter.constants.moonPhase());
      datasource.getField("state").setTitle(CallCenter.constants.type());
      datasource.getField("sun_rise").setTitle(CallCenter.constants.order());
      datasource.getField("calendar_description").setTitle(CallCenter.constants.description());

      datasource.getField("calendar_comment").setTitle(CallCenter.constants.comment());
      datasource.getField("rec_date").setTitle(CallCenter.constants.recDate());
      datasource.getField("rec_user").setTitle(CallCenter.constants.recUser());
      datasource.getField("upd_date").setTitle(CallCenter.constants.updDate());
      datasource.getField("upd_user").setTitle(CallCenter.constants.updUser());

      ListGridField calendar_day =
          new ListGridField("calendar_day", CallCenter.constants.date(), 150);
      ListGridField event = new ListGridField("event", CallCenter.constants.moonPhase(), 150);
      ListGridField state = new ListGridField("state", CallCenter.constants.type(), 80);
      ListGridField sun_rise = new ListGridField("sun_rise", CallCenter.constants.sunRise(), 100);
      ListGridField calendar_description =
          new ListGridField("calendar_description", CallCenter.constants.description(), 250);

      calendar_day.setAlign(Alignment.LEFT);
      event.setAlign(Alignment.LEFT);
      state.setAlign(Alignment.CENTER);
      sun_rise.setAlign(Alignment.CENTER);

      listGrid.setFields(calendar_day, event, state, sun_rise, calendar_description);

      mainLayout.addMember(listGrid);
      findButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              search();
            }
          });
      clearButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              calendarStateItem.clearValue();
              secCalendarTypeItem.clearValue();
              calendarDayItem.clearValue();
              descriptionItem.clearValue();
              commentItem.clearValue();
            }
          });
      addBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, null, false);
              dlgEditSecCalendar.show();
            }
          });

      editBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, listGridRecord, false);
              dlgEditSecCalendar.show();
            }
          });

      copyBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, listGridRecord, true);
              dlgEditSecCalendar.show();
            }
          });

      disableBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              Integer deleted = listGridRecord.getAttributeAsInt("deleted");
              if (!deleted.equals(0)) {
                SC.say(CallCenter.constants.recordAlrDisabled());
                return;
              }
              final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id");
              SC.ask(
                  CallCenter.constants.askForDisable(),
                  new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                      if (value) {
                        changeStatus(calendar_id, 1);
                      }
                    }
                  });
            }
          });
      activateBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              Integer deleted = listGridRecord.getAttributeAsInt("deleted");
              if (deleted.equals(0)) {
                SC.say(CallCenter.constants.recordAlrEnabled());
                return;
              }
              final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id");
              SC.ask(
                  CallCenter.constants.askForEnable(),
                  new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                      if (value) {
                        changeStatus(calendar_id, 0);
                      }
                    }
                  });
            }
          });

      TabSet tabSet = new TabSet();
      tabSet.setWidth(780);
      Tab tabDetViewer = new Tab(CallCenter.constants.view());
      final DetailViewer detailViewer = new DetailViewer();
      detailViewer.setDataSource(datasource);
      detailViewer.setWidth(750);
      tabDetViewer.setPane(detailViewer);

      listGrid.addRecordClickHandler(
          new RecordClickHandler() {
            public void onRecordClick(RecordClickEvent event) {
              detailViewer.viewSelectedData(listGrid);
            }
          });

      listGrid.addRecordDoubleClickHandler(
          new RecordDoubleClickHandler() {
            @Override
            public void onRecordDoubleClick(RecordDoubleClickEvent event) {
              ListGridRecord listGridRecord = listGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenter.constants.pleaseSelrecord());
                return;
              }
              DlgAddEditSecCalendar dlgEditSecCalendar =
                  new DlgAddEditSecCalendar(listGrid, listGridRecord, false);
              dlgEditSecCalendar.show();
            }
          });

      tabSet.setTabs(tabDetViewer);
      mainLayout.addMember(tabSet);
      setPane(mainLayout);
    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.getMessage().toString());
    }
  }
Exemple #28
0
  public ProxyPanel(GUIParameter[] parameters) {
    setWidth100();
    setMembersMargin(10);
    setMargin(30);
    setHeight(400);

    TabSet tabs = new TabSet();
    tabs.setWidth(380);
    tabs.setHeight(250);
    Tab tab = new Tab();
    tab.setTitle(I18N.message("proxy"));
    tabs.setTabs(tab);

    DynamicForm proxySettingsForm = new DynamicForm();
    proxySettingsForm.setWidth(300);
    proxySettingsForm.setColWidths(1, "*");
    proxySettingsForm.setValuesManager(vm);
    proxySettingsForm.setTitleOrientation(TitleOrientation.LEFT);

    List<FormItem> items = new ArrayList<FormItem>();

    for (GUIParameter f : parameters) {
      if (f.getName().equals("password")) {
        PasswordItem item = ItemFactory.newPasswordItem(f.getName(), f.getName(), f.getValue());
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      } else if (f.getName().equals("port")) {
        IntegerItem item =
            ItemFactory.newValidateIntegerItem(
                f.getName(), f.getName(), Integer.parseInt(f.getValue()), 1, null);
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      } else {
        TextItem item = ItemFactory.newTextItem(f.getName(), f.getName(), f.getValue());
        item.setRequired(true);
        item.setWidth(250);
        items.add(item);
      }
    }

    proxySettingsForm.setItems(items.toArray(new FormItem[0]));

    IButton save = new IButton();
    save.setTitle(I18N.message("save"));
    save.addClickHandler(
        new ClickHandler() {
          @SuppressWarnings("unchecked")
          public void onClick(ClickEvent event) {
            Map<String, Object> values = (Map<String, Object>) vm.getValues();

            if (vm.validate()) {
              List<GUIParameter> proxySettings = new ArrayList<GUIParameter>();
              for (String name : values.keySet()) {
                GUIParameter proxyParam = new GUIParameter(name, values.get(name).toString());
                proxySettings.add(proxyParam);
              }

              service.saveProxySettings(
                  Session.get().getSid(),
                  proxySettings.toArray(new GUIParameter[0]),
                  new AsyncCallback<Void>() {
                    @Override
                    public void onFailure(Throwable caught) {
                      Log.serverError(caught);
                    }

                    @Override
                    public void onSuccess(Void result) {
                      Log.info(I18N.message("settingssaved"), null);
                    }
                  });
            }
          }
        });

    tab.setPane(proxySettingsForm);
    setMembers(tabs, save);
  }