/** * @param selectedEntity * @return */ private boolean isSelectedEntityInValuesForProvider(EIEntity selectedEntity) { for (EIInstanceMinimal instance : valuesForProvider) { if ( instance.getEntity().equals( selectedEntity ) ) { return true; } } return false; }
public List<EIEntity> getResourceProviderEntities() { final List<EIEntity> providerEntities = new ArrayList<EIEntity>(); for (final String label : getResourceProviderLabels()) { providerEntities.add( providerMap.get( label ).getEntity() ); } return providerEntities; }
public EIEntity getResourceProvider(final EIURI providerUri) { if ( !providerURIMap.containsKey( providerUri ) ) { log.warn( "trying to get nonexistent uri '" + providerUri + "'" ); return EIEntity.NULL_ENTITY; } return providerURIMap.get( providerUri ).getEntity(); }
public EIEntity getResourceProvider(final String providerLabel) { if ( !providerMap.containsKey( providerLabel ) ) { log.warn( "trying to get nonexistent entry '" + providerLabel + "'" ); return EIEntity.NULL_ENTITY; } return providerMap.get( providerLabel ).getEntity(); }
private List<EIEntity> getEntitiesByLabel(String instanceLabel) { List<EIEntity> instanceList = new ArrayList<EIEntity>(); for ( EIInstanceMinimal instance : appState.getCachedGeneticAlterations() ) { if ( instanceLabel.equals( instance.getEntity().getLabel() ) ) { instanceList.add( instance.getEntity() ); } } return instanceList; }
public EIURI getInstanceURI() { return getEntity().getURI(); }
public String getInstanceLabel() { return getEntity().getLabel(); }
@Override public int compareTo(final Object o) { if ( !( o instanceof EIInstanceMinimal ) ) { return 0; } if(getEntity().getLabel().equals( ( (EIInstanceMinimal)o ).getEntity().getLabel() )) { return getEntity().getURI().toString().compareToIgnoreCase( ( (EIInstanceMinimal)o ).getEntity().getURI().toString() ); } return getEntity().getLabel().compareToIgnoreCase( ( (EIInstanceMinimal)o ).getEntity().getLabel() ); }
private List<EIInstanceMinimal> getCachedDeduplicatedGeneticAlterations() { if( appState.getCachedGeneticAlterations() == null ) { return Collections.emptyList(); } Set<String> instanceLabels = new HashSet<String>(); List<EIInstanceMinimal> dedupedInstances = new ArrayList<EIInstanceMinimal>(); for ( EIInstanceMinimal instance : appState.getCachedGeneticAlterations() ) { String instanceLabel = instance.getEntity().getLabel(); if ( !instanceLabels.contains( instanceLabel ) ) { instanceLabels.add( instanceLabel ); dedupedInstances.add( instance ); } } return dedupedInstances; }
protected final EIEntity getCorrectProviderEntity(EIURI providerUri) { if ( valuesForAll != null ) { for (EIInstanceMinimal instance : valuesForAll) { if ( instance.getInstanceURI().equals( providerUri ) ) { return instance.getEntity(); } } } return EIEntity.NULL_ENTITY; }
@Override public String toString() { // Display with the first asserted class return instanceType.toString() + " : " + getEntity().toString(); }
@Override public void onClick(final ClickEvent event) { if(WidgetUtils.clickHasModifiers( event )) { //no-op - let the browser handle } else { //Prevent regular behavior of Anchor event.preventDefault(); ApplicationState.getInstance().updateApplicationState( Mode.edit, instance.getEntity(), instance.getInstanceType(), getUpdatedProviderEntity( instance.getEntity() ) ); } } } );
Set<String> stringResults = new HashSet<String>(); for ( EIInstanceMinimal eiInstance : queryResults ) { String instanceLabel = eiInstance.getEntity().getLabel(); if ( !stringResults.contains( instanceLabel ) ) { stringResults.add( instanceLabel );
private void setEdit() { if ( ClientSweetProxy.getInstance().canEdit( instance ) ) { //Set the target so that we can handle right click formActions[EDIT_POSITION] = new Anchor( EDIT_LABEL, "#"+ ApplicationState.getInstance().getHistoryTokenString( Mode.edit, instance.getEntity(), instance.getInstanceType(), getUpdatedProviderEntity( instance.getEntity() ))); formActions[EDIT_POSITION].setStyleName( LIVE_LINK ); ((Anchor)formActions[EDIT_POSITION]).addClickHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { if(WidgetUtils.clickHasModifiers( event )) { //no-op - let the browser handle } else { //Prevent regular behavior of Anchor event.preventDefault(); ApplicationState.getInstance().updateApplicationState( Mode.edit, instance.getEntity(), instance.getInstanceType(), getUpdatedProviderEntity( instance.getEntity() ) ); } } } ); } else { formActions[EDIT_POSITION] = new Label(""); } }
private void displayResults(final List<EIInstanceMinimal> page, final FlowPanel innerPanel) { innerPanel.clear(); Anchor instanceLink; EIEntity instanceEntity; String displayValue; for (EIInstanceMinimal instance : page) { instanceEntity = instance.getEntity(); displayValue = InstanceWidgetUtils.formatText( instance.getInstanceLabel() ); instanceLink = new Anchor(displayValue, "#" + INSTANCE_PAGE_TOKEN + "?" + URI_KEY + "=" + instanceEntity.getURI().toString()); innerPanel.add( instanceLink ); } }
@Override public void onValueChange(ValueChangeEvent<EIInstanceMinimal> event) { EIInstanceMinimal newValue = event.getValue(); if ( newValue == null || EIInstanceMinimal.NULL_INSTANCE.equals( newValue ) ) { picker.setValue( EIInstanceMinimal.NULL_INSTANCE ); eiInstance.replaceObjectPropertyAllValues(propertyEntity, null ); oldValue = null; return; } if ( hasOldValue() ) { // Replace all possible values eiInstance.replaceObjectPropertyAllValues(propertyEntity, null ); oldValue = null; } if ( !EIInstanceMinimal.NULL_INSTANCE.equals( newValue ) ) { String instanceLabel = newValue.getEntity().getLabel(); List<EIEntity> entityList = getEntitiesByLabel( instanceLabel ); for ( EIEntity entity : entityList ) { eiInstance.addObjectProperty( propertyEntity, entity ); } updateOldValue( newValue.getInstanceURI() ); } }
@Override public void onValueChange(ValueChangeEvent<EIInstanceMinimal> event) { EIInstanceMinimal newValue = event.getValue(); if ( newValue == null || EIInstanceMinimal.NULL_INSTANCE.equals( newValue ) ) { picker.setValue( EIInstanceMinimal.NULL_INSTANCE ); eiInstance.replaceObjectPropertyValue( propertyEntity, getOldValueEIURI(), null ); oldValue = null; return; } if ( hasOldValue() ) { eiInstance.replaceObjectPropertyValue( propertyEntity, getOldValueEIURI(), null ); oldValue = null; } if ( !EIInstanceMinimal.NULL_INSTANCE.equals( newValue ) ) { eiInstance.addObjectProperty( propertyEntity, newValue.getEntity() ); updateOldValue( newValue.getInstanceURI() ); } }
setStyleName( "dtListGridRow" ); final Anchor instanceAnchor = makeRightClickableAnchor( instance.getEntity(), instance.getInstanceType() ); if ( !isNull( instance.getLab() ) && !ApplicationState.getInstance().hasResourceProvider()) { final FlowPanel firstCell = new FlowPanel();