Exemplo n.º 1
0
  private Tab createRecipeTab() {
    Tab tab = new Tab(MSG.view_bundle_recipe());
    DynamicForm form = new DynamicForm();

    TextAreaItem recipeCanvas = new TextAreaItem("recipe", MSG.view_bundle_recipe());
    recipeCanvas.setShowTitle(false);
    recipeCanvas.setColSpan(2);
    recipeCanvas.setWidth("100%");
    recipeCanvas.setHeight("100%");
    recipeCanvas.setValue(version.getRecipe());
    recipeCanvas.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            // makes this read-only; however, since its not disabled, user can still select/copy the
            // text
            event.cancel();
          }
        });

    form.setHeight100();
    form.setWidth100();
    form.setItems(recipeCanvas);
    tab.setPane(form);
    return tab;
  }
Exemplo n.º 2
0
 private Tab createLiveDeploymentsTab() {
   Tab tab = new Tab(MSG.view_bundle_deployments());
   Criteria criteria = new Criteria();
   criteria.setAttribute("bundleVersionId", version.getId());
   tab.setPane(new BundleDeploymentListView(criteria, this.canDeploy));
   return tab;
 }
Exemplo n.º 3
0
  /** Prepares the SMTP form */
  private Tab setupSmtp(final ValuesManager vm) {
    // Prepare the SMTP connection tab
    Tab smtpTab = new Tab();
    smtpTab.setTitle(I18N.message("smtpserver"));
    final DynamicForm smtpForm = new DynamicForm();
    smtpForm.setDisabled(true);
    smtpForm.setID("smtpForm");
    smtpForm.setTitleOrientation(TitleOrientation.TOP);
    smtpForm.setValuesManager(vm);
    smtpTab.setPane(smtpForm);

    TextItem smtpHost = ItemFactory.newTextItem(SMTP_HOST, "host", null);
    smtpHost.setValue("localhost");
    smtpHost.setWrapTitle(false);

    IntegerItem smtpPort = ItemFactory.newIntegerItem(SMTP_PORT, "port", null);
    smtpPort.setValue(25);
    smtpPort.setWrapTitle(false);

    TextItem smtpUsername = ItemFactory.newTextItem(SMTP_USERNAME, "username", null);
    smtpUsername.setWrapTitle(false);

    PasswordItem smtpPassword = new PasswordItem();
    smtpPassword.setTitle(I18N.message("password"));
    smtpPassword.setName(SMTP_PASSWORD);
    smtpPassword.setWrapTitle(false);

    BooleanItem smtpSecureAuth = new BooleanItem();
    smtpSecureAuth.setTitle(I18N.message("secureauth"));
    smtpSecureAuth.setName(SMTP_SECURE_AUTH);
    smtpSecureAuth.setWrapTitle(false);
    smtpSecureAuth.setDefaultValue(false);

    SelectItem smtpConnectionSecurity = new SelectItem();
    smtpConnectionSecurity.setTitle(I18N.message("connectionsecurity"));
    smtpConnectionSecurity.setName("smtpConnectionSecurity");
    smtpConnectionSecurity.setDefaultValue(Constants.SMTP_SECURITY_NONE);
    smtpConnectionSecurity.setWrapTitle(false);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    valueMap.put(Constants.SMTP_SECURITY_NONE, I18N.message("none"));
    valueMap.put(Constants.SMTP_SECURITY_SSL, I18N.message("ssl"));
    valueMap.put(Constants.SMTP_SECURITY_TLS, I18N.message("tls"));
    valueMap.put(Constants.SMTP_SECURITY_TLS_IF_AVAILABLE, I18N.message("tlsavailable"));
    smtpConnectionSecurity.setValueMap(valueMap);

    TextItem smtpSender = ItemFactory.newEmailItem(SMTP_SENDER, "sender", false);
    smtpSender.setWrapTitle(false);
    smtpSender.setValue("*****@*****.**");

    smtpForm.setFields(
        smtpHost,
        smtpPort,
        smtpUsername,
        smtpPassword,
        smtpSender,
        smtpConnectionSecurity,
        smtpSecureAuth);
    return smtpTab;
  }
Exemplo n.º 4
0
 public void addTab(Tab tab, boolean select) {
   if (centerTabSet.getTab(tab.getID()) == null) {
     centerTabSet.addTab(tab);
   }
   if (select) {
     centerTabSet.selectTab(tab.getID());
   }
 }
 public void selectTabByModel(String model) {
   for (Tab t : tabs.getTabs()) {
     if (t.getTitle().equals(modelToTitleMap.get(model))) {
       tabs.selectTab(t);
       break;
     }
   }
 }
Exemplo n.º 6
0
  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;
  }
  // This is invoked by an event fired in SubTabLayout when the user clicks a SubTab button. It sets
  // the Tab
  // and fires an event to notify AbstractTwoLevelTabSet that a tab/subtab has been selected.
  public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
    // if requested, ignore select tab notifications. smartgwt can generate unwanted notifications
    // while we manipulate the tabset (e.g. when hiding the current tab). We want to manage this at
    // a higher level
    if (isIgnoreSelectEvents()) {
      return;
    }

    tabSelectedEvent.setTabNum(getSelectedTabNumber());
    Tab tab = getSelectedTab();
    tabSelectedEvent.setId(this.getTabByTitle(tab.getTitle()).getName());
    m.fireEvent(tabSelectedEvent);
  }
 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;
 }
Exemplo n.º 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);
  }
Exemplo n.º 10
0
  protected void newTabCustomMatricula(String module) {

    parentTab = new Tab(module);
    parentTab.setCanClose(true);
    topTabSet.addTab(parentTab);
    MatriculaUI matriculaView = new MatriculaUI();
    matriculaView.StartUp(parentTab);
  }
Exemplo n.º 11
0
  public static void newTabCustomDisciplina(String module) {

    parentTab = new Tab(module);
    parentTab.setCanClose(true);
    topTabSet.addTab(parentTab);
    DisciplinaUI disciplinaView = new DisciplinaUI();
    disciplinaView.StartUp(parentTab);
  }
Exemplo n.º 12
0
  /** Prepares the language form */
  private Tab setupLanguage(final ValuesManager vm) {
    Tab languageTab = new Tab();
    languageTab.setTitle(I18N.message(LANGUAGE));

    SelectItem languageItem = ItemFactory.newLanguageSelector(LANGUAGE, false, true);
    languageItem.setTitle(I18N.message("defaultlang"));
    languageItem.setRequired(true);
    languageItem.setValue(I18N.getLocale());

    final DynamicForm languageForm = new DynamicForm();
    languageForm.setID("languageForm");
    languageForm.setValuesManager(vm);
    languageForm.setFields(languageItem);
    languageForm.setDisabled(true);
    languageTab.setPane(languageForm);
    return languageTab;
  }
Exemplo n.º 13
0
  protected void newTabCustomCurso(String module) {

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

  }
  private Tab fullTextSearchTab(JcrExplorer jackrabbitExplorer) {
    Tab searchFullTextTab = new Tab();
    searchFullTextTab.setTitle("Full Text Search");
    final DynamicForm searchFullTextForm = new DynamicForm();
    searchFullTextForm.setID("searchFullTextForm");
    searchFullTextForm.setNumCols(3);
    searchFullTxt.setName("searchFullTxt");
    searchFullTxt.setTitle("Full Text Search");
    searchFullTxt.setWidth(250);
    searchFullTxt.setRequired(true);
    //		RegExpValidator regExpValidator = new RegExpValidator();
    //		regExpValidator.setExpression("^[\\w\\d\\_\\.]{1,}$");
    //		searchFullTxt.setValidateOnChange(true);
    //		searchFullTxt.setValidators(regExpValidator);
    SubmitItem searchFullTextSubmitItem = new SubmitItem("searchFullTextSubmitItem");
    searchFullTextSubmitItem.setTitle("Search");
    searchFullTextSubmitItem.setWidth(100);
    class SearchFullTextSubmitValuesHandler implements SubmitValuesHandler {
      private JcrExplorer jackrabbitExplorer;

      public SearchFullTextSubmitValuesHandler(JcrExplorer jackrabbitExplorer) {
        this.jackrabbitExplorer = jackrabbitExplorer;
      }

      public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) {
        if (searchFullTextForm.validate()) {
          JcrExplorer.showLoadingImg();
          JcrExplorer.service.fullTextSearch(
              searchFullTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer));
        }
      }
    };
    searchFullTextForm.addSubmitValuesHandler(
        new SearchFullTextSubmitValuesHandler(jackrabbitExplorer));
    searchFullTextForm.setSaveOnEnter(true);
    searchFullTxt.setStartRow(true);
    searchFullTxt.setEndRow(false);
    searchFullTextSubmitItem.setStartRow(false);
    searchFullTextSubmitItem.setEndRow(true);
    searchFullTextForm.setItems(searchFullTxt, searchFullTextSubmitItem);
    searchFullTextTab.setPane(searchFullTextForm);
    return searchFullTextTab;
  }
Exemplo n.º 15
0
  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;
  }
Exemplo n.º 16
0
  /** Prepares the repository form */
  private Tab setupRepository(final ValuesManager vm) {
    // Prepare the tab used to configure the repository where documents and
    // other data will be stored
    Tab repositoryTab = new Tab();
    repositoryTab.setTitle(I18N.message("repository"));

    final DynamicForm repositoryForm = new DynamicForm();
    repositoryForm.setID("repositoryForm");
    repositoryForm.setValuesManager(vm);
    TextItem repositoryItem = ItemFactory.newTextItem(REPOSITORY_FOLDER, "repofolder", null);
    repositoryItem.setWidth(200);
    repositoryItem.setRequired(true);
    repositoryItem.setWrapTitle(false);
    repositoryItem.setDefaultValue(getDefaultFolder());
    repositoryForm.setFields(repositoryItem);
    repositoryForm.setDisabled(true);

    repositoryTab.setPane(repositoryForm);
    return repositoryTab;
  }
  private Tab xpathSearchTab(JcrExplorer jackrabbitExplorer) {
    Tab searchXpathTab = new Tab();
    searchXpathTab.setTitle("Xpath Search");
    final DynamicForm searchXpathForm = new DynamicForm();
    searchXpathForm.setID("searchXpathForm");
    searchXpathForm.setNumCols(3);
    searchXpathTxt.setName("searchXpathTxt");
    searchXpathTxt.setTitle("Xpath Search");
    searchXpathTxt.setWidth(250);
    searchXpathTxt.setRequired(true);
    SubmitItem searchXpathSubmitItem = new SubmitItem("searchXpathSubmitItem");
    searchXpathSubmitItem.setTitle("Search");
    searchXpathSubmitItem.setWidth(100);
    class SearchXpathSubmitValuesHandler implements SubmitValuesHandler {
      private JcrExplorer jackrabbitExplorer;

      public SearchXpathSubmitValuesHandler(JcrExplorer jackrabbitExplorer) {
        this.jackrabbitExplorer = jackrabbitExplorer;
      }

      public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) {
        if (searchXpathForm.validate()) {
          JcrExplorer.showLoadingImg();
          JcrExplorer.service.xpathSearch(
              searchXpathTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer));
        }
      }
    };
    searchXpathForm.addSubmitValuesHandler(new SearchXpathSubmitValuesHandler(jackrabbitExplorer));
    searchXpathForm.setSaveOnEnter(true);
    searchXpathTxt.setStartRow(true);
    searchXpathTxt.setEndRow(false);
    searchXpathSubmitItem.setStartRow(false);
    searchXpathSubmitItem.setEndRow(true);
    searchXpathForm.setItems(searchXpathTxt, searchXpathSubmitItem);
    searchXpathTab.setPane(searchXpathForm);
    return searchXpathTab;
  }
Exemplo n.º 18
0
  /** Prepares the registration form */
  private Tab setupRegistration(final ValuesManager vm) {
    Tab registrationTab = new Tab();
    registrationTab.setTitle(I18N.message("registration"));

    TextItem regName = ItemFactory.newTextItem(REG_NAME, "name", null);
    regName.setWrapTitle(false);

    TextItem regOrganization = ItemFactory.newTextItem(REG_ORGANIZATION, "organization", null);
    regOrganization.setWrapTitle(false);

    TextItem regWebsite = ItemFactory.newTextItem(REG_WEBSITE, "website", null);
    regWebsite.setWrapTitle(false);

    TextItem regEmail = ItemFactory.newEmailItem(REG_EMAIL, "email", false);
    regEmail.setWrapTitle(false);

    final DynamicForm regForm = new DynamicForm();
    regForm.setID("regForm");
    regForm.setValuesManager(vm);
    regForm.setFields(regName, regEmail, regOrganization, regWebsite);

    registrationTab.setPane(regForm);
    return registrationTab;
  }
Exemplo n.º 19
0
 public void removeTab(Tab tab) {
   if (centerTabSet.getTab(tab.getID()) != null) {
     centerTabSet.removeTab(tab);
   }
 }
  public UserDetailTabPane(DataSource userDS, final ItemListGrid userListGrid) {

    this.userListGrid = userListGrid;
    setStyleName("defaultBorder");

    userViewer = new DetailViewer();
    userViewer.setDataSource(userDS);
    userViewer.setWidth100();
    userViewer.setMargin(25);
    userViewer.setEmptyMessage("Select an user to view its details");

    editorLabel = new Label();
    editorLabel.setWidth100();
    editorLabel.setHeight100();
    editorLabel.setAlign(Alignment.CENTER);
    editorLabel.setContents("Select an user to edit, or insert a new user into");

    insertLabel = new Label();
    insertLabel.setWidth100();
    insertLabel.setHeight100();
    insertLabel.setAlign(Alignment.CENTER);
    insertLabel.setContents("Insert a new user into");

    // update form
    editorForm = new DynamicForm();
    editorForm.setWidth(650);
    editorForm.setMargin(25);
    editorForm.setNumCols(4);
    editorForm.setCellPadding(5);
    editorForm.setAutoFocus(false);
    editorForm.setDataSource(userDS);
    editorForm.setUseAllDataSourceFields(true);

    userId = new StaticTextItem("userId", "User ID");
    userName = new TextItem("userName", "User Name");
    password = new PasswordItem("password", "Password");
    enabled = new CheckboxItem("enabled", "Enabled");

    userName.setRequired(true);
    password.setRequired(true);

    ButtonItem saveButton = new ButtonItem("saveUser", "Update user info.");
    saveButton.setAlign(Alignment.CENTER);
    saveButton.setWidth(100);
    saveButton.setColSpan(4);
    saveButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            // editorForm.saveData();

            if (userId.getValue() == null) {
              return;
            }

            if (!editorForm.validate(false)) {
              return;
            }
            User user = new User();

            user.setUserId((String) userId.getValue());
            user.setUserName(userName.getValueAsString());
            user.setPassword(password.getValueAsString());
            user.setEnabled(enabled.getValueAsBoolean());

            userService.updateUser(
                user,
                new AsyncCallback<Void>() {
                  public void onFailure(Throwable caught) {
                    SC.say("Error", "Server side error occured. Contact your administrator.");
                  }

                  public void onSuccess(Void noAnswer) {
                    SC.say("Updated", "User info. is updated.");

                    userListGrid.invalidateCache();
                  }
                });
          }
        });

    editorForm.setFields(userId, userName, password, enabled, saveButton);
    editorForm.setColWidths(100, 200, 100, 200);

    // insert form
    insertForm = new DynamicForm();
    insertForm.setWidth(650);
    insertForm.setMargin(25);
    insertForm.setNumCols(4);
    insertForm.setCellPadding(5);
    insertForm.setAutoFocus(false);
    insertForm.setDataSource(userDS);
    insertForm.setUseAllDataSourceFields(true);

    userId4add = new TextItem("userId", "User ID");
    userName4add = new TextItem("userName", "User Name");
    password4add = new PasswordItem("password", "Password");
    enabled4add = new CheckboxItem("enabled", "Enabled");

    enabled4add.setValue(true);
    userId4add.setRequired(true);
    userName4add.setRequired(true);
    password4add.setRequired(true);

    ButtonItem addButton = new ButtonItem("addUser", "Add user info.");
    addButton.setAlign(Alignment.CENTER);
    addButton.setWidth(100);
    addButton.setColSpan(4);
    addButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {

            if (!insertForm.validate(false)) {
              return;
            }

            User user = new User();

            user.setUserId(userId4add.getValueAsString());
            user.setUserName(userName4add.getValueAsString());
            user.setPassword(password4add.getValueAsString());
            user.setEnabled(enabled4add.getValueAsBoolean());

            userService.addUser(
                user,
                new AsyncCallback<Void>() {
                  public void onFailure(Throwable caught) {
                    SC.say("Error", "Server side error occured. Contact your administrator.");
                  }

                  public void onSuccess(Void noAnswer) {
                    SC.say("Added", "User info. is added.");

                    userListGrid.invalidateCache();
                    insertForm.clearValues();
                  }
                });
          }
        });

    insertForm.setFields(userId4add, userName4add, password4add, enabled4add, addButton);
    insertForm.setColWidths(100, 200, 100, 200);

    // tab
    Tab viewTab = new Tab("View");
    viewTab.setIcon("silk/application_form.png");
    viewTab.setWidth(70);
    viewTab.setPane(userViewer);

    Tab editTab = new Tab("Edit");
    editTab.setIcon("demoApp/icon_edit.png");
    editTab.setWidth(70);
    editTab.setPane(editorForm);

    Tab insertTab = new Tab("Add");
    insertTab.setIcon("demoApp/icon_add.png");
    insertTab.setWidth(70);
    insertTab.setPane(insertForm);

    setTabs(viewTab, editTab, insertTab);

    addTabSelectedHandler(
        new TabSelectedHandler() {
          public void onTabSelected(TabSelectedEvent event) {
            updateDetails();
          }
        });
  }
  @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();
  }
Exemplo n.º 22
0
 private Tab createFilesTab() {
   Tab tab = new Tab(MSG.view_bundle_files());
   FileListView filesView = new FileListView(version.getId());
   tab.setPane(filesView);
   return tab;
 }
Exemplo n.º 23
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);
  }
Exemplo n.º 24
0
  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());
    }
  }
Exemplo n.º 25
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);
  }
Exemplo n.º 26
0
  /** Prepares the database tab */
  private Tab setupDatabase(final ValuesManager vm) {
    // Prepare the map with all database engines
    engines.put(
        MYSQL,
        new String[] {
          "MySQL 5.x",
          "com.mysql.jdbc.Driver",
          "jdbc:mysql://<server>[,<failoverhost>][<:3306>]/<database>",
          "org.hibernate.dialect.MySQLDialect",
          "SELECT 1"
        });
    engines.put(
        "PostgreSQL",
        new String[] {
          "PostgreSQL 9.x",
          "org.postgresql.Driver",
          "jdbc:postgresql:[<//server>[<:5432>/]]<database>",
          "org.hibernate.dialect.PostgreSQLDialect",
          "SELECT 1"
        });
    engines.put(
        ORACLE,
        new String[] {
          "Oracle 10g/11g",
          "oracle.jdbc.driver.OracleDriver",
          "jdbc:oracle:thin:@<server>[<:1521>]:<sid>",
          "org.hibernate.dialect.Oracle10gDialect",
          "SELECT 1 FROM DUAL"
        });
    engines.put(
        SQLSERVER,
        new String[] {
          "SQL Server 2005/2008",
          "net.sourceforge.jtds.jdbc.Driver",
          "jdbc:jtds:sqlserver://<server>[:<1433>]/<database>;instance=<instance>",
          "org.hibernate.dialect.SQLServerDialect",
          "SELECT 1"
        });

    Tab databaseTab = new Tab();
    databaseTab.setTitle(I18N.message("database"));

    final DynamicForm databaseForm = new DynamicForm();
    databaseForm.setWidth(450);
    databaseForm.setID("database");
    databaseForm.setValuesManager(vm);
    databaseForm.setDisabled(true);

    RadioGroupItem dbType = new RadioGroupItem();
    dbType.setName(DB_TYPE);
    dbType.setWrapTitle(false);
    dbType.setRequired(true);
    dbType.setVertical(false);
    dbType.setValueMap(I18N.message(INTERNAL), I18N.message("external"));
    dbType.setValue(I18N.message(INTERNAL));
    dbType.setRedrawOnChange(true);
    dbType.setTitle(I18N.message("dbtype"));

    // The database engine, if the External db was chosen
    SelectItem dbEngine = new SelectItem();
    dbEngine.setTitle(I18N.message("dbengine"));
    dbEngine.setWrapTitle(false);
    dbEngine.setVisible(false);
    dbEngine.setName(DB_ENGINE);
    dbEngine.setDefaultValue(MYSQL);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    for (String engine : engines.keySet()) {
      valueMap.put(engine, engines.get(engine)[0]);
    }
    dbEngine.setValueMap(valueMap);
    dbEngine.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    RequiredIfValidator ifValidator = new RequiredIfValidator();
    ifValidator.setExpression(
        new RequiredIfFunction() {
          public boolean execute(FormItem formItem, Object value) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    dbEngine.setValidators(ifValidator);
    dbEngine.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            String selectedItem = (String) event.getValue();
            databaseForm.getField(DB_DRIVER).setValue(engines.get(selectedItem)[1]);
            databaseForm.getField(DB_URL).setValue(engines.get(selectedItem)[2]);
          }
        });

    // The driver for the external DB
    TextItem dbDriver = ItemFactory.newTextItem(DB_DRIVER, "driverclass", null);
    dbDriver.setVisible(false);
    dbDriver.setDefaultValue(engines.get(MYSQL)[1]);
    dbDriver.setWrapTitle(false);
    dbDriver.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    dbDriver.setValidators(ifValidator);

    // The connection URL to external DB
    TextItem dbUrl = ItemFactory.newTextItem(DB_URL, "connectionurl", null);
    dbUrl.setWidth(200);
    dbUrl.setVisible(false);
    dbUrl.setDefaultValue(engines.get(MYSQL)[2]);
    dbUrl.setWrapTitle(false);
    dbUrl.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    dbUrl.setValidators(ifValidator);

    // The username to access the external DB
    TextItem dbUsername = ItemFactory.newTextItem(DB_USERNAME, "username", null);
    dbUsername.setVisible(false);
    dbUsername.setWrapTitle(false);
    dbUsername.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });

    // The password to access the external DB
    PasswordItem dbPassword = new PasswordItem();
    dbPassword.setVisible(false);
    dbPassword.setTitle(I18N.message("password"));
    dbPassword.setName(DB_PASSWORD);
    dbPassword.setWrapTitle(false);
    dbPassword.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });

    databaseForm.setFields(dbType, dbEngine, dbDriver, dbUrl, dbUsername, dbPassword);
    databaseTab.setPane(databaseForm);
    return databaseTab;
  }
Exemplo n.º 27
0
 private static void updateTab(Tab tab, Canvas content) {
   if (tab == null) {
     throw new IllegalStateException("A null tab was specified.");
   }
   tab.getTabSet().updateTab(tab, content);
 }
Exemplo n.º 28
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);
  }
Exemplo n.º 29
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"));
      }
    }
  }