示例#1
0
  public MyDialog(String title, String msg) {
    // Set the dialog box's caption.
    setText(title);

    // Enable animation.
    setAnimationEnabled(true);

    // Enable glass background.
    setGlassEnabled(true);

    this.center();

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(15);
    this.setWidget(dialogContents);

    // Add some text to the top of the dialog
    HTML details = new HTML(msg);
    dialogContents.add(details);
    dialogContents.setCellHorizontalAlignment(details, HasHorizontalAlignment.ALIGN_CENTER);

    // DialogBox is a SimplePanel, so you have to set its widget property to
    // whatever you want its contents to be.
    Button ok = new Button("OK");
    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            MyDialog.this.hide();
          }
        });

    dialogContents.add(ok);
    dialogContents.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
  }
  public PopupFusionViewImpl() {
    super(popupConstants.titrePopup(), false, false, true);
    this.addStyleName(SquareResources.INSTANCE.css().popupFusion());

    final VerticalPanel pConteneur = new VerticalPanel();
    pConteneur.setWidth(PopupFusionConstants.LARGEUR_POPUP);
    pConteneur.setSpacing(5);

    pConteneurComposantFusion = new VerticalPanel();
    pConteneurComposantFusion.setWidth(AppControllerConstants.POURCENT_100);

    btnFermer = new DecoratedButton(popupConstants.btnFermer());
    btnReduire = new DecoratedButton(popupConstants.reduire());

    final HorizontalPanel conteneurBoutons = new HorizontalPanel();
    conteneurBoutons.add(btnReduire);
    conteneurBoutons.add(btnFermer);
    conteneurBoutons.setSpacing(5);

    pConteneur.add(pConteneurComposantFusion);
    pConteneur.add(conteneurBoutons);
    pConteneur.setCellHorizontalAlignment(conteneurBoutons, HasAlignment.ALIGN_CENTER);

    this.setWidget(pConteneur, 0);

    // on en fait une popup minimisable
    minimizablePopup = new PopupMinimizable(this, popupConstants.titrePopup(), btnReduire);
  }
示例#3
0
  public AboutDialog() {
    // Use this opportunity to set the dialog's caption.
    setText(LocaleText.get("about") + " " + FormDesignerUtil.getTitle());

    // Create a VerticalPanel to contain the 'about' label and the 'OK' button.
    VerticalPanel outer = new VerticalPanel();

    // Create the 'about' text and set a style name so we can style it with CSS.

    HTML text = new HTML(LocaleText.get("aboutMessage"));
    text.setStyleName("formDesigner-AboutText");
    outer.add(text);

    // Create the 'OK' button, along with a listener that hides the dialog
    // when the button is clicked.
    Button btn =
        new Button(
            LocaleText.get("close"),
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                hide();
              }
            });

    outer.add(btn);
    outer.setCellHorizontalAlignment(btn, HasAlignment.ALIGN_CENTER);

    setWidget(outer);
  }
  /** This is the entry point method. */
  public void onModuleLoad() {

    initHistoryObservations();

    HTML h = new HTML("Watch the http querystring change after #clickMe1...");
    HTML hh = new HTML("Each click will send an history event to Google Analytics.");
    HTML hhh =
        new HTML(
            "<a href=\"http://gwt-examples.googlecode.com\">gwt-examples.googlecode.com</a> - go back to where you came from");

    VerticalPanel pWidget = new VerticalPanel();
    pWidget.add(h);
    pWidget.add(hh);
    pWidget.add(hhh);
    pWidget.add(new HTML("&nbsp;"));
    pWidget.add(h1);
    pWidget.add(h2);
    pWidget.add(h3);
    pWidget.add(h4);

    VerticalPanel vp = new VerticalPanel();
    vp.add(pWidget);
    vp.setWidth("100%");

    vp.setCellHorizontalAlignment(pWidget, HorizontalPanel.ALIGN_CENTER);

    RootPanel.get("content").add(vp);
  }
示例#5
0
文件: Term.java 项目: scbd/vocbench
    public void initLayout() {
      lang = new ListBox();
      lang =
          Convert.makeSelectedLanguageListBox(
              (ArrayList<String[]>) MainApp.getLanguage(), tObj.getLang());
      lang.setWidth("100%");
      lang.setEnabled(false);

      term = new TextBox();
      term.setText(tObj.getLabel());
      term.setWidth("100%");

      main = new CheckBox(constants.conceptPreferredTerm());
      if (tObj.isMainLabel()) {
        main.setValue(tObj.isMainLabel());
        // main.setEnabled(false);
      }

      Grid table = new Grid(2, 2);
      table.setWidget(0, 0, new HTML(constants.conceptTerm()));
      table.setWidget(1, 0, new HTML(constants.conceptLanguage()));
      table.setWidget(0, 1, term);
      table.setWidget(1, 1, lang);
      table.setWidth("100%");
      table.getColumnFormatter().setWidth(1, "80%");

      VerticalPanel vp = new VerticalPanel();
      vp.add(GridStyle.setTableConceptDetailStyleleft(table, "gslRow1", "gslCol1", "gslPanel1"));
      vp.add(main);
      vp.setSpacing(0);
      vp.setWidth("100%");
      vp.setCellHorizontalAlignment(main, HasHorizontalAlignment.ALIGN_RIGHT);

      addWidget(vp);
    }
示例#6
0
  public TagPopup(UIObject target, String spaceUname, String tagname) {
    super(target, true, true, true);
    this.spaceUname = spaceUname;
    this.tagname = tagname;

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);
    panel.add(new HTML("<b>" + tagname + "</b>"));
    panel.add(new Hr());
    panel.add(pagesPanel);
    if (!AbstractEntryPoint.isOffline()) {
      // so far, have to block tag cloud in offline model as the macro render logic is on
      // MacroHandler side, it is not easy to do in
      // offline model.
      Hyperlink tagCloud =
          new Hyperlink(
              Msg.consts.goto_tagcloud(),
              GwtUtils.buildToken(
                  GwtUtils.getCPageToken(SharedConstants.CPAGE_TAG_CLOUD), spaceUname));
      tagCloud.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              TagPopup.this.hide();
            }
          });
      panel.add(tagCloud);
      panel.setCellHorizontalAlignment(tagCloud, HasHorizontalAlignment.ALIGN_RIGHT);
    }
    panel.setSize("100%", "100%");
    this.setWidget(panel);
  }
  public LoginViewImpl() {
    VerticalPanel vp = new VerticalPanel();
    this.initWidget(vp);
    vp.setSize("100%", "100%");
    FlexTable grid = new FlexTable();
    grid.setStyleName(Adicionais.RESOURCES.css().login());

    Label loginLabel = new Label("Login:"******"Senha:");
    this.passwordTextBox = new PasswordTextBox();
    this.accessButton = new Button("Acessar");
    this.accessButton.setWidth("5em");

    grid.setCellSpacing(6);
    grid.setWidget(0, 0, loginLabel);
    grid.setWidget(0, 1, this.loginTextBox);
    grid.setWidget(1, 0, passwordLabel);
    grid.setWidget(1, 1, this.passwordTextBox);
    grid.setWidget(2, 0, accessButton);
    grid.getFlexCellFormatter().setColSpan(2, 0, 2);
    grid.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    vp.add(grid);
    vp.setCellVerticalAlignment(grid, HasVerticalAlignment.ALIGN_MIDDLE);
    vp.setCellHorizontalAlignment(grid, HasHorizontalAlignment.ALIGN_CENTER);
    this.setSize("100%", "100%");
  }
示例#8
0
 public void showLoading() {
   clearLoading();
   LoadingDialog sayLoading = new LoadingDialog();
   tbPanel.add(sayLoading);
   tbPanel.setCellHorizontalAlignment(sayLoading, HasHorizontalAlignment.ALIGN_CENTER);
   tbPanel.setCellVerticalAlignment(sayLoading, HasVerticalAlignment.ALIGN_MIDDLE);
   tbPanel.setCellHeight(sayLoading, "100%");
   tbPanel.setCellWidth(sayLoading, "100%");
 }
示例#9
0
  private void showNewCommentButton() {
    newCommentLayout.clear();

    HorizontalPanel hp = new HorizontalPanel();

    Button createNewComment = new Button(constants.AddADiscussionComment());
    createNewComment.setEnabled(!this.readOnly);
    hp.add(createNewComment);

    if (UserCapabilities.INSTANCE.hasCapability(Capability.SHOW_ADMIN)) {
      Button adminClearAll = new Button(constants.EraseAllComments());
      adminClearAll.setEnabled(!readOnly);
      hp.add(adminClearAll);
      adminClearAll.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent sender) {
              if (Window.confirm(constants.EraseAllCommentsWarning())) {
                assetService.clearAllDiscussionsForAsset(
                    artifact.getUuid(),
                    new GenericCallback<java.lang.Void>() {
                      public void onSuccess(Void v) {
                        updateCommentList(new ArrayList<DiscussionRecord>());
                      }
                    });
              }
            }
          });
    }

    final String feedURL =
        GWT.getModuleBaseURL()
            + "feed/discussion?package="
            + ((Asset) artifact).getMetaData().getModuleName()
            + "&assetName="
            + URL.encode(artifact.getName())
            + "&viewUrl="
            + Util.getSelfURL();
    Image image = new Image(images.feed());
    image.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent arg0) {
            Window.open(feedURL, "_blank", null);
          }
        });
    hp.add(image);

    newCommentLayout.add(hp);

    newCommentLayout.setCellHorizontalAlignment(hp, HasHorizontalAlignment.ALIGN_RIGHT);
    createNewComment.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent sender) {
            showAddNewComment();
          }
        });
  }
  public VerticalPanel buildUserDetailsDockPanel() {

    VerticalPanel assignedRolesPanel = buildAssignedRolesPanel();

    VerticalPanel mainUserDetailsPanel = new VerticalPanel();

    VerticalPanel userPanelFieldsetContent = new VerticalPanel();
    userPanelFieldsetContent.setSpacing(4);
    userPanelFieldsetContent.add(userDetailsPanel);
    userPanelFieldsetContent.add(updateUserBtn);
    userPanelFieldsetContent.setCellWidth(userDetailsPanel, "100%"); // $NON-NLS-1$

    userPanelFieldsetContent.setCellHorizontalAlignment(updateUserBtn, VerticalPanel.ALIGN_RIGHT);

    VerticalPanel fieldsetPanel = new VerticalPanel();
    fieldsetPanel.add(new Label(Messages.getString("userDetails"))); // $NON-NLS-1$
    fieldsetPanel.add(userPanelFieldsetContent);
    userPanelFieldsetContent.setWidth("100%"); // $NON-NLS-1$

    fieldsetPanel.setWidth("100%"); // $NON-NLS-1$

    mainUserDetailsPanel.add(fieldsetPanel);
    mainUserDetailsPanel.setCellWidth(fieldsetPanel, "100%"); // $NON-NLS-1$
    SimplePanel spacerPanel = new SimplePanel();
    spacerPanel.add(new Label(" ")); // $NON-NLS-1$
    mainUserDetailsPanel.add(spacerPanel);
    mainUserDetailsPanel.setCellHeight(spacerPanel, "10px"); // $NON-NLS-1$

    mainUserDetailsPanel.add(assignedRolesPanel);

    mainUserDetailsPanel.setCellHorizontalAlignment(
        updateUserBtn, HasHorizontalAlignment.ALIGN_RIGHT);

    mainUserDetailsPanel.setCellHeight(assignedRolesPanel, "100%"); // $NON-NLS-1$
    mainUserDetailsPanel.setCellWidth(assignedRolesPanel, "100%"); // $NON-NLS-1$

    userDetailsPanel.setWidth("100%"); // $NON-NLS-1$
    assignedRolesPanel.setWidth("100%"); // $NON-NLS-1$
    assignedRolesPanel.setHeight("100%"); // $NON-NLS-1$

    updateUserBtn.addClickListener(this);
    return mainUserDetailsPanel;
  }
  public void showHTMLCode(String codeSource) {
    final DialogBox codePopup = new DialogBox(true, true);
    codePopup.setGlassEnabled(true);
    codePopup.setText(constants.showCodeTitle());

    String[] lignesCode = codeSource.split("\n");

    VerticalPanel tab = new VerticalPanel();

    for (String ligneCode : lignesCode) {
      String maLigne = new String(ligneCode);

      String[] ligne = ligneCode.split("\t");
      for (String texte : ligne) {
        if (texte.equals("")) {
          maLigne = "&nbsp;&nbsp;&nbsp;&nbsp;" + maLigne;
        }
      }
      maLigne = maLigne.replace("<", "&lt;");
      maLigne = maLigne.replace("div", "<span style='color: blue;'>div</span>");
      maLigne = maLigne.replace("id=", "<span style='color: red;'>id</span>=");
      maLigne = maLigne.replace("class", "<span style='color: red;'>class</span>");

      int commentBegin = maLigne.indexOf("&lt;!--");

      if (commentBegin != -1) {
        int commentEnd = maLigne.indexOf("-->");
        String comment = maLigne.substring(commentBegin, commentEnd + 3);
        maLigne = maLigne.replace(comment, "<span style='color: #008000;'>" + comment + "</span>");
      }

      HTML htmlLine = new HTML(maLigne);
      htmlLine.setStyleName("builder-source");
      tab.add(htmlLine);
    }

    Button closeButton =
        new Button(
            constants.close(),
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                codePopup.hide();
              }
            });

    tab.add(closeButton);
    tab.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);

    codePopup.add(tab);
    codePopup.center();
    codePopup.show();
  }
  public ConfigurationDialog(OkCancelDialogCallback callback) {
    setText("Configuration");
    setModal(true);
    this.okCancelDialogCallback = callback;

    setHTML("New dialog");

    VerticalPanel verticalPanel = new VerticalPanel();
    setWidget(verticalPanel);
    verticalPanel.setSize("100%", "100%");

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    verticalPanel.add(horizontalPanel);
    verticalPanel.setCellHeight(horizontalPanel, "100%");
    verticalPanel.setCellWidth(horizontalPanel, "100%");
    horizontalPanel.setSize("324px", "29px");

    Label lblBrokerUrl = new Label("Broker url: ");
    horizontalPanel.add(lblBrokerUrl);

    final TextBox txtBrokerUrl = new TextBox();
    horizontalPanel.add(txtBrokerUrl);

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    verticalPanel.add(horizontalPanel_1);
    verticalPanel.setCellWidth(horizontalPanel_1, "100%");
    verticalPanel.setCellHorizontalAlignment(
        horizontalPanel_1, HasHorizontalAlignment.ALIGN_CENTER);

    Button btnAcept = new Button("Acept");
    btnAcept.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            okCancelDialogCallback.okButtonClick(txtBrokerUrl.getText());
            hide();
          }
        });
    horizontalPanel_1.add(btnAcept);
    horizontalPanel_1.setCellVerticalAlignment(btnAcept, HasVerticalAlignment.ALIGN_MIDDLE);

    Button btnCancel = new Button("Cancel");
    btnCancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            okCancelDialogCallback.cancelButtonClick();
            hide();
          }
        });
    horizontalPanel_1.add(btnCancel);
    horizontalPanel_1.setCellVerticalAlignment(btnCancel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setCellHorizontalAlignment(btnCancel, HasHorizontalAlignment.ALIGN_RIGHT);
  }
  /** Default constructor */
  public DeleteConfiguration() {
    super();

    initService();

    initWidget(mainPanel);

    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setSpacing(10);

    DecoratorPanel dp = new DecoratorPanel();
    mainPanel.add(dp);
    mainPanel.setCellHorizontalAlignment(dp, HasHorizontalAlignment.ALIGN_CENTER);

    mainPanel.setWidth(DOCK_PANEL_WIDTH);

    upperPanel.setWidth(PERCENT_100);
    upperPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    upperPanel.setSpacing(10);

    // Sub-Title
    Label subTitleLabel = new Label(SUB_TITLE);
    subTitleLabel.addStyleDependentName(SUB_TITLE_LABEL_STYLE);
    upperPanel.add(subTitleLabel);
    upperPanel.setCellHorizontalAlignment(subTitleLabel, HasHorizontalAlignment.ALIGN_CENTER);

    wbConfigTextBox.addChangeHandler(this);
    LabeledWidget workbookIdBox = new LabeledWidget(wbConfigTextBox);
    workbookIdBox.setLabelText(CONFIG_ID_COLON);
    workbookIdBox.setPanelWidth(RESULTS_DATA_WIDTH);
    upperPanel.add(workbookIdBox);

    submitButton.addClickHandler(this);
    submitButton.setEnabled(false);
    upperPanel.add(submitButton);

    dp.add(upperPanel);
  }
示例#14
0
 @UiConstructor
 public IstogramWidget() {
   istogramHeight = 0;
   int paddingTop = 0;
   String potStr = "";
   String achStr = "";
   VerticalPanel vp = new VerticalPanel();
   DrawingArea canvas = new DrawingArea(AREAWIDTH, AREAHEIGTH);
   bluRect =
       new Rectangle(CANVASMARGINLEFT, paddingTop + CANVASMARGINTOP, CANVASWIDTH, istogramHeight);
   bluRect.setFillColor(CANVASCOLORBLUE);
   bluRect.setStrokeWidth(0);
   bluRect.setRoundedCorners(1);
   greenRect = new Rectangle(CANVASMARGINLEFT, paddingTop + CANVASMARGINTOP, CANVASWIDTH, 0);
   greenRect.setFillColor(CANVASCOLORGREEN);
   greenRect.setStrokeWidth(0);
   greenRect.setRoundedCorners(1);
   potText = new Text(getTextPosition(potStr), paddingTop + TEXTSIZE, potStr);
   potText.setFillColor(POTTEXTCOLOR);
   potText.setFontSize(TEXTSIZE);
   potText.setStrokeColor(POTTEXTCOLOR);
   potText.setFontFamily(TEXTFONTFAMILY);
   potText.setStrokeWidth(0);
   achText =
       new Text(
           getTextPosition(achStr),
           paddingTop + CANVASMARGINTOP + (istogramHeight + TEXTSIZE / 2) / 2,
           achStr);
   achText.setFillColor(ACHTEXTCOLOR);
   achText.setFontSize(TEXTSIZE);
   achText.setStrokeColor(ACHTEXTCOLOR);
   achText.setStrokeWidth(0);
   achText.setFontFamily(TEXTFONTFAMILY);
   productName = new HTML();
   productName.setHeight("52px");
   vp.add(productName);
   vp.add(canvas);
   vp.setCellHorizontalAlignment(productName, HasHorizontalAlignment.ALIGN_CENTER);
   vp.setCellVerticalAlignment(productName, HasVerticalAlignment.ALIGN_TOP);
   vp.setCellVerticalAlignment(canvas, HasVerticalAlignment.ALIGN_BOTTOM);
   canvas.add(bluRect);
   canvas.add(greenRect);
   canvas.add(potText);
   canvas.add(achText);
   initWidget(vp);
 }
示例#15
0
文件: Icon.java 项目: ajhalbleib/aicg
  /**
   * Creates a new icon with the specified caption.
   *
   * @param image image shown on icon (preferably 16 x 16px)
   * @param caption caption shown below image
   */
  public Icon(Image image, String caption) {

    panel =
        new VerticalPanel() {
          @Override
          public void onBrowserEvent(Event event) {
            Icon.this.onBrowserEvent(event);
          }
        };
    panel.add(image);
    panel.setCellHorizontalAlignment(image, VerticalPanel.ALIGN_CENTER);
    captionLabel = new Label(caption);
    panel.add(captionLabel);

    initWidget(panel);

    setStylePrimaryName("ode-Icon");
  }
示例#16
0
  public TangoPanelTable(String str) {
    HorizontalPanel buttons = new HorizontalPanel();
    panel.add(buttons);
    panel.setCellHorizontalAlignment(buttons, VerticalPanel.ALIGN_CENTER);
    flexTable = new FlexTable();
    flexTable.setSize("100%", "100%");
    panel.add(flexTable);
    flexTable.addStyleName("WordPanelTable-table");
    flexTable.addStyleName("WordPanelTable-panel");

    /* セルがクリックされた時の振る舞い */
    flexTable.addTableListener(
        new TableListener() {
          public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
            System.out.println("row=" + row + ", col=" + cell);
          }
        });
  }
示例#17
0
文件: Term.java 项目: scbd/vocbench
    public TermDetail(ConceptObject conceptObject, TermObject termObject) {
      String text = termObject.getLabel();
      if (text.length() > 100) text = text.substring(0, 70) + "...";
      this.setHTML(
          constants.conceptInformationFor()
              + " <i>"
              + text
              + " ("
              + termObject.getLang()
              + ")</i>&nbsp;["
              + (termObject.isMainLabel()
                  ? constants.conceptPreferredTerm()
                  : constants.conceptNonPreferredTerm())
              + "]");
      TermDetailTabPanel termDetail =
          new TermDetailTabPanel(permissionTable, initData, TermDetail.this);
      termDetail.setURI(termObject, conceptObject);

      VerticalPanel vp = new VerticalPanel();
      vp.setSize("100%", "100%");
      vp.add(termDetail);

      panel.add(vp);
      panel.setCellHeight(vp, "100%");
      panel.setCellWidth(vp, "100%");

      HorizontalPanel buttonPanel = new HorizontalPanel();
      buttonPanel.setSpacing(5);
      buttonPanel.add(cancel);

      HorizontalPanel hp = new HorizontalPanel();
      hp.setSpacing(0);
      hp.setWidth("100%");
      hp.setStyleName("bottombar");
      hp.add(buttonPanel);
      hp.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);

      panel.add(hp);
      cancel.addClickHandler(this);
      panel.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_RIGHT);
      panel.setSize("100%", "100%");
      setWidget(panel);
    }
示例#18
0
  public Category() {

    VerticalPanel verPanel = new VerticalPanel();
    initWidget(verPanel);
    verPanel.setSize("100%", "100%");

    FlexTable flexTable = new FlexTable();
    verPanel.add(flexTable);
    verPanel.setCellVerticalAlignment(flexTable, HasVerticalAlignment.ALIGN_MIDDLE);
    verPanel.setCellHorizontalAlignment(flexTable, HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setSize("20%", "20%");

    Label lblCategoryName = new Label("CategoryName");
    flexTable.setWidget(0, 0, lblCategoryName);

    TextBox txtCatgegoryName = new TextBox();
    flexTable.setWidget(0, 1, txtCatgegoryName);

    Label lblCategoryDescription = new Label("CategoryDescription");
    flexTable.setWidget(1, 0, lblCategoryDescription);

    TextBox txtCategoryDescription = new TextBox();
    flexTable.setWidget(1, 1, txtCategoryDescription);

    CheckBox isParentCategory = new CheckBox();
    isParentCategory.setName("isParentCategory");
    flexTable.setWidget(2, 1, isParentCategory);

    Label lblIsParentCategory = new Label("ParentCategory");
    flexTable.setWidget(2, 0, lblIsParentCategory);

    TextButton buttonCreateCategory = new TextButton("Create");
    flexTable.setWidget(3, 1, buttonCreateCategory);

    flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    flexTable.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    flexTable.getCellFormatter().setHorizontalAlignment(3, 1, HasHorizontalAlignment.ALIGN_CENTER);
  }
  public DialogListaPontoEncontro(
      final InfoCaronaServerAsync controller, final String idSessao, final String idCarona) {
    novosPontos = "";
    listaNovosPontosEncontros = new ArrayList<InfoPontoEncontro>();
    this.idCarona = idCarona;
    this.controller = controller;

    setText("Pontos de Encontro - ID: " + idCarona);
    setAnimationEnabled(true);
    setGlassEnabled(true);
    center();

    VerticalPanel panelListaPontoEncontro = new VerticalPanel();
    tabelaPontoEncontro = new CellTable<InfoPontoEncontro>();
    tabelaPontoEncontro.setWidth("400px");
    dataProvider = new ListDataProvider<InfoPontoEncontro>();

    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
    SimplePager pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
    pager.setDisplay(tabelaPontoEncontro);
    pager.setPageSize(5);

    TextColumn<InfoPontoEncontro> colunaIdPontoEncontro =
        new TextColumn<InfoPontoEncontro>() {
          @Override
          public String getValue(InfoPontoEncontro pontoEncontro) {
            return pontoEncontro.getIdPontoEncontro();
          }
        };

    TextColumn<InfoPontoEncontro> colunaPontosEncontro =
        new TextColumn<InfoPontoEncontro>() {
          @Override
          public String getValue(InfoPontoEncontro pontoEncontro) {
            return pontoEncontro.getPontoEncontro();
          }
        };

    tabelaPontoEncontro.addColumn(colunaPontosEncontro, "Pontos de Encontro");
    listaPontoEncontros = new ArrayList<InfoPontoEncontro>();
    populaTabela();

    HorizontalPanel hPanel01 = new HorizontalPanel();
    final TextBox boxNovoPontoEncontro = new TextBox();
    boxNovoPontoEncontro.setWidth("200px");
    boxNovoPontoEncontro.setStyleName("boxModificada");

    Button buttonAdicionarOutroPontoEncontro = new Button();
    buttonAdicionarOutroPontoEncontro.setStyleName("botaoModificado");
    buttonAdicionarOutroPontoEncontro.setTitle("Adicionar Sugestão");
    buttonAdicionarOutroPontoEncontro.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (boxNovoPontoEncontro.getText().trim().equals("")) {
              DialogMensagemUsuario dialogErro =
                  new DialogMensagemUsuario("Falhou", "Ponto de Encontro Inválido");
              dialogErro.show();
            } else {
              novosPontos += boxNovoPontoEncontro.getText().trim() + ";";
              InfoPontoEncontro novoPontoEncontro =
                  new InfoPontoEncontro("00", boxNovoPontoEncontro.getText().trim());
              boxNovoPontoEncontro.setText("");

              listaNovosPontosEncontros.add(novoPontoEncontro);
              listaPontoEncontros = new ArrayList<InfoPontoEncontro>();

              for (InfoPontoEncontro novoPonto : listaNovosPontosEncontros) {
                listaPontoEncontros.add(novoPonto);
              }

              populaTabela();
            }
          }
        });

    Image imageFiltro = new Image("imagens/adicionar.png");
    imageFiltro.setSize("15px", "15px");
    buttonAdicionarOutroPontoEncontro.getElement().appendChild(imageFiltro.getElement());

    Button buttonSalvarNovosPontos = new Button("Salvar");
    buttonSalvarNovosPontos.setStyleName("botaoModificado");
    buttonSalvarNovosPontos.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            controller.cadastrarNovosPontosEncontro(
                idSessao,
                idCarona,
                novosPontos,
                new AsyncCallback<String>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    DialogMensagemUsuario dialogSucess =
                        new DialogMensagemUsuario("Erro", caught.getMessage());
                    dialogSucess.show();
                  }

                  @Override
                  public void onSuccess(String result) {
                    DialogMensagemUsuario dialogSucess =
                        new DialogMensagemUsuario(
                            "ID: " + result, "Pontos de Encontro Cadastrados com Sucesso!");
                    dialogSucess.show();
                    hide();
                  }
                });
          }
        });

    Button buttonFechar = new Button("Fechar");
    buttonFechar.setStyleName("botaoModificado");

    buttonFechar.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
          }
        });

    colunaPontosEncontro.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    hPanel01.setCellVerticalAlignment(boxNovoPontoEncontro, HasVerticalAlignment.ALIGN_BOTTOM);
    hPanel01.setCellVerticalAlignment(buttonSalvarNovosPontos, HasVerticalAlignment.ALIGN_TOP);
    hPanel01.setCellVerticalAlignment(
        buttonAdicionarOutroPontoEncontro, HasVerticalAlignment.ALIGN_TOP);
    hPanel01.setCellVerticalAlignment(buttonFechar, HasVerticalAlignment.ALIGN_TOP);
    hPanel01.setCellHorizontalAlignment(boxNovoPontoEncontro, HasHorizontalAlignment.ALIGN_CENTER);
    hPanel01.setCellHorizontalAlignment(
        buttonSalvarNovosPontos, HasHorizontalAlignment.ALIGN_CENTER);
    hPanel01.setCellHorizontalAlignment(
        buttonAdicionarOutroPontoEncontro, HasHorizontalAlignment.ALIGN_CENTER);
    hPanel01.setCellHorizontalAlignment(buttonFechar, HasHorizontalAlignment.ALIGN_CENTER);
    hPanel01.setWidth("100%");
    hPanel01.setSpacing(6);

    hPanel01.add(boxNovoPontoEncontro);
    hPanel01.add(buttonAdicionarOutroPontoEncontro);
    hPanel01.add(buttonSalvarNovosPontos);
    hPanel01.add(buttonFechar);

    panelListaPontoEncontro.add(tabelaPontoEncontro);
    panelListaPontoEncontro.add(pager);
    panelListaPontoEncontro.add(hPanel01);

    panelListaPontoEncontro.setCellVerticalAlignment(
        tabelaPontoEncontro, HasVerticalAlignment.ALIGN_MIDDLE);
    panelListaPontoEncontro.setCellVerticalAlignment(pager, HasVerticalAlignment.ALIGN_MIDDLE);

    panelListaPontoEncontro.setCellHorizontalAlignment(
        tabelaPontoEncontro, HasHorizontalAlignment.ALIGN_CENTER);
    panelListaPontoEncontro.setCellHorizontalAlignment(pager, HasHorizontalAlignment.ALIGN_CENTER);
    panelListaPontoEncontro.setSpacing(8);

    setWidget(panelListaPontoEncontro);
  }
  public Widget draw() {

    titleWidget.setText(
        Utils.getStrippedStringWithEllipsis(facility.getName())
            + " ("
            + facility.getType()
            + "): create resource");

    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");

    // form inputs
    final ExtendedTextBox nameTextBox = new ExtendedTextBox();
    final TextBox descriptionTextBox = new TextBox();

    final ListBoxWithObjects<VirtualOrganization> vosDropDown =
        new ListBoxWithObjects<VirtualOrganization>();

    // send button
    final CustomButton createButton =
        TabMenu.getPredefinedButton(ButtonType.CREATE, ButtonTranslation.INSTANCE.createResource());

    // local events fills the listbox of Vos and Slds
    JsonCallbackEvents event =
        new JsonCallbackEvents() {
          @Override
          public void onFinished(JavaScriptObject jso) {
            // fill VOs listbox
            vosDropDown.clear();
            ArrayList<VirtualOrganization> vos = JsonUtils.jsoAsList(jso);
            vos = new TableSorter<VirtualOrganization>().sortByName(vos);
            for (VirtualOrganization vo : vos) {
              vosDropDown.addItem(vo);
            }
            if (!vos.isEmpty()) createButton.setEnabled(true);
          }

          @Override
          public void onLoadingStart() {
            vosDropDown.clear();
            vosDropDown.addItem("Loading...");
            createButton.setEnabled(false);
          }

          @Override
          public void onError(PerunError error) {
            vosDropDown.clear();
            vosDropDown.addItem("Error while loading");
            createButton.setEnabled(false);
          }
        };
    // load available VOs
    final GetVos vos = new GetVos(event);
    vos.setForceAll(true);
    vos.retrieveData();

    // layout
    FlexTable layout = new FlexTable();
    layout.setStyleName("inputFormFlexTable");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    // Add some standard form options
    layout.setHTML(0, 0, "Name:");
    layout.setWidget(0, 1, nameTextBox);
    layout.setHTML(1, 0, "Description:");
    layout.setWidget(1, 1, descriptionTextBox);
    layout.setHTML(2, 0, "VO:");
    layout.setWidget(2, 1, vosDropDown);
    layout.setHTML(3, 0, "Facility:");
    layout.setHTML(3, 1, facility.getName() + " (" + facility.getType() + ")");

    for (int i = 0; i < layout.getRowCount(); i++) {
      cellFormatter.addStyleName(i, 0, "itemName");
    }

    layout.setWidth("350px");

    TabMenu menu = new TabMenu();

    final ExtendedTextBox.TextBoxValidator validator =
        new ExtendedTextBox.TextBoxValidator() {
          @Override
          public boolean validateTextBox() {
            if (nameTextBox.getTextBox().getText().trim().isEmpty()) {
              nameTextBox.setError("Name can't be empty.");
              return false;
            }
            nameTextBox.setOk();
            return true;
          }
        };
    nameTextBox.setValidator(validator);

    createButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {

            // loads new tab when creating successful, also disable button
            JsonCallbackEvents localEvents =
                new JsonCallbackEvents() {
                  public void onLoadingStart() {
                    (JsonCallbackEvents.disableButtonEvents(createButton)).onLoadingStart();
                  }

                  public void onFinished(JavaScriptObject jso) {
                    (JsonCallbackEvents.disableButtonEvents(createButton)).onFinished(jso);
                    Resource res = (Resource) jso;
                    session
                        .getTabManager()
                        .addTabToCurrentTab(
                            new CreateFacilityResourceManageServicesTabItem(facility, res), true);
                  }

                  public void onError(PerunError error) {
                    (JsonCallbackEvents.disableButtonEvents(createButton)).onError(error);
                  }
                };
            if (validator.validateTextBox()) {
              // request
              CreateResource request = new CreateResource(localEvents);
              request.createResource(
                  nameTextBox.getTextBox().getText().trim(),
                  descriptionTextBox.getText().trim(),
                  facility.getId(),
                  vosDropDown.getSelectedObject().getId());
            }
          }
        });

    menu.addWidget(createButton);

    final TabItem tab = this;
    menu.addWidget(
        TabMenu.getPredefinedButton(
            ButtonType.CANCEL,
            "",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                session.getTabManager().closeTab(tab, false);
              }
            }));

    vp.add(layout);
    vp.add(menu);
    vp.setCellHorizontalAlignment(menu, HasHorizontalAlignment.ALIGN_RIGHT);

    this.contentWidget.setWidget(vp);

    return getWidget();
  }
示例#21
0
  public DialogCarma(KarmaHome home, KarmaUser user) {
    super(false, true);
    this.homeParent = home;
    this.user = user;

    setHTML(CONSTANTS.this_html());

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(verticalPanel);
    verticalPanel.setWidth("100%");

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(5);
    verticalPanel.add(horizontalPanel);
    horizontalPanel.setWidth("100%");

    VerticalPanel verticalPanel_2 = new VerticalPanel();
    horizontalPanel.add(verticalPanel_2);
    verticalPanel_2.setSize("260", "110");

    Grid grid_1 = new Grid(3, 2);
    verticalPanel_2.add(grid_1);
    grid_1.setSize("", "100");

    Label label_10 = new Label(CONSTANTS.label_10_text());
    grid_1.setWidget(0, 0, label_10);
    grid_1.getCellFormatter().setWidth(0, 0, "100");

    listTypes = new ListBox();
    grid_1.setWidget(0, 1, listTypes);
    grid_1.getCellFormatter().setWidth(0, 1, "150");
    listTypes.setWidth("100%");
    ClientUtils.fillTypes(listTypes);

    Label label_11 = new Label(CONSTANTS.label_11_text());
    grid_1.setWidget(1, 0, label_11);

    tbPlate = new TextBox();
    tbPlate.setVisibleLength(10);
    grid_1.setWidget(1, 1, tbPlate);
    tbPlate.setWidth("100%");

    cbxForeign = new CheckBox(CONSTANTS.cbxForeign_text());
    grid_1.setWidget(2, 0, cbxForeign);
    cbxForeign.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            showCountries();
          }
        });

    listCountry = new ListBox();
    grid_1.setWidget(2, 1, listCountry);
    listCountry.setWidth("100%");
    listCountry.setVisible(false);
    ClientUtils.fillCountries(listCountry);

    VerticalPanel verticalPanel_6 = new VerticalPanel();
    horizontalPanel.add(verticalPanel_6);
    verticalPanel_6.setSize("260", "110");

    Grid grid_2 = new Grid(3, 2);
    verticalPanel_6.add(grid_2);
    grid_2.setSize("", "100");

    Label label_15 = new Label(CONSTANTS.label_15_text());
    grid_2.setWidget(0, 0, label_15);
    grid_2.getCellFormatter().setWidth(0, 0, "50");

    date = new DateBox();
    date.setFormat(new DefaultFormat(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm")));
    grid_2.setWidget(0, 1, date);
    grid_2.getCellFormatter().setWidth(0, 1, "200");
    date.setWidth("100%");
    date.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          @Override
          public void onValueChange(ValueChangeEvent<Date> event) {
            Date d = event.getValue();
            if (d.after(new Date())
                || d.before(new Date(System.currentTimeMillis() - 31536000000L))) {
              date.setValue(new Date());
              MsgMan.getInstance().showError(CONSTANTS.error_date1(), date);
            }
          }
        });

    Label label_16 = new Label(CONSTANTS.label_16_text());
    grid_2.setWidget(1, 0, label_16);

    taNotes = new TextArea();
    taNotes.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            updateCounter();
          }
        });
    taNotes.setSize("100%", "50");
    grid_2.setWidget(1, 1, taNotes);

    lblCounter = new Label("New label");
    lblCounter.addStyleName("counter");
    grid_2.setWidget(2, 1, lblCounter);
    grid_2.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_RIGHT);

    HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    horizontalPanel_3.setSpacing(5);
    horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    verticalPanel.add(horizontalPanel_3);
    verticalPanel.setCellHorizontalAlignment(
        horizontalPanel_3, HasHorizontalAlignment.ALIGN_CENTER);

    btnPuntuar = new Button("New button");
    horizontalPanel_3.add(btnPuntuar);
    btnPuntuar.setText(CONSTANTS.btnPuntuar_text());
    btnPuntuar.setWidth("100");

    Button btnCancel = new Button("New button");
    horizontalPanel_3.add(btnCancel);
    btnCancel.setText(CONSTANTS.btnCancel_text());
    btnCancel.setWidth("100");
    btnPuntuar.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            makeKarma();
          }
        });
    btnCancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            DialogCarma.this.hide();
          }
        });

    updateCounter();
  }
示例#22
0
  public FindFolderSelectPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    status = new Status();
    status.setStyleName("okm-StatusPopup");

    vPanel = new VerticalPanel();
    vPanel.setWidth("700");
    vPanel.setHeight("350");
    hPanel = new HorizontalPanel();

    scrollFolderPanel = new ScrollPanel();
    scrollFolderPanel.setStyleName("okm-Popup-text");

    cancelButton =
        new Button(
            Main.i18n("button.close"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                hide();
              }
            });

    actionButton =
        new Button(
            Main.i18n("search.result.menu.go.folder"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                CommonUI.openPath(folderTable.getText(selectedRow, 1), "");
                hide();
              }
            });

    keyword = new TextBox();
    keyword.setWidth("692");
    keyword.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            if (keyword.getText().length() >= 3) {
              GWTQueryParams gwtParams = new GWTQueryParams();
              int actualView = Main.get().mainPanel.desktop.navigator.stackPanel.getStackIndex();

              switch (actualView) {
                case UIDesktopConstants.NAVIGATOR_TAXONOMY:
                  gwtParams.setPath(Main.get().taxonomyRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_TEMPLATES:
                  gwtParams.setPath(Main.get().templatesRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_PERSONAL:
                  gwtParams.setPath(Main.get().personalRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_MAIL:
                  gwtParams.setPath(Main.get().mailRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_TRASH:
                  gwtParams.setPath(Main.get().trashRootFolder.getPath());
                  break;
              }

              gwtParams.setMimeType("");
              gwtParams.setKeywords("");
              gwtParams.setMimeType("");
              gwtParams.setName(keyword.getText() + "*"); // add wildcard at ends
              gwtParams.setAuthor("");
              gwtParams.setMailFrom("");
              gwtParams.setMailTo("");
              gwtParams.setMailSubject("");
              gwtParams.setOperator(GWTQueryParams.OPERATOR_AND);
              gwtParams.setLastModifiedFrom(null);
              gwtParams.setLastModifiedTo(null);
              gwtParams.setDomain(GWTQueryParams.FOLDER);
              gwtParams.setProperties(new HashMap<String, GWTPropertyParams>());
              find(gwtParams);
            } else {
              removeAllRows();
            }
          }
        });

    folderTable = new FlexTable();
    folderTable.setWidth("100%");
    folderTable.setCellPadding(2);
    folderTable.setCellSpacing(0);

    folderTable.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            markSelectedRow(folderTable.getCellForEvent(event).getRowIndex());
            evaluateEnableAction();
          }
        });

    folderTable.addDoubleClickHandler(
        new DoubleClickHandler() {
          @Override
          public void onDoubleClick(DoubleClickEvent event) {
            CommonUI.openPath(folderTable.getText(selectedRow, 1), "");
            hide();
          }
        });

    scrollFolderPanel.add(folderTable);
    scrollFolderPanel.setPixelSize(690, 300);

    vPanel.add(keyword);
    vPanel.add(scrollFolderPanel);
    vPanel.add(new HTML("<br>"));
    hPanel.add(cancelButton);
    HTML space = new HTML();
    space.setWidth("50");
    hPanel.add(space);
    hPanel.add(actionButton);
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(keyword, HasAlignment.ALIGN_CENTER);
    vPanel.setCellVerticalAlignment(keyword, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellHorizontalAlignment(scrollFolderPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(keyword, "25");
    vPanel.setCellHeight(scrollFolderPanel, "300");

    cancelButton.setStyleName("okm-NoButton");
    actionButton.setStyleName("okm-YesButton");
    folderTable.setStyleName("okm-NoWrap");
    folderTable.addStyleName("okm-Table-Row");
    keyword.setStyleName("okm-Input");

    super.hide();
    setWidget(vPanel);
  }
示例#23
0
  public CriterionHeader(int idx, int cid, String cdesc, float b, int regrid, int regraccepted) {
    this.mainPanel = new VerticalPanel();
    this.mainPanel.addStyleName(Resources.INSTANCE.css().criterionrow());
    this.criterionId = cid;
    this.criterionDescription = cdesc;
    this.index = idx;

    Label lbl = new Label(cdesc);
    lbl.addStyleName(Resources.INSTANCE.css().criterionheader());
    lbl.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (commentId > 0 && commentPage > 0)
              EMarkingWeb.markingInterface
                  .getMarkingPagesInterface()
                  .highlightRubricMark(commentId, commentPage);
          }
        });
    mainPanel.add(lbl);

    HorizontalPanel horizontal = new HorizontalPanel();
    horizontal.addStyleName(Resources.INSTANCE.css().colorsquaretable());

    // the square with the color
    if (EMarkingConfiguration.isColoredRubric()) {
      Label lbl2 = new Label("");
      Color.setWidgetBackgroundHueColor(cid, lbl2);
      lbl2.addStyleName(Resources.INSTANCE.css().colorsquare());
      lbl2.setTitle(String.valueOf(idx));
      // lbl2.addStyleName(MarkingInterface.getMapCss().get("colorsquare"));

      // HTML rectangle = new HTML();
      // rectangle.setHTML("<div data-index='"+idx+"' style='width:20px;	height:20px;border:1px
      // solid #000;' class='"+ MarkingInterface.getMapCss().get("color"+idx) +"
      // "+MarkingInterface.getMapCss().get("colorsquare") + "' ></div>");
      lbl2.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              Label rectangle = (Label) event.getSource();
              int index = Integer.parseInt(rectangle.getTitle());
              EMarkingWeb.markingInterface
                  .getToolbar()
                  .getMarkingButtons()
                  .changeCriterionList(index);
            }
          });
      horizontal.add(lbl2);
    }

    HTML separation = new HTML();
    separation.setHTML("<div style='width:20px;height:20px;'></div>");
    horizontal.add(separation);

    mainPanel.add(horizontal);

    bonusHtml = new HTML();
    setBonus(b);

    mainPanel.add(bonusHtml);

    regradeHtml = new HTML();
    regradeHtml.setVisible(false);

    mainPanel.add(regradeHtml);

    this.setRegradeData(regrid, regraccepted);

    loadingIcon = new HTML();
    loadingIcon.setVisible(false);
    Icon iconloading = new Icon(IconType.COG);
    loadingIcon.setHTML(iconloading.toString());
    loadingIcon.addStyleName(Resources.INSTANCE.css().loadingicon());
    loadingIcon.addStyleName("icon-spin");

    mainPanel.add(loadingIcon);
    mainPanel.setCellHorizontalAlignment(loadingIcon, HasHorizontalAlignment.ALIGN_CENTER);

    initWidget(mainPanel);
  }
示例#24
0
  /** SearchPopup */
  public SearchPopup() {
    super(false, true);

    setText(GeneralComunicator.i18nExtension("dropbox.search"));
    vPanel = new VerticalPanel();
    vPanel.setWidth("100%");

    table = new ColoredFlexTable();
    table.setWidth("100%");
    table.setCellPadding(2);
    table.setCellSpacing(0);
    table.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (selectedRow >= 0) {
              table.setStyleRow(selectedRow, false);
            }
            selectedRow = table.getCellForEvent(event).getRowIndex();
            table.setStyleRow(selectedRow, true);
            importButton.setEnabled(true);
          }
        });
    table.addDoubleClickHandler(
        new DoubleClickHandler() {
          @Override
          public void onDoubleClick(DoubleClickEvent event) {
            if (selectedRow >= 0) {
              if (selectedRow >= 0) {
                table.setStyleRow(selectedRow, false);
              }
              executeImport();
              table.setStyleRow(selectedRow, true);
              hide();
            }
          }
        });

    scrollPanel = new ScrollPanel(table);
    scrollPanel.setPixelSize(690, 250);
    scrollPanel.setStyleName("okm-Popup-text");

    hSearchPanel = new HorizontalPanel();
    name = new TextBox();
    name.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            executeSearch();
          }
        });
    name.setWidth("540px");
    name.setStyleName("okm-Input");

    typeList = new ListBox();
    typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.all"), "");
    typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.document"), CATEGORY_DOCUMENT);
    typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.folder"), CATEGORY_FOLDER);
    typeList.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            executeSearch();
          }
        });
    typeList.setStyleName("okm-Input");

    hSearchPanel.add(UtilComunicator.hSpace("5"));
    hSearchPanel.add(name);
    hSearchPanel.add(UtilComunicator.hSpace("5"));
    hSearchPanel.add(typeList);

    // Buttons panel
    cancelButton =
        new Button(
            GeneralComunicator.i18n("button.cancel"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                hide();
              }
            });
    cancelButton.setStyleName("okm-NoButton");
    importButton =
        new Button(
            GeneralComunicator.i18nExtension("button.import"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                executeImport();
                hide();
              }
            });
    importButton.setStyleName("okm-YesButton");

    hButtonPanel = new HorizontalPanel();
    hButtonPanel.add(cancelButton);
    hButtonPanel.add(new HTML("&nbsp;"));
    hButtonPanel.add(importButton);

    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(hSearchPanel);
    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(scrollPanel);
    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(hButtonPanel);
    vPanel.add(UtilComunicator.vSpace("5"));

    vPanel.setCellHorizontalAlignment(hSearchPanel, HasAlignment.ALIGN_LEFT);
    vPanel.setCellHorizontalAlignment(scrollPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hButtonPanel, HasAlignment.ALIGN_CENTER);

    setWidget(vPanel);
  }
示例#25
0
文件: GSS.java 项目: davideuler/gss
  @Override
  public void onModuleLoad() {
    // Initialize the singleton before calling the constructors of the
    // various widgets that might call GSS.get().
    singleton = this;
    parseUserCredentials();

    topPanel = new TopPanel(GSS.images);
    topPanel.setWidth("100%");

    messagePanel.setWidth("100%");
    messagePanel.setVisible(false);

    search = new Search(images);
    searchStatus.add(search, DockPanel.WEST);
    searchStatus.add(userDetailsPanel, DockPanel.EAST);
    searchStatus.setCellHorizontalAlignment(userDetailsPanel, HasHorizontalAlignment.ALIGN_RIGHT);
    searchStatus.setCellVerticalAlignment(search, HasVerticalAlignment.ALIGN_MIDDLE);
    searchStatus.setCellVerticalAlignment(userDetailsPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    searchStatus.setWidth("100%");

    fileList = new FileList(images);

    searchResults = new SearchResults(images);

    // Inner contains the various lists.
    inner.sinkEvents(Event.ONCONTEXTMENU);
    inner.setAnimationEnabled(true);
    inner.getTabBar().addStyleName("gss-MainTabBar");
    inner.getDeckPanel().addStyleName("gss-MainTabPanelBottom");
    inner.add(
        fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true);

    inner.add(
        groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true);
    inner.add(
        searchResults,
        createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"),
        true);
    // inner.add(new CellTreeView(images),
    // createHeaderHTML(AbstractImagePrototype.create(images.search()), "Cell tree sample"), true);
    inner.setWidth("100%");
    inner.selectTab(0);

    inner.addSelectionHandler(
        new SelectionHandler<Integer>() {

          @Override
          public void onSelection(SelectionEvent<Integer> event) {
            int tabIndex = event.getSelectedItem();
            //				TreeItem treeItem = GSS.get().getFolders().getCurrent();
            switch (tabIndex) {
              case 0:
                //						Files tab selected
                // fileList.clearSelectedRows();
                fileList.updateCurrentlyShowingStats();
                break;
              case 1:
                //						Groups tab selected
                groups.updateCurrentlyShowingStats();
                updateHistory("Groups");
                break;
              case 2:
                //						Search tab selected
                searchResults.clearSelectedRows();
                searchResults.updateCurrentlyShowingStats();
                updateHistory("Search");
                break;
            }
          }
        });
    //		If the application starts with no history token, redirect to a new "Files" state
    String initToken = History.getToken();
    if (initToken.length() == 0) History.newItem("Files");
    //		   Add history listener to handle any history events
    History.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            String tokenInput = event.getValue();
            String historyToken = handleSpecialFolderNames(tokenInput);
            try {
              if (historyToken.equals("Search")) inner.selectTab(2);
              else if (historyToken.equals("Groups")) inner.selectTab(1);
              else if (historyToken.equals("Files") || historyToken.length() == 0)
                inner.selectTab(0);
              else {
                /*TODO: CELLTREE
                PopupTree popupTree = GSS.get().getFolders().getPopupTree();
                TreeItem treeObj = GSS.get().getFolders().getPopupTree().getTreeItem(historyToken);
                SelectionEvent.fire(popupTree, treeObj);
                */
              }
            } catch (IndexOutOfBoundsException e) {
              inner.selectTab(0);
            }
          }
        });

    // Add the left and right panels to the split panel.
    splitPanel.setLeftWidget(treeView);
    splitPanel.setRightWidget(inner);
    splitPanel.setSplitPosition("25%");
    splitPanel.setSize("100%", "100%");
    splitPanel.addStyleName("gss-splitPanel");

    // Create a dock panel that will contain the menu bar at the top,
    // the shortcuts to the left, the status bar at the bottom and the
    // right panel taking the rest.
    VerticalPanel outer = new VerticalPanel();
    outer.add(topPanel);
    outer.add(searchStatus);
    outer.add(messagePanel);
    outer.add(splitPanel);
    outer.add(statusPanel);
    outer.setWidth("100%");
    outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER);

    outer.setSpacing(4);

    // Hook the window resize event, so that we can adjust the UI.
    Window.addResizeHandler(this);
    // Clear out the window's built-in margin, because we want to take
    // advantage of the entire client area.
    Window.setMargin("0px");
    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    RootPanel.get().add(outer);
    // Call the window resized handler to get the initial sizes setup. Doing
    // this in a deferred command causes it to occur after all widgets'
    // sizes have been computed by the browser.
    DeferredCommand.addCommand(
        new Command() {

          @Override
          public void execute() {
            onWindowResized(Window.getClientHeight());
          }
        });
  }
示例#26
0
  private void initLayout() {

    table = new FlexTable();
    table.setWidth("100%");

    HTML conceptLab = new HTML(constants.exportConcept());
    HTML exportLab = new HTML(constants.exportFormat());
    HTML schemeLab = new HTML(constants.exportScheme());
    HTML dateLab = new HTML(constants.exportDate());
    HTML termCodeLab = new HTML(constants.exportTermCode());

    conceptLab.setWordWrap(false);
    exportLab.setWordWrap(false);
    schemeLab.setWordWrap(false);
    dateLab.setWordWrap(false);
    termCodeLab.setWordWrap(false);

    table.setWidget(0, 0, schemeLab);
    table.setWidget(0, 1, getScheme());
    table.setWidget(1, 0, conceptLab);
    table.setWidget(1, 1, getConcept());
    table.setWidget(2, 0, exportLab);
    table.setWidget(2, 1, getExportFormat());
    // table.setWidget(3, 0, termCodeLab);
    // table.setWidget(3, 1, getTermCode());
    // table.setWidget(4, 0, dateLab);
    // table.setWidget(4, 1, getDatePanel());

    table.getColumnFormatter().setWidth(0, "15%");
    table.getColumnFormatter().setWidth(1, "75%");

    final VerticalPanel exportOption = new VerticalPanel();
    exportOption.setSize("100%", "100%");
    exportOption.add(GridStyle.setTableRowStyle(table, "#F4F4F4", "#E8E8E8", 3));

    final Button export = new Button(constants.exportButton());
    final CheckBox chkZip = new CheckBox(constants.exportUseZip());

    HorizontalPanel bottombar = new HorizontalPanel();
    bottombar.setSpacing(5);
    bottombar.add(chkZip);
    bottombar.add(export);
    bottombar.setSize("100%", "100%");
    bottombar.setStyleName("bottombar");
    bottombar.setCellHorizontalAlignment(chkZip, HasHorizontalAlignment.ALIGN_LEFT);
    bottombar.setCellHorizontalAlignment(export, HasHorizontalAlignment.ALIGN_RIGHT);
    bottombar.setCellVerticalAlignment(export, HasVerticalAlignment.ALIGN_MIDDLE);

    // ButtonbarWidget bottomBarPanel = new ButtonbarWidget(null, bottombar);

    /*ld.setSize("100%", "100%");
    spacer.setSize("100%", "100%");
    spacer.setCellHorizontalAlignment(ld, HasHorizontalAlignment.ALIGN_CENTER);
    spacer.setCellVerticalAlignment(ld, HasVerticalAlignment.ALIGN_MIDDLE);

     Window.addResizeHandler(new ResizeHandler()
        {
        	public void onResize(ResizeEvent event) {
        		spacer.setSize("100%", "100%");
    		}
    	});*/

    VerticalPanel optionPanel = new VerticalPanel();
    optionPanel.setSize("100%", "100%");
    optionPanel.setStyleName("borderbar");
    optionPanel.add(exportOption);
    // optionPanel.add(spacer);
    optionPanel.add(bottombar);
    // optionPanel.setCellHeight(spacer, "100%");
    optionPanel.setCellVerticalAlignment(exportOption, HasVerticalAlignment.ALIGN_TOP);
    optionPanel.setCellVerticalAlignment(bottombar, HasVerticalAlignment.ALIGN_BOTTOM);

    HorizontalPanel langPanel = new HorizontalPanel();
    /*Image img = new Image("images/map-grey.gif");
    final Label lang = new Label(constants.exportSelectLang());
    lang.setSize("150", "100%");
    lang.setStyleName("displayexportLang");
    lang.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    lang.addClickHandler(new ClickHandler() {
    	public void onClick(ClickEvent event) {
    		if(selectLanguage == null || !selectLanguage.isLoaded)
    			selectLanguage = new SelectLanguage();
    		selectLanguage.show();
    	}
    });

    langPanel.setSize("10%", "100%");
    langPanel.add(img);
    langPanel.add(new HTML("&nbsp;"));
    langPanel.add(lang);
    langPanel.add(new HTML("&nbsp;"));
    langPanel.add(new HTML("&nbsp;"));
    langPanel.setCellWidth(lang, "100%");
    langPanel.setCellHeight(lang, "100%");
    langPanel.setCellVerticalAlignment(img, HasVerticalAlignment.ALIGN_MIDDLE);
    langPanel.setCellVerticalAlignment(lang, HasVerticalAlignment.ALIGN_MIDDLE);
    langPanel.setCellHorizontalAlignment(lang, HasHorizontalAlignment.ALIGN_RIGHT);
    langPanel.setSpacing(1);*/

    VerticalPanel tempmainPanel = new VerticalPanel();
    tempmainPanel.setSpacing(10);
    tempmainPanel.add(optionPanel);

    BodyPanel mainPanel = new BodyPanel(constants.exportTitle(), tempmainPanel, langPanel);

    mainBodypanel.setSize("100%", "100%");
    mainBodypanel.add(mainPanel);
    mainBodypanel.setCellHorizontalAlignment(mainPanel, HasHorizontalAlignment.ALIGN_CENTER);
    mainBodypanel.setCellVerticalAlignment(mainPanel, HasVerticalAlignment.ALIGN_TOP);
    mainBodypanel.setCellWidth(mainPanel, "100%");
    mainBodypanel.setCellHeight(mainPanel, "100%");

    panel.clear();
    panel.setSize("100%", "100%");
    panel.add(mainBodypanel);
    panel.add(loadingDialog);
    panel.setCellHorizontalAlignment(mainPanel, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellVerticalAlignment(mainPanel, HasVerticalAlignment.ALIGN_TOP);
    showLoading(false);

    // =================

    export.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!format.getValue((format.getSelectedIndex())).equals("")
                && !format.getValue(format.getSelectedIndex()).equals("--None--")) {
              exp.setFormat(format.getValue(format.getSelectedIndex()));
            } else {
              exp.setFormat(null);
            }
            String expformat = exp.getFormat();
            if (expformat == null || expformat.equals("")) {
              Window.alert(constants.exportSelectFormat());
            } else if (exp.getStartDate() != null || exp.getEndDate() != null) {
              if (exp.getStartDate() == null || exp.getEndDate() == null) {
                Window.alert(constants.exportSelectDateRange());
              }
            } else {
              showLoading(true);
              exp.setExpLanguage(userSelectedLanguage);
              exp.setTermCode(termCodeBox.getValue().equals("") ? null : termCodeBox.getValue());

              AsyncCallback<String> callback =
                  new AsyncCallback<String>() {
                    public void onSuccess(String key) {
                      String formattype = format.getValue(format.getSelectedIndex());

                      String filename =
                          "export_"
                              + formattype.toLowerCase()
                              + "_"
                              + DateTimeFormat.getFormat("ddMMyyyyhhmmss").format(new Date());

                      if (formattype.equals(ExportFormat.SKOS)
                          || formattype.equals(ExportFormat.SKOSXL)) filename += ".rdf";
                      else if (formattype.equals(ExportFormat.TBX)) filename += ".tbx";
                      else if (formattype.equals(ExportFormat.OWL_SIMPLE_FORMAT))
                        filename += ".owl";
                      else if (formattype.equals(ExportFormat.OWL_COMPLETE_FORMAT))
                        filename += ".owl";
                      else if (formattype.equals(ExportFormat.RDBMS_SQL_FORMAT)) filename += ".sql";

                      Window.open(
                          GWT.getHostPageBaseURL()
                              + "downloadExportData?filename="
                              + filename
                              + "&key="
                              + key
                              + "&size="
                              + ConfigConstants.ZIPSIZE
                              + "&forcezip="
                              + chkZip.getValue(),
                          "_download",
                          "");
                      showLoading(false);
                    }

                    public void onFailure(Throwable caught) {
                      showLoading(false);
                      ExceptionManager.showException(caught, constants.exportDataFail());
                    }
                  };
              Service.exportService.export(exp, MainApp.userId, 74, MainApp.userOntology, callback);
            }
          }
        });
  }
示例#27
0
  /** Main class */
  public void onModuleLoad() {

    // basic settings
    session.setUiElements(new UiElements(null));

    // Get web page's BODY
    RootLayoutPanel body = RootLayoutPanel.get();

    // check RPC url
    if (session.getRpcUrl().isEmpty()) {
      VerticalPanel bodyContents = new VerticalPanel();
      bodyContents.setSize("100%", "300px");
      bodyContents.add(
          new HTML(new Image(LargeIcons.INSTANCE.errorIcon()) + "<h2>RPC SERVER NOT FOUND!</h2>"));
      bodyContents.setCellHorizontalAlignment(
          bodyContents.getWidget(0), HasHorizontalAlignment.ALIGN_CENTER);
      bodyContents.setCellVerticalAlignment(
          bodyContents.getWidget(0), HasVerticalAlignment.ALIGN_BOTTOM);
      body.add(bodyContents);
      return;
    }

    // WEB PAGE SPLITTER
    body.add(bodySplitter);

    // left menu
    leftMenu = new ApplicationFormLeftMenu();

    // show loading box
    loadingBox = session.getUiElements().perunLoadingBox();
    loadingBox.show();

    // switch menu event
    JsonCallbackEvents events =
        new JsonCallbackEvents() {
          @Override
          public void onFinished(JavaScriptObject jso) {

            bodySplitter.clear();
            bodySplitter.addSouth(getFooter(), 23);
            ArrayList<Application> apps = JsonUtils.jsoAsList(jso);
            if (apps != null && !apps.isEmpty()) {
              // show menu
              bodySplitter.addWest(leftMenu, 280);
            }
            // else don't show menu
            // MAIN CONTENT
            contentPanel.setSize("100%", "100%");
            contentPanel.add(leftMenu.getContent());
            bodySplitter.add(contentPanel);

            // Append more GUI elements from UiElements class which are not part of splitted design
            // WE DON'T WANT TO CONFUSE USER WITH STATUS MESSAGES
            // bodySplitter.getElement().appendChild(session.getUiElements().getStatus().getElement()); // status

            // starts loading
            isUserMemberOfVo();

            // hides the loading box
            loadingBox.hide();
          }

          @Override
          public void onError(PerunError error) {
            // MAIN CONTENT

            bodySplitter.clear();
            bodySplitter.addSouth(getFooter(), 23);
            contentPanel.clear();
            contentPanel.setSize("100%", "100%");
            contentPanel.add(leftMenu.getContent());
            bodySplitter.add(contentPanel);

            // Append more GUI elements from UiElements class which are not part of splitted design
            // bodySplitter.getElement().appendChild(session.getUiElements().getStatus().getElement()); // status

            // starts loading
            isUserMemberOfVo();

            // hides the loading box
            loadingBox.hide();
          }
        };

    // load VO to check if exists
    loadVo(events);
  }
示例#28
0
	public PostCheckWidget(HashSet<String> p, CustomRequestCallback cb) {
		callback = cb;
		procs = p;
		vPanel = new VerticalPanel();
		vPanel.setSpacing(10);
		initWidget(vPanel);
		postCheckInfoFlexTable = new FlexTable();
		// postCheckInfoFlexTable.setWidth("100%");
		// Label payerLb = new Label("Payer");
		// payerWidget = new CustomModuleWidget(
		// "api.ClaimLog.RebillDistinctPayers");
		Label checkNumberLb = new Label(_("Check Number"));
		tbCheckNo = new TextBox();
		Label totalAmountLb = new Label(_("Total Amount"));
		tbTotalAmount = new TextBox();

		// postCheckInfoFlexTable.setWidget(0, 0, payerLb);
		// postCheckInfoFlexTable.setWidget(0, 1, payerWidget);
		postCheckInfoFlexTable.setWidget(1, 0, checkNumberLb);
		postCheckInfoFlexTable.setWidget(1, 1, tbCheckNo);
		postCheckInfoFlexTable.setWidget(2, 0, totalAmountLb);
		postCheckInfoFlexTable.setWidget(2, 1, tbTotalAmount);

		proceduresInfoTable = new CustomTable();
		proceduresInfoTable.setAllowSelection(false);
		proceduresInfoTable.setSize("100%", "100%");
		proceduresInfoTable.setIndexName("id");
		proceduresInfoTable.addColumn(_("Patient"), "pt_name");
		proceduresInfoTable.addColumn(_("Claim"), "clm");
		proceduresInfoTable.addColumn(_("CPT"), "cpt");
		proceduresInfoTable.addColumn(_("Service Date"), "ser_date");
		proceduresInfoTable.addColumn(_("Paid"), "paid");
		proceduresInfoTable.addColumn(_("Amount Billed"), "amnt_bill");
		proceduresInfoTable.addColumn(_("Amount Allowed"), "balance");
		proceduresInfoTable.addColumn(_("Adustment Balance"), "adj_bal");
		proceduresInfoTable.addColumn(_("Payment"), "pay");
		proceduresInfoTable.addColumn(_("Copay"), "copay");
		proceduresInfoTable.addColumn(_("Left Over"), "left");
		proceduresInfoTable
				.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {

					@SuppressWarnings("unchecked")
					@Override
					public Widget setColumn(String columnName,
							final HashMap<String, String> data) {

						final int actionRow = proceduresInfoTable
								.getActionRow();
						if (columnName.compareTo("balance") == 0) {
							int row = proceduresInfoTable.getActionRow();
							proceduresInfoTable.getFlexTable()
									.getFlexCellFormatter().setWidth(row, 6,
											"10%");
							pids.add(data.get("id"));
							final TextBox tbAllowedAmount = new TextBox();
							tbAllowedAmount.setWidth("100%");
							tbAllowedAmount.setText(data.get("balance"));
							tbAllowedAmount
									.addChangeHandler(new ChangeHandler() {

										@Override
										public void onChange(ChangeEvent arg0) {
											float all_amnt = 0;
											float pay = 0;
											float copay = 0;
											if (!(tbAllowedAmount.getText()
													.equals("0") || tbAllowedAmount
													.getText().equals(""))) {
												all_amnt = Float
														.parseFloat(tbAllowedAmount
																.getText()
																.trim());
											}
											TextBox tb1 = (TextBox) proceduresInfoTable
													.getWidget(8);
											TextBox tb2 = (TextBox) proceduresInfoTable
													.getWidget(9);
											if (!(tb1.getText().equals("0") || tb1
													.getText().equals(""))) {
												pay = Float.parseFloat(tb1
														.getText().trim());
											}
											if (!(tb2.getText().equals("0") || tb2
													.getText().equals(""))) {
												copay = Float.parseFloat(tb2
														.getText().trim());
											}
											Label left = (Label) proceduresInfoTable
													.getWidget(10);
											left.setText(""
													+ (all_amnt - pay - copay));
										}

									});
							return tbAllowedAmount;
						} else if (columnName.compareTo("pay") == 0) {
							int row = proceduresInfoTable.getActionRow();
							proceduresInfoTable.getFlexTable()
									.getFlexCellFormatter().setWidth(row, 8,
											"10%");
							final TextBox tbPayment = new TextBox();
							tbPayment.setWidth("100%");
							tbPayment.setText("0");
							tbPayment.addChangeHandler(new ChangeHandler() {

								@Override
								public void onChange(ChangeEvent arg0) {
									float all_amnt = 0;
									float pay = 0;
									float copay = 0;
									if (!(tbPayment.getText().equals("0") || tbPayment
											.getText().equals(""))) {
										pay = Float.parseFloat(tbPayment
												.getText().trim());
									}
									TextBox tb1 = (TextBox) proceduresInfoTable
											.getWidget(6);
									TextBox tb2 = (TextBox) proceduresInfoTable
											.getWidget(9);
									if (!(tb1.getText().equals("0") || tb1
											.getText().equals(""))) {
										all_amnt = Float.parseFloat(tb1
												.getText().trim());
									}
									if (!(tb2.getText().equals("0") || tb2
											.getText().equals(""))) {
										copay = Float.parseFloat(tb2.getText()
												.trim());
									}
									Label left = (Label) proceduresInfoTable
											.getWidget(10);
									left.setText("" + (all_amnt - pay - copay));
								}

							});
							return tbPayment;
						} else if (columnName.compareTo("copay") == 0) {
							int row = proceduresInfoTable.getActionRow();
							proceduresInfoTable.getFlexTable()
									.getFlexCellFormatter().setWidth(row, 9,
											"10%");
							final TextBox tbCopay = new TextBox();
							tbCopay.setWidth("100%");
							tbCopay.setText("0");
							@SuppressWarnings("rawtypes")
							ArrayList params = new ArrayList();
							tbCopay.addChangeHandler(new ChangeHandler() {

								@Override
								public void onChange(ChangeEvent arg0) {
									float all_amnt = 0;
									float pay = 0;
									float copay = 0;
									if (!(tbCopay.getText().equals("0") || tbCopay
											.getText().equals(""))) {
										copay = Float.parseFloat(tbCopay
												.getText().trim());
									}
									TextBox tb1 = (TextBox) proceduresInfoTable
											.getWidget(6);
									TextBox tb2 = (TextBox) proceduresInfoTable
											.getWidget(8);
									if (!(tb1.getText().equals("0") || tb1
											.getText().equals(""))) {
										all_amnt = Float.parseFloat(tb1
												.getText().trim());
									}
									if (!(tb2.getText().equals("0") || tb2
											.getText().equals(""))) {
										pay = Float.parseFloat(tb2.getText()
												.trim());
									}
									Label left = (Label) proceduresInfoTable
											.getWidget(10);
									left.setText("" + (all_amnt - pay - copay));
								}

							});
							params.add(data.get("pt_id"));
							params.add(data.get("id"));

							Util.callApiMethod("Ledger",
									"getCoveragesCopayInfo", params,
									new CustomRequestCallback() {
										@Override
										public void onError() {
										}

										@Override
										public void jsonifiedData(Object d) {
											if (data != null) {
												HashMap<String, String> result = (HashMap<String, String>) d;
												// tbAmount.setEnabled(false);
												if (result != null) {
													tbCopay.setText(result
															.get("copay"));
													try {
														Label lbLeft = new Label();
														float left = 0;
														float copay = Float
																.parseFloat(result
																		.get("copay"));
														left = Float
																.parseFloat(data
																		.get("left"));
														lbLeft
																.setText(""
																		+ (left - copay));
														proceduresInfoTable
																.getFlexTable()
																.setWidget(
																		actionRow,
																		10,
																		lbLeft);
													} catch (Exception e) {
														Window.alert("aaaa");
													}
													// tbAmount.setEnabled(false);
												}
											}
										}
									}, "HashMap<String,String>");
							return tbCopay;
						} else if (columnName.compareTo("left") == 0) {
							int row = proceduresInfoTable.getActionRow();
							proceduresInfoTable.getFlexTable()
									.getFlexCellFormatter().setWidth(row, 10,
											"10%");
							try {
								Label lb = (Label) proceduresInfoTable
										.getWidget(10);
								return lb;
							} catch (Exception e) {
								return new Label();
							}
						} else if (columnName.compareTo("adj_bal") == 0) {
							int row = proceduresInfoTable.getActionRow();
							proceduresInfoTable.getFlexTable()
									.getFlexCellFormatter().setWidth(row, 7,
											"10%");
							Label adjbal = new Label();
							adjbal.setText(data.get("adj_bal"));
							return adjbal;
						} else if (columnName.compareTo("amnt_bill") == 0) {
							int row = proceduresInfoTable.getActionRow();
							proceduresInfoTable.getFlexTable()
									.getFlexCellFormatter().setWidth(row, 5,
											"10%");
							Label amntbill = new Label();
							amntbill.setText(data.get("amnt_bill"));
							return amntbill;
						}

						else {
							return (Widget) null;
						}

					}
				});
		HorizontalPanel actionPanel = new HorizontalPanel();
		actionPanel.setSpacing(5);
		// actionPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

		CustomButton postBtn = new CustomButton(_("Post"), AppConstants.ICON_ADD);
		postBtn.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				prepareDataForPostCheck();
			}

		});
		CustomButton cancelBtn = new CustomButton(_("Cancel"),
				AppConstants.ICON_CANCEL);
		final PostCheckWidget pcw = this;
		cancelBtn.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				pcw.removeFromParent();
				callback.jsonifiedData("cancel");
			}

		});
		actionPanel.add(postBtn);
		actionPanel.add(cancelBtn);
		vPanel.add(postCheckInfoFlexTable);
		vPanel.add(proceduresInfoTable);
		vPanel.add(actionPanel);
		vPanel.setCellHorizontalAlignment(actionPanel,
				HasHorizontalAlignment.ALIGN_RIGHT);
		pids = new ArrayList<String>();
		loadSelectedProcedureInfo();
	}
示例#29
0
  /**
   * Instantiates a new basic thumb.
   *
   * @param imageRef This can be a ImageResource or a String Url
   * @param imgSize the img size
   * @param text the text
   * @param textMaxLenght the text max lenght
   * @param crop the crop
   * @param clickHandler the click handler
   */
  public BasicThumb(
      final Object imageRef,
      final int imgSize,
      final String text,
      final int textMaxLenght,
      final boolean crop,
      final ClickHandler clickHandler) {
    super();
    onOverLabel = false;
    panel = new VerticalPanel();
    if (imageRef instanceof String) {
      final String imageUrl = (String) imageRef;
      if (imgSize == NOSIZE) {
        image = new Image(imageUrl);
      } else {
        if (crop) {
          image = new Image(imageUrl, 0, 0, imgSize, imgSize);
        } else {
          image = new Image(imageUrl);
          image.setPixelSize(imgSize, imgSize);
        }
      }
    } else if (imageRef instanceof ImageResource) {
      image = new Image((ImageResource) imageRef);
      image.setPixelSize(imgSize, imgSize);
    } else {
      // This should not happen
      image = new Image();
      image.setPixelSize(imgSize, imgSize);
      Log.info("Unrecognized icon of BasicThumb: " + imageRef);
    }
    final String title = textMaxLenght == NOSIZE ? text : TextUtils.ellipsis(text, textMaxLenght);
    label = new Label(title);
    panel.add(image);
    panel.add(label);
    panel.addStyleName("k-basic-thumb");
    panel.addStyleName("kune-Margin-Mini-trbl");
    panel.addStyleName("k-pointer");
    panel.addStyleName("k-floatleft");
    panel.setCellHorizontalAlignment(label, VerticalPanel.ALIGN_CENTER);
    if (clickHandler != null) {
      addClickHandlerImpl(clickHandler);
    }
    image.addMouseOverHandler(
        new MouseOverHandler() {

          @Override
          public void onMouseOver(final MouseOverEvent event) {
            if (onOverLabel) {
              label.setVisible(true);
            }
          }
        });
    image.addMouseOutHandler(
        new MouseOutHandler() {

          @Override
          public void onMouseOut(final MouseOutEvent event) {
            if (onOverLabel) {
              label.setVisible(false);
            }
          }
        });
    setElement(panel.getElement());
  }
  public CourseFinderDialog() {
    super(true, false);
    setText(MESSAGES.courseSelectionDialog());

    iFilter = new AriaTextBox();
    iFilter.setStyleName("gwt-SuggestBox");
    iFilter.getElement().getStyle().setWidth(600, Unit.PX);

    iFilterSelect = new AriaButton(MESSAGES.buttonSelect());
    iFilterSelect.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            CourseFinderTab tab = getSelectedTab();
            if (tab != null && tab.getValue() != null) iFilter.setValue((String) tab.getValue());
            hide();
            SelectionEvent.fire(CourseFinderDialog.this, getValue());
          }
        });

    HorizontalPanel filterWithSelect = new HorizontalPanel();
    filterWithSelect.add(iFilter);
    filterWithSelect.add(iFilterSelect);
    filterWithSelect.setCellVerticalAlignment(iFilter, HasVerticalAlignment.ALIGN_MIDDLE);
    filterWithSelect.setCellVerticalAlignment(iFilterSelect, HasVerticalAlignment.ALIGN_MIDDLE);
    iFilterSelect.getElement().getStyle().setMarginLeft(5, Unit.PX);

    iDialogPanel = new VerticalPanel();
    iDialogPanel.setSpacing(5);
    iDialogPanel.add(filterWithSelect);
    iDialogPanel.setCellHorizontalAlignment(filterWithSelect, HasHorizontalAlignment.ALIGN_CENTER);

    addCloseHandler(
        new CloseHandler<PopupPanel>() {
          public void onClose(CloseEvent<PopupPanel> event) {
            RootPanel.getBodyElement().getStyle().setOverflow(Overflow.AUTO);
          }
        });

    final Timer finderTimer =
        new Timer() {
          @Override
          public void run() {
            if (iTabs != null) {
              for (CourseFinderTab tab : iTabs) tab.setValue(iFilter.getValue(), false);
            }
          }
        };

    iFilter.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            finderTimer.schedule(250);
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
              CourseFinderTab tab = getSelectedTab();
              if (tab != null && tab.getValue() != null) iFilter.setValue((String) tab.getValue());
              hide();
              SelectionEvent.fire(CourseFinderDialog.this, getValue());
              return;
            } else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
              hide();
              return;
            }
            if (event.isControlKeyDown() || event.isAltKeyDown()) {
              for (Map.Entry<Character, Integer> entry : iTabAccessKeys.entrySet())
                if (event.getNativeKeyCode() == Character.toLowerCase(entry.getKey())
                    || event.getNativeKeyCode() == Character.toUpperCase(entry.getKey())) {
                  iTabPanel.selectTab(entry.getValue());
                  event.preventDefault();
                  event.stopPropagation();
                }
            }
            if (iTabs != null) {
              for (CourseFinderTab tab : iTabs) tab.onKeyUp(event);
            }
          }
        });

    iFilter.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (iTabs != null) {
              for (CourseFinderTab tab : iTabs) tab.setValue(event.getValue(), true);
            }
          }
        });
    addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (iTabs != null) {
              for (CourseFinderTab tab : iTabs) tab.setValue(event.getValue(), true);
            }
          }
        });

    iFilter.addBlurHandler(
        new BlurHandler() {
          @Override
          public void onBlur(BlurEvent event) {
            if (isShowing()) {
              Scheduler.get()
                  .scheduleDeferred(
                      new ScheduledCommand() {
                        @Override
                        public void execute() {
                          iFilter.setFocus(true);
                        }
                      });
            }
          }
        });

    setWidget(iDialogPanel);
  }