List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellWidth
public void setCellWidth(IsWidget w, String width)
From source file:org.mindinformatics.gwt.domeo.component.cache.images.ui.CachedImagesPanel.java
License:Apache License
public void create() { container.clear();/* w ww . jav a 2s . c om*/ container.add(new HTML("Number of images detected: " + _domeo.getImagesCache().getSize())); widgetUtilsResources.widgetCss().ensureInjected(); int counter = 0; for (String key : _domeo.getImagesCache().getKeys()) { ArrayList<ImageProxy> list = _domeo.getImagesCache().getValue(key); for (ImageProxy image : list) { VerticalPanel hp1 = new VerticalPanel(); hp1.setWidth("100%"); boolean small = false; boolean reduced = false; Image img = new Image(image.getDisplayUrl()); if (img.getWidth() > 440) { img.setWidth("430px"); reduced = true; } else if (img.getWidth() < 220) { small = true; img.setWidth("200px"); } if (image.getTitle() != null && image.getTitle().trim().length() > 0) { img.setTitle(image.getTitle()); } if (!small) { SimplePanel imageWrap = new SimplePanel(); imageWrap.setStyleName(style.imageWrap()); imageWrap.add(img); imageWrap.setStyleName(style.centerText()); hp1.add(imageWrap); hp1.setCellHorizontalAlignment(img, HasHorizontalAlignment.ALIGN_CENTER); if (image.getTitle() != null && image.getTitle().trim().length() > 0) { HTML title = new HTML("<b>" + image.getTitle() + "</b>"); hp1.add(title); hp1.setCellHorizontalAlignment(title, HasHorizontalAlignment.ALIGN_CENTER); } _domeo.getLogger().debug(this, "0 " + image); _domeo.getLogger().debug(this, "1 " + image.getDisplayUrl()); JsPmcImage im = _domeo.getPmcImagesCache().getImageMetadataFromUrl(image.getDisplayUrl()); if (im != null) { _domeo.getLogger().debug(this, "2 " + im.getCaption()); hp1.add(new HTML("<span style='font-weight: bold;'>" + im.getTitle() + "</span> - " + im.getCaption() + " - <a target='_blank' href='http://krauthammerlab.med.yale.edu/imagefinder/Figure.external?sp=S" + im.getImageId() + "'>Yale Image Finder</a>" + " - <a target='_blank' href='http://cbakerlab.unbsj.ca:8080/iCyrus/page/" + im.getImageId() + "'>iCyrus</a>")); } HorizontalPanel hp = new HorizontalPanel(); final ImageProxy _image = image; ClickHandler exploreHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.alert( "Exploration of image not yet implemented (wip) " + _image.getOriginalUrl()); } }; // Image annotateIcon = new Image(Domeo.resources.editLittleIcon()); // annotateIcon.addClickHandler(exploreHandler); // HTML annotateLabel = new HTML("Annotate"); // hp.add(annotateIcon); // annotateLabel.addClickHandler(exploreHandler); // hp.add(annotateLabel); // if(!reduced) { Image exploreIcon = new Image(Domeo.resources.browseLittleIcon()); exploreIcon.addClickHandler(exploreHandler); HTML exploreLabel = new HTML("Explore"); hp.add(exploreIcon); exploreLabel.addClickHandler(exploreHandler); hp.add(exploreLabel); // } _domeo.getLogger().info(this, "cache lookup image;;;" + _image.getOriginalUrl()); // Make the lin absolute ArrayList<MAnnotation> annotations = _domeo.getAnnotationPersistenceManager() .annotationsForImage(_image.getOriginalUrl()); // if(annotations!=null && annotations.size()>0) { // ClickHandler annotationsHandler = new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // Window.alert("Exploration of annotations not yet implemented (wip) " + _image.getSrc()); // } // }; // Image exploreIcon = new Image(Domeo.resources.browseLittleIcon()); // exploreIcon.addClickHandler(annotationsHandler); // HTML exploreLabel = new HTML(annotations.size() + " Annotations"); // hp.add(exploreIcon); // exploreLabel.addClickHandler(annotationsHandler); // hp.add(exploreLabel); // } if (counter % 2 == 1) { hp1.addStyleName(style.indexOdd()); } else { hp1.addStyleName(style.indexEven()); } counter++; hp1.add(hp); // List of annotations try { if (annotations != null && annotations.size() > 0) { //Collections.sort(annotations, new SortByVerticalPostion()); for (MAnnotation ann : annotations) { if (ann instanceof MCommentAnnotation || ann instanceof MAnnotationCitationReference) continue; ITileComponent c = _domeo.getAnnotationTailsManager() .getAnnotationTile(ann.getClass().getName(), null); if (c == null) { VerticalPanel vp = new VerticalPanel(); vp.add(new Label(ann.getLocalId() + " - " + ann.getClass().getName() + " - " + ann.getY())); hp1.add(vp); } else { try { c.initializeLens(ann); hp1.add(c.getTile()); } catch (Exception e) { // If something goes wrong just display the default tile _domeo.getLogger().exception(this, "Refreshing tile: " + e.getMessage()); VerticalPanel vp = new VerticalPanel(); vp.add(new Label(ann.getLocalId() + " - " + ann.getClass().getName() + " - " + ann.getY())); hp1.add(vp); } } } } if (counter % 2 == 1) { //hp1.setStyleName(widgetUtilsResources.widgetCss().tableOddRow()); } } catch (Exception e) { _domeo.getLogger().exception(this, e.getMessage()); } } else { HorizontalPanel main = new HorizontalPanel(); SimplePanel imageWrap = new SimplePanel(); imageWrap.setStyleName(style.imageWrap()); imageWrap.add(img); main.add(imageWrap); //_domeo.getImagesCache().getValue(key); //Window.alert("" + image.getDisplayUrl() + "" + _domeo.getPmcImagesCache().getImageMetadata("")); //hp1.setCellHorizontalAlignment(img, HasHorizontalAlignment.ALIGN_CENTER); VerticalPanel right = new VerticalPanel(); right.setWidth("100%"); if (image.getTitle() != null && image.getTitle().trim().length() > 0) { HTML title = new HTML("title: <b>" + image.getTitle() + "</b>"); right.add(title); right.setCellHorizontalAlignment(title, HasHorizontalAlignment.ALIGN_LEFT); } HorizontalPanel hp = new HorizontalPanel(); final ImageProxy _image = image; ClickHandler exploreHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.alert( "Exploration of image not yet implemented (wip) " + _image.getOriginalUrl()); } }; // Image annotateIcon = new Image(Domeo.resources.editLittleIcon()); // annotateIcon.addClickHandler(exploreHandler); // HTML annotateLabel = new HTML("Annotate"); // hp.add(annotateIcon); // annotateLabel.addClickHandler(exploreHandler); // hp.add(annotateLabel); // if(!reduced) { Image exploreIcon = new Image(Domeo.resources.browseLittleIcon()); exploreIcon.addClickHandler(exploreHandler); HTML exploreLabel = new HTML("Explore"); hp.add(exploreIcon); exploreLabel.addClickHandler(exploreHandler); hp.add(exploreLabel); // } ArrayList<MAnnotation> annotations = _domeo.getAnnotationPersistenceManager() .annotationsForImage(_image.getOriginalUrl()); // if(annotations!=null && annotations.size()>0) { // ClickHandler annotationsHandler = new ClickHandler() { // @Override // public void onClick(ClickEvent event) { // Window.alert("Exploration of annotations not yet implemented (wip) " + _image.getSrc()); // } // }; // Image exploreIcon = new Image(Domeo.resources.browseLittleIcon()); // exploreIcon.addClickHandler(annotationsHandler); // HTML exploreLabel = new HTML(annotations.size() + " Annotations"); // hp.add(exploreIcon); // exploreLabel.addClickHandler(annotationsHandler); // hp.add(exploreLabel); // } right.add(hp); main.add(right); JsPmcImage im = _domeo.getPmcImagesCache().getImageMetadataFromUrl(image.getDisplayUrl()); if (im != null) { _domeo.getLogger().debug(this, "2 " + im.getCaption()); main.add(new HTML("<span style='font-weight: bold;'>" + im.getTitle() + "</span> - " + im.getCaption() + " - <a target='_blank' href='http://krauthammerlab.med.yale.edu/imagefinder/Figure.external?sp=S" + im.getImageId() + "'>Yale Image Finder</a>" + " - <a target='_blank' href='http://cbakerlab.unbsj.ca:8080/iCyrus/page/" + im.getImageId() + "'>iCyrus</a>")); } if (counter % 2 == 1) { //right.setStyleName(widgetUtilsResources.widgetCss().tableOddRow()); } if (counter % 2 == 1) { hp1.addStyleName(style.indexOdd()); } else { hp1.addStyleName(style.indexEven()); } counter++; main.setCellWidth(right, "100%"); hp1.add(main); // List of annotations try { if (annotations != null && annotations.size() > 0) { //Collections.sort(annotations, new SortByVerticalPostion()); for (MAnnotation ann : annotations) { if (ann instanceof MCommentAnnotation || ann instanceof MAnnotationCitationReference) continue; ITileComponent c = _domeo.getAnnotationTailsManager() .getAnnotationTile(ann.getClass().getName(), null); if (c == null) { VerticalPanel vp = new VerticalPanel(); vp.add(new Label(ann.getLocalId() + " - " + ann.getClass().getName() + " - " + ann.getY())); hp1.add(vp); } else { try { c.initializeLens(ann); hp1.add(c.getTile()); } catch (Exception e) { // If something goes wrong just display the default tile _domeo.getLogger().exception(this, "Refreshing tile: " + e.getMessage()); VerticalPanel vp = new VerticalPanel(); vp.add(new Label(ann.getLocalId() + " - " + ann.getClass().getName() + " - " + ann.getY())); hp1.add(vp); } } } } } catch (Exception e) { _domeo.getLogger().exception(this, e.getMessage()); } } container.add(hp1); } } }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.comment.ui.tile.TCommentTile.java
License:Apache License
public void createProvenanceBar(HorizontalPanel provenance, final MAnnotation annotation) { int step = 0; try {//from ww w . j av a 2 s.c om Resources resource = Domeo.resources; Image editIcon = new Image(resource.editLittleIcon()); editIcon.setTitle("Edit Item"); editIcon.setStyleName(ATileComponent.tileResources.css().button()); //editIcon.addClickHandler(ActionEditAnnotation.getClickHandler(_domeo, this, _listener, getAnnotation())); step = 1; Image showIcon = new Image(resource.showLittleIcon()); showIcon.setTitle("Show Item in Context"); showIcon.setStyleName(ATileComponent.tileResources.css().button()); showIcon.addClickHandler(ActionShowAnnotation.getClickHandler(_domeo, this, getAnnotation())); step = 2; /* Image addCommentIcon = new Image(resource.addCommentIcon()); addCommentIcon.setTitle("Comment on item"); addCommentIcon.setStyleName(ATileComponent.tileResources.css().button()); addCommentIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showCommentForm(); } }); step=3; Image commentBranchIcon = new Image(resource.splitCommentIcon()); commentBranchIcon.setTitle("Comment on item"); commentBranchIcon.setStyleName(ATileComponent.tileResources.css().button()); commentBranchIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showCommentBranchForm(); } }); step=4; */ //final CommentsViewerPanel viewer = _viewer; final MAnnotation ann = _annotation; submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (addCommentBody.getText().trim().length() == 0) return; MAnnotationSelector selector = AnnotationFactory.createAnnotationSelector( _domeo.getAgentManager().getUserPerson(), _domeo.getPersistenceManager().getCurrentResource(), ann); MCommentAnnotation annotation = AnnotationFactory.createComment( _domeo.getPersistenceManager().getCurrentSet(), _domeo.getAgentManager().getUserPerson(), _domeo.getAgentManager().getSoftware(), _domeo.getPersistenceManager().getCurrentResource(), selector, addCommentBody.getText()); if (addCommentTitle.getValue() != null && addCommentTitle.getValue().trim().length() > 0) { annotation.setTitle(addCommentTitle.getValue()); } _domeo.getAnnotationPersistenceManager().addAnnotationOfAnnotation(annotation, ann, _domeo.getAnnotationPersistenceManager().getSetByAnnotationId(ann.getLocalId())); ASideTab tab = _domeo.getDiscussionSideTab(); ASidePanel panel = _domeo.getSidePanelsFacade().getPanelForTab(tab); ((ICommentsRefreshableComponent) panel).refreshFromRoot(); _domeo.refreshAnnotationComponents(); TCommentTile c = new TCommentTile(_domeo, _listener); TreeItem i = new TreeItem(c.getTile()); i.setState(true); c.initializeLens(annotation); hideCommentForm(); //viewer.refreshThreadsTree(); } }); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hideCommentForm(); } }); Image deleteIcon = new Image(resource.deleteLittleIcon()); deleteIcon.setTitle("Delete Item"); deleteIcon.setStyleName(ATileComponent.tileResources.css().button()); deleteIcon.addClickHandler(ActionDeleteAnnotation.getClickHandler(_domeo, this, getAnnotation())); step = 5; _domeo.getLogger().debug(this, "" + annotation.getCreator()); _domeo.getLogger().debug(this, annotation.getCreator().getUri()); // TODO move to an abstract tile class if (((BooleanPreference) _domeo.getPreferences().getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_PROVENANCE)).getValue()) { if (annotation.getCreator().getUri().equals(_domeo.getAgentManager().getUserPerson().getUri())) { if (((BooleanPreference) _domeo.getPreferences().getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_USER_PROVENANCE)).getValue()) { provenance.clear(); step = 6; // TODO Externalize the icon management to the plugins if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.multipleLittleIcon()); ic.setTitle("Annotation on multiple targets"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else if (annotation.getSelector() != null && annotation.getSelector().getTarget() instanceof MOnlineImage) { Image ic = new Image(Domeo.resources.littleImageIcon()); ic.setTitle("Annotation on image"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { if (SelectorUtils.isOnAnnotation(annotation.getSelectors())) { if (((MCommentAnnotation) annotation).getTitle() != null && ((MCommentAnnotation) annotation).getTitle().trim().length() > 0) { Image ic = new Image(Domeo.resources.splitCommentIcon()); ic.setTitle("Discussion branch"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleCommentIcon()); ic.setTitle("Discussion comment"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } } else if (SelectorUtils.isOnResourceTarget(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.littleCommentsIcon()); ic.setTitle("Annotation on annotation"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleTextIcon()); ic.setTitle("Annotation on text"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } } step = 7; provenance.add(new HTML( "<span style='font-weight: bold; font-size: 12px; color: #696969'>By Me</span> <span style='padding-left:5px' title='" + annotation.getFormattedCreationDate() + "'>" + elaspedTime((new Date()).getTime() - annotation.getCreatedOn().getTime()) + " ago</span>")); if (!(annotation.getSelector() instanceof MTargetSelector) && !(annotation.getSelector() instanceof MAnnotationSelector)) { provenance.add(showIcon); provenance.setCellWidth(showIcon, "22px"); provenance.add(editIcon); provenance.setCellWidth(editIcon, "22px"); } // provenance.add(addCommentIcon); // provenance.setCellHorizontalAlignment(addCommentIcon, HasHorizontalAlignment.ALIGN_LEFT); // provenance.setCellWidth(addCommentIcon, "22px"); // provenance.add(commentBranchIcon); // provenance.setCellHorizontalAlignment(commentBranchIcon, HasHorizontalAlignment.ALIGN_LEFT); // provenance.setCellWidth(commentBranchIcon, "22px"); provenance.add(deleteIcon); provenance.setCellHorizontalAlignment(deleteIcon, HasHorizontalAlignment.ALIGN_LEFT); provenance.setCellWidth(deleteIcon, "22px"); } else { provenance.setVisible(false); } } else { provenance.clear(); step = 8; if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.multipleLittleIcon()); ic.setTitle("Annotation on multiple targets"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else if (annotation.getSelector() != null && annotation.getSelector().getTarget() instanceof MOnlineImage) { Image ic = new Image(Domeo.resources.littleImageIcon()); ic.setTitle("Annotation on image"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleTextIcon()); ic.setTitle("Annotation on text"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } step = 9; provenance.add(new HTML("<span style='font-weight: bold; font-size: 12px; color: #696969'>By " + annotation.getCreator().getName() + "</span> <span style='padding-left:5px; font-size: 12px; color: #696969;' title='" + annotation.getFormattedCreationDate() + "'>" + elaspedTime((new Date()).getTime() - annotation.getCreatedOn().getTime()) + " ago</span>")); provenance.add(showIcon); provenance.add(editIcon); //provenance.add(commentBranchIcon); //provenance.add(addCommentIcon); provenance.add(deleteIcon); } } else { provenance.setVisible(false); } } catch (Exception e) { _domeo.getLogger().exception(this, "Provenance bar generation exception @" + step + " " + e.getMessage()); } }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.commentaries.linear.ui.tile.TLinearCommentTile.java
License:Apache License
public void createProvenanceBar(HorizontalPanel provenance, final MAnnotation annotation) { int step = 0; try {//from www.j a v a 2 s . com Resources resource = Domeo.resources; Image editIcon = new Image(resource.editLittleIcon()); editIcon.setTitle("Edit Item"); editIcon.setStyleName(ATileComponent.tileResources.css().button()); //editIcon.addClickHandler(ActionEditAnnotation.getClickHandler(_domeo, this, _listener, getAnnotation())); step = 1; Image showIcon = new Image(resource.showLittleIcon()); showIcon.setTitle("Show Item in Context"); showIcon.setStyleName(ATileComponent.tileResources.css().button()); showIcon.addClickHandler(ActionShowAnnotation.getClickHandler(_domeo, this, getAnnotation())); step = 2; /* Image addCommentIcon = new Image(resource.addCommentIcon()); addCommentIcon.setTitle("Comment on item"); addCommentIcon.setStyleName(ATileComponent.tileResources.css().button()); addCommentIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showCommentForm(); } }); step=3; Image commentBranchIcon = new Image(resource.splitCommentIcon()); commentBranchIcon.setTitle("Comment on item"); commentBranchIcon.setStyleName(ATileComponent.tileResources.css().button()); commentBranchIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showCommentBranchForm(); } }); step=4; */ //final CommentsViewerPanel viewer = _viewer; final MAnnotation ann = _annotation; submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (addCommentBody.getText().trim().length() == 0) return; MAnnotationSelector selector = AnnotationFactory.createAnnotationSelector( _domeo.getAgentManager().getUserPerson(), _domeo.getPersistenceManager().getCurrentResource(), ann); MLinearCommentAnnotation annotation = LinearCommentsFactory.createLinearComment( _domeo.getAgentManager().getUserPerson(), _domeo.getAgentManager().getSoftware(), selector, addCommentBody.getText()); if (addCommentTitle.getValue() != null && addCommentTitle.getValue().trim().length() > 0) { annotation.setTitle(addCommentTitle.getValue()); } _domeo.getAnnotationPersistenceManager().addAnnotationOfAnnotation(annotation, ann, _domeo.getAnnotationPersistenceManager().getSetByAnnotationId(ann.getLocalId())); ASideTab tab = _domeo.getLinearCommentsSideTab(); ASidePanel panel = _domeo.getSidePanelsFacade().getPanelForTab(tab); ((ICommentsRefreshableComponent) panel).refreshFromRoot(); _domeo.refreshAnnotationComponents(); TLinearCommentTile c = new TLinearCommentTile(_domeo, _listener); TreeItem i = new TreeItem(c.getTile()); i.setState(true); c.initializeLens(annotation); hideCommentForm(); //viewer.refreshThreadsTree(); } }); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hideCommentForm(); } }); Image deleteIcon = new Image(resource.deleteLittleIcon()); deleteIcon.setTitle("Delete Item"); deleteIcon.setStyleName(ATileComponent.tileResources.css().button()); deleteIcon.addClickHandler(ActionDeleteAnnotation.getClickHandler(_domeo, this, getAnnotation())); step = 5; _domeo.getLogger().debug(this, "" + annotation); step = 50; //_domeo.getLogger().debug(this, ""+annotation.getCreator()); step = 500; _domeo.getLogger().debug(this, annotation.getCreator().getUri()); step = 5000; // TODO move to an abstract tile class if (((BooleanPreference) _domeo.getPreferences().getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_PROVENANCE)).getValue()) { if (annotation.getCreator().getUri().equals(_domeo.getAgentManager().getUserPerson().getUri())) { if (((BooleanPreference) _domeo.getPreferences().getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_USER_PROVENANCE)).getValue()) { provenance.clear(); step = 6; // TODO Externalize the icon management to the plugins if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.multipleLittleIcon()); ic.setTitle("Annotation on multiple targets"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else if (annotation.getSelector() != null && annotation.getSelector().getTarget() instanceof MOnlineImage) { Image ic = new Image(Domeo.resources.littleImageIcon()); ic.setTitle("Annotation on image"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { if (SelectorUtils.isOnAnnotation(annotation.getSelectors())) { if (((MLinearCommentAnnotation) annotation).getTitle() != null && ((MCommentAnnotation) annotation).getTitle().trim().length() > 0) { Image ic = new Image(Domeo.resources.splitCommentIcon()); ic.setTitle("Discussion branch"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.commentIcon()); ic.setTitle("Discussion comment"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } } else if (SelectorUtils.isOnResourceTarget(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.littleCommentsIcon()); ic.setTitle("Annotation on annotation"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleTextIcon()); ic.setTitle("Annotation on text"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } } step = 7; provenance.add(new HTML( "<span style='font-weight: bold; font-size: 12px; color: #696969'>By Me</span> <span style='padding-left:5px' title='" + annotation.getFormattedCreationDate() + "'>" + elaspedTime((new Date()).getTime() - annotation.getCreatedOn().getTime()) + " ago</span>")); if (!(annotation.getSelector() instanceof MTargetSelector) && !(annotation.getSelector() instanceof MAnnotationSelector)) { provenance.add(showIcon); provenance.setCellWidth(showIcon, "22px"); provenance.add(editIcon); provenance.setCellWidth(editIcon, "22px"); } // provenance.add(addCommentIcon); // provenance.setCellHorizontalAlignment(addCommentIcon, HasHorizontalAlignment.ALIGN_LEFT); // provenance.setCellWidth(addCommentIcon, "22px"); // provenance.add(commentBranchIcon); // provenance.setCellHorizontalAlignment(commentBranchIcon, HasHorizontalAlignment.ALIGN_LEFT); // provenance.setCellWidth(commentBranchIcon, "22px"); provenance.add(deleteIcon); provenance.setCellHorizontalAlignment(deleteIcon, HasHorizontalAlignment.ALIGN_LEFT); provenance.setCellWidth(deleteIcon, "22px"); } else { provenance.setVisible(false); } } else { provenance.clear(); step = 8; if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.multipleLittleIcon()); ic.setTitle("Annotation on multiple targets"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else if (annotation.getSelector() != null && annotation.getSelector().getTarget() instanceof MOnlineImage) { Image ic = new Image(Domeo.resources.littleImageIcon()); ic.setTitle("Annotation on image"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleTextIcon()); ic.setTitle("Annotation on text"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } step = 9; provenance.add(new HTML("<span style='font-weight: bold; font-size: 12px; color: #696969'>By " + annotation.getCreator().getName() + "</span> <span style='padding-left:5px; font-size: 12px; color: #696969;' title='" + annotation.getFormattedCreationDate() + "'>" + elaspedTime((new Date()).getTime() - annotation.getCreatedOn().getTime()) + " ago</span>")); provenance.add(showIcon); provenance.add(editIcon); //provenance.add(commentBranchIcon); //provenance.add(addCommentIcon); provenance.add(deleteIcon); } } else { provenance.setVisible(false); } } catch (Exception e) { _domeo.getLogger().exception(this, "Provenance bar generation exception @" + step + " " + e.getMessage()); } }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.micropubs.ui.form.FMicroPublicationForm.java
License:Apache License
public void refreshQualifiers() { qualifiersPanel.clear();//from w w w . j ava2 s. c o m Integer counter = 0; VerticalPanel vp = new VerticalPanel(); vp.setWidth("444px"); for (MMpRelationship q : qualifiers) { final MMpRelationship _q = q; if (q.getObjectElement() instanceof MMpQualifier) { MLinkedResource res = ((MMpQualifier) q.getObjectElement()).getQualifier(); StringBuffer sb = new StringBuffer(); sb.append("<img src='" + Domeo.resources.tagIcon().getSafeUri().asString() + "'/> " + "<b>" + res.getLabel() + "</b> from <a target=\"_blank\"href=\"" + res.getSource().getUrl() + "\">" + res.getSource().getLabel() + "</a>"); if (res.getDescription() != null && res.getDescription().length() > 0) sb.append(", " + res.getDescription()); boolean nodigester = true; List<ITrustedResourceDigester> digesters = _domeo.getLinkedDataDigestersManager() .getLnkedDataDigesters(res); for (ITrustedResourceDigester digester : digesters) { if (digester.getLinkLabel(res).trim().length() > 0) { sb.append(", <a target=\"_blank\"href=\"" + digester.getLinkUrl(res) + "\">@" + digester.getLinkLabel(res) + "</a> "); nodigester = false; } } HorizontalPanel hp = new HorizontalPanel(); hp.setStyleName(style.indexWrapper()); hp.setWidth("444px"); hp.add(new HTML(sb.toString())); vp.add(hp); final Image removeIcon = new Image(Domeo.resources.deleteLittleIcon()); removeIcon.setStyleName(style.link()); removeIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hasChanged = true; qualifiers.remove(_q); if (_item != null) { _item.getQualifiers().remove(_q); _ann.setHasChanged(true); } refreshQualifiers(); } }); hp.add(removeIcon); hp.setCellWidth(removeIcon, "16px"); hp.setCellHorizontalAlignment(removeIcon, HasHorizontalAlignment.ALIGN_RIGHT); } } qualifiersPanel.add(vp); }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.micropubs.ui.form.FMicroPublicationForm.java
License:Apache License
private void displayReferenceInEvidence(VerticalPanel vp, Integer counter, final MMpRelationship relationship) { HorizontalPanel hp1 = new HorizontalPanel(); hp1.setWidth("442px"); hp1.setStyleName(style.indexWrapper()); if (relationship.getName().equals(IMicroPublicationsOntology.supportedBy)) { final Image supportedByIcon = new Image(localResources.supportedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override/*from w ww . j av a 2s. c om*/ public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); hp1.add(supportedByIcon); hp1.setCellWidth(supportedByIcon, "22px"); } else if (relationship.getName().equals(IMicroPublicationsOntology.challengedBy)) { final Image supportedByIcon = new Image(localResources.challengedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); hp1.add(supportedByIcon); hp1.setCellWidth(supportedByIcon, "22px"); } hp1.add(PubMedCitationPainter .getFullCitation(((MMpReference) relationship.getObjectElement()).getReference(), _domeo)); final MMpRelationship _q = relationship; final Image removeIcon = new Image(Domeo.resources.deleteLittleIcon()); removeIcon.setStyleName(style.link()); removeIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hasChanged = true; evidence.remove(_q); if (_item != null) { _item.getEvidence().remove(_q); _ann.setHasChanged(true); } refreshSupport(); //box.setEnabled(false); //_container.addImageAsData(_image); } }); hp1.add(removeIcon); hp1.setCellWidth(removeIcon, "16px"); hp1.setCellHorizontalAlignment(removeIcon, HasHorizontalAlignment.ALIGN_RIGHT); vp.add(hp1); }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.micropubs.ui.form.FMicroPublicationForm.java
License:Apache License
private void displayStatementInEvidence(VerticalPanel vp, Integer counter, final MMpRelationship relationship) { HorizontalPanel hp1 = new HorizontalPanel(); hp1.setWidth("442px"); hp1.setStyleName(style.indexWrapper()); if (relationship.getName().equals(IMicroPublicationsOntology.supportedBy)) { final Image supportedByIcon = new Image(localResources.supportedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override/*from w w w. j a v a 2 s . co m*/ public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); hp1.add(supportedByIcon); hp1.setCellWidth(supportedByIcon, "22px"); } else if (relationship.getName().equals(IMicroPublicationsOntology.challengedBy)) { final Image supportedByIcon = new Image(localResources.challengedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); hp1.add(supportedByIcon); hp1.setCellWidth(supportedByIcon, "22px"); } hp1.add(new HTML(((MMpStatement) relationship.getObjectElement()).getText())); final Image removeIcon = new Image(Domeo.resources.deleteLittleIcon()); removeIcon.setStyleName(style.link()); removeIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { //box.setEnabled(false); //_container.addImageAsData(_image); } }); hp1.add(removeIcon); hp1.setCellWidth(removeIcon, "16px"); hp1.setCellHorizontalAlignment(removeIcon, HasHorizontalAlignment.ALIGN_RIGHT); vp.add(hp1); }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.micropubs.ui.form.FMicroPublicationForm.java
License:Apache License
private void displayImageInEvidence(VerticalPanel vp, Integer counter, final MMpRelationship relationship) { _domeo.getLogger().debug(this, "3c1"); MOnlineImage image = (MOnlineImage) ((MImageInDocumentSelector) relationship.getObjectElement() .getSelector()).getTarget(); _domeo.getLogger().debug(this, "3c2"); VerticalPanel hp1 = new VerticalPanel(); hp1.setWidth("442px"); boolean small = false; boolean reduced = false; //Window.alert(image.getUrl() + " - " + image.getDisplayUrl()); Image img = new Image(image.getDisplayUrl()); _domeo.getLogger().debug(this, "3c3"); if (img.getWidth() > 380) { img.setWidth("380px"); reduced = true;// w ww .j av a 2 s. c o m } else if (img.getWidth() < 220) { small = true; //img.setWidth("200px"); } if (image.getLabel() != null && image.getLabel().trim().length() > 0) { img.setTitle(image.getLabel()); } _domeo.getLogger().debug(this, "3c4"); if (!small) { HorizontalPanel main = new HorizontalPanel(); main.setWidth("442px"); //VerticalPanel actionsPanel = new VerticalPanel(); //actionsPanel.setHeight("100%"); if (relationship.getName().equals(IMicroPublicationsOntology.supportedBy)) { final Image supportedByIcon = new Image(localResources.supportedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); main.add(supportedByIcon); main.setCellWidth(supportedByIcon, "22px"); } else if (relationship.getName().equals(IMicroPublicationsOntology.challengedBy)) { final Image supportedByIcon = new Image(localResources.challengedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); main.add(supportedByIcon); main.setCellWidth(supportedByIcon, "22px"); } VerticalPanel left = new VerticalPanel(); SimplePanel imageWrap = new SimplePanel(); imageWrap.setStyleName(style.imageWrap()); imageWrap.add(img); imageWrap.setStyleName(style.centerText()); left.add(imageWrap); left.setCellHorizontalAlignment(img, HasHorizontalAlignment.ALIGN_LEFT); if (image.getLabel() != null && image.getLabel().trim().length() > 0) { HTML title = new HTML("<b>" + image.getLabel() + "</b>"); left.add(title); left.setCellHorizontalAlignment(title, HasHorizontalAlignment.ALIGN_LEFT); } /* else { HTML title = new HTML("<b>Title</b>"); left.add(title); left.setCellHorizontalAlignment(title, HasHorizontalAlignment.ALIGN_LEFT); } */ main.add(left); main.setStyleName(style.indexWrapper()); if (counter % 2 == 1) { left.addStyleName(style.indexOdd()); } else { left.addStyleName(style.indexEven()); } final Image removeIcon = new Image(Domeo.resources.deleteLittleIcon()); removeIcon.setStyleName(style.link()); removeIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { //box.setEnabled(false); //_container.addImageAsData(_image); } }); main.add(removeIcon); main.setCellWidth(removeIcon, "16px"); main.setCellHorizontalAlignment(removeIcon, HasHorizontalAlignment.ALIGN_RIGHT); hp1.add(main); } else { HorizontalPanel main = new HorizontalPanel(); main.setStyleName(style.indexWrapper()); final Image supportedByIcon = new Image(localResources.supportedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); main.add(supportedByIcon); main.setCellWidth(supportedByIcon, "22px"); SimplePanel imageWrap = new SimplePanel(); imageWrap.setStyleName(style.imageWrap()); imageWrap.add(img); main.add(imageWrap); //hp1.setCellHorizontalAlignment(img, HasHorizontalAlignment.ALIGN_CENTER); VerticalPanel right = new VerticalPanel(); right.setWidth("100%"); if (image.getLabel() != null && image.getLabel().trim().length() > 0) { HTML title = new HTML("<b>" + image.getLabel() + "</b>"); right.add(title); right.setCellHorizontalAlignment(title, HasHorizontalAlignment.ALIGN_LEFT); } /*else { HTML title = new HTML("title: <b>Title</b>"); right.add(title); right.setCellHorizontalAlignment(title, HasHorizontalAlignment.ALIGN_LEFT); }*/ main.add(right); main.setCellWidth(right, "100%"); final Image removeIcon = new Image(Domeo.resources.deleteLittleIcon()); removeIcon.setStyleName(style.link()); removeIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { //box.setEnabled(false); //_container.addImageAsData(_image); } }); main.add(removeIcon); main.setCellWidth(removeIcon, "16px"); main.setCellHorizontalAlignment(removeIcon, HasHorizontalAlignment.ALIGN_RIGHT); hp1.add(main); if (counter % 2 == 1) { right.addStyleName(style.indexOdd()); } else { right.addStyleName(style.indexEven()); } } vp.add(hp1); }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.micropubs.ui.form.FMicroPublicationForm2.java
License:Apache License
public void refreshQualifiers() { qualifiersPanel.clear();//from w w w. java2s .c o m VerticalPanel vp = new VerticalPanel(); vp.setWidth("100%"); if (qualifiers.size() > 0) { for (MMpRelationship q : qualifiers) { final MMpRelationship _q = q; if (q.getObjectElement() instanceof MMpQualifier) { MLinkedResource res = ((MMpQualifier) q.getObjectElement()).getQualifier(); StringBuffer sb = new StringBuffer(); sb.append("<img src='" + Domeo.resources.tagIcon().getSafeUri().asString() + "'/> " + "<b>" + res.getLabel() + "</b> from <a target=\"_blank\"href=\"" + res.getSource().getUrl() + "\">" + res.getSource().getLabel() + "</a>"); if (res.getDescription() != null && res.getDescription().length() > 0) sb.append(", " + res.getDescription()); boolean nodigester = true; List<ITrustedResourceDigester> digesters = _domeo.getLinkedDataDigestersManager() .getLnkedDataDigesters(res); for (ITrustedResourceDigester digester : digesters) { if (digester.getLinkLabel(res).trim().length() > 0) { sb.append(", <a target=\"_blank\"href=\"" + digester.getLinkUrl(res) + "\">@" + digester.getLinkLabel(res) + "</a> "); nodigester = false; } } HorizontalPanel hp = new HorizontalPanel(); hp.setStyleName(style.indexWrapper()); hp.setWidth("100%"); hp.add(new HTML(sb.toString())); vp.add(hp); final Image removeIcon = new Image(Domeo.resources.deleteLittleIcon()); removeIcon.setStyleName(style.link()); removeIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hasChanged = true; qualifiers.remove(_q); if (_item != null) { _item.getQualifiers().remove(_q); _ann.setHasChanged(true); } refreshQualifiers(); } }); hp.add(removeIcon); hp.setCellWidth(removeIcon, "16px"); hp.setCellHorizontalAlignment(removeIcon, HasHorizontalAlignment.ALIGN_RIGHT); } } } else { vp.add(new HTML("No qualifier provided")); } resizeEvidenceTab(); qualifiersPanel.add(vp); }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.micropubs.ui.form.FMicroPublicationForm2.java
License:Apache License
private void displayReferenceInEvidence(VerticalPanel vp, Integer counter, final MMpRelationship relationship) { HorizontalPanel hp1 = new HorizontalPanel(); hp1.setWidth("100%"); hp1.setStyleName(style.indexWrapper()); if (relationship.getName().equals(IMicroPublicationsOntology.supportedBy)) { final Image supportedByIcon = new Image(localResources.supportedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override/* w ww . j a v a 2 s .com*/ public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); hp1.add(supportedByIcon); hp1.setCellWidth(supportedByIcon, "22px"); } else if (relationship.getName().equals(IMicroPublicationsOntology.challengedBy)) { final Image supportedByIcon = new Image(localResources.challengedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); hp1.add(supportedByIcon); hp1.setCellWidth(supportedByIcon, "22px"); } hp1.add(PubMedCitationPainter .getFullCitation(((MMpReference) relationship.getObjectElement()).getReference(), _domeo)); final MMpRelationship _q = relationship; final Image removeIcon = new Image(Domeo.resources.deleteLittleIcon()); removeIcon.setStyleName(style.link()); removeIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hasChanged = true; evidence.remove(_q); if (_item != null) { _item.getEvidence().remove(_q); _ann.setHasChanged(true); } refreshSupport(); //box.setEnabled(false); //_container.addImageAsData(_image); } }); hp1.add(removeIcon); hp1.setCellWidth(removeIcon, "16px"); hp1.setCellHorizontalAlignment(removeIcon, HasHorizontalAlignment.ALIGN_RIGHT); vp.add(hp1); }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.micropubs.ui.form.FMicroPublicationForm2.java
License:Apache License
private void displayStatementInEvidence(VerticalPanel vp, Integer counter, final MMpRelationship relationship) { HorizontalPanel hp1 = new HorizontalPanel(); hp1.setWidth("100%"); hp1.setStyleName(style.indexWrapper()); if (relationship.getName().equals(IMicroPublicationsOntology.supportedBy)) { final Image supportedByIcon = new Image(localResources.supportedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override//from w w w .j ava 2 s. com public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); hp1.add(supportedByIcon); hp1.setCellWidth(supportedByIcon, "22px"); } else if (relationship.getName().equals(IMicroPublicationsOntology.challengedBy)) { final Image supportedByIcon = new Image(localResources.challengedBy()); supportedByIcon.setTitle("Supported By"); supportedByIcon.setStyleName(style.link()); supportedByIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { EvidenceRelationshipBubble bubble = new EvidenceRelationshipBubble(_this, _domeo, _item, relationship, ""); int x = supportedByIcon.getAbsoluteLeft(); int y = supportedByIcon.getAbsoluteTop(); bubble.show(x, y); } }); hp1.add(supportedByIcon); hp1.setCellWidth(supportedByIcon, "22px"); } hp1.add(new HTML(((MMpStatement) relationship.getObjectElement()).getText())); final Image removeIcon = new Image(Domeo.resources.deleteLittleIcon()); removeIcon.setStyleName(style.link()); removeIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { //box.setEnabled(false); //_container.addImageAsData(_image); } }); hp1.add(removeIcon); hp1.setCellWidth(removeIcon, "16px"); hp1.setCellHorizontalAlignment(removeIcon, HasHorizontalAlignment.ALIGN_RIGHT); vp.add(hp1); }