Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
  private HorizontalPanel getFunctionButton(final TermObject tObj) {
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(2);

    // Edit Term
    boolean permission =
        permissionTable.contains(
            OWLActionConstants.TERMEDIT,
            OWLStatusConstants.getOWLStatusID(tObj.getStatus()),
            tObj.getLang(),
            MainApp.getPermissionCheck(tObj.getLang()));
    ImageAOS edit =
        new ImageAOS(
            constants.conceptEditTerm(),
            "images/edit-grey.gif",
            "images/edit-grey-disabled.gif",
            permission,
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                if (editTerm == null || !editTerm.isLoaded) editTerm = new EditTerm(tObj);
                editTerm.show();
              }
            });
    hp.add(edit);

    // Delete Term
    permission =
        permissionTable.contains(
            OWLActionConstants.TERMDELETE,
            OWLStatusConstants.getOWLStatusID(tObj.getStatus()),
            tObj.getLang(),
            MainApp.getPermissionCheck(tObj.getLang()));
    ImageAOS delete =
        new ImageAOS(
            constants.conceptDeleteTerm(),
            "images/delete-grey.gif",
            "images/delete-grey-disabled.gif",
            permission,
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                if (deleteTerm == null || !deleteTerm.isLoaded) deleteTerm = new DeleteTerm(tObj);
                deleteTerm.show();
              }
            });
    hp.add(delete);

    /*// Move Term
    ImageAOS move = new ImageAOS(constants.conceptMove(), "images/moveconcept-grey.gif", "images/moveconcept-grey.gif", permissionTable.contains(OWLActionConstants.TERMDELETE), new ClickHandler(){
    	public void onClick(ClickEvent event) {
    		MoveTerm moveTerm;
    		if(tObj.isMainLabel())
    		{
    			moveTerm = new MoveTerm();
    		}
    		else
    		{
    			moveTerm = new MoveTerm(tObj);
    		}
    		moveTerm.show();
    	}
    });

    if(tObj.getStatus().equals(OWLStatusConstants.DEPRECATED)  || tObj.getStatus().equals(OWLStatusConstants.DELETED) || tObj.getStatus().equals(OWLStatusConstants.PROPOSED_DEPRECATED))
    	move.setVisible(false);
    hp.add(move);

    */

    final HTMLAOS term = new HTMLAOS();
    term.setHTML(getTermColorByStatus(tObj.getLabel(), tObj.getStatus(), tObj.isMainLabel()), tObj);
    term.setStyleName(Style.Link);
    term.setTitle(tObj.getStatus());
    term.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (termDetail == null || !termDetail.isLoaded)
              termDetail = new TermDetail(conceptObject, (TermObject) term.getValue());
            termDetail.show();
          }
        });
    hp.add(term);

    Image wiki = new Image(MainApp.aosImageBundle.wikiIcon());
    wiki.setStyleName("cursor-hand");
    wiki.setTitle(constants.conceptWikipedia());
    wiki.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            openURL(
                "http://www.wikipedia.org/search-redirect.php?search="
                    + tObj.getLabel()
                    + "&language="
                    + tObj.getLang(),
                "wikiWindow");
          }
        });
    hp.add(wiki);

    return hp;
  }