@Override public boolean isAddedInstanceEntity(final EIEntity entity) { for (final EIInstance inner : newInnerInstances) { if ( inner.getEntity().equals( entity ) ) { return true; } } return false; }
@Override public EIInstance getAddedInstance(final EIEntity entity) { for (final EIInstance inner : newInnerInstances) { if ( inner.getEntity().equals( entity ) ) { return inner; } } return EIInstance.NULL_INSTANCE; } }
@Override public void addValue(final EIInstance instance, final EIEntity propertyEntity, final String newValue) { instance.getEntity().setLabel( newValue ); } } );
@Override public void replaceValue(final EIInstance instance, final EIEntity propertyEntity, final String oldValue, final String newValue) { instance.getEntity().setLabel( newValue ); }
private boolean isDuplicate(final EIInstance instance, final EIInstance otherInstance) { if ( instance == otherInstance || instance.getEntity().equals( otherInstance.getEntity() ) ) { return false; // not a duplicate of itself } // duplicate if type & label are identical return instance.getInstanceType().equals( otherInstance.getInstanceType() ) && instance.getInstanceLabel().equals( otherInstance.getInstanceLabel() ); }
@Override public void onSuccess(final EIInstance eiInstance) { if ( eiInstance != null && !EIInstance.NULL_INSTANCE.equals( eiInstance ) ) { final EIEntity providerEntity = ResourceProvider.getProperResourceProviderEntity( eiInstance ); ApplicationState.getInstance().updateApplicationState( Mode.view, eiInstance.getEntity(), eiInstance.getInstanceType(), providerEntity ); } } } );
public static EIEntity getProperResourceProviderEntity(final EIInstance instance) { EIEntity result = EIEntity.NULL_ENTITY; if ( ResourceProvider.isResourceProviderType( instance.getInstanceType() ) ) { result = instance.getEntity(); } else if ( ApplicationState.getInstance().getResourceProviderEntity() != instance.getEntity() ) { result = ApplicationState.getInstance().getResourceProviderEntity(); } return result; }
@Override public void onClick(ClickEvent event) { final String eventLabel = eiInstance.getEntity().getURI().toString(); if ( hasExchangeFacilitator ) { Window.alert( EXCHANGE_FACILITATOR_MESSAGE ); } contactPanel.focus(); } };
@Override public void onSuccess(final EIInstance newInstance) { listener.onInstanceAdded( newInstance ); newInstance.addNonOntologyLiteralProperty( SweetUIConstants.isStubEntity, "True" ); if ( hasOldValue() ) { eiInstance.replaceObjectPropertyValue( propertyEntity, EIURI.create( oldValue ), newInstance.getEntity() ); } else { eiInstance.addObjectProperty( propertyEntity, newInstance.getEntity() ); } updateOldValue( newInstance.getInstanceURI() ); addStubWidget( range, propertyEntity, newInstance ); } } );
@Override public void onClick(final ClickEvent arg0) { ApplicationState.getInstance().setReferencesView(true); ApplicationState.getInstance().updateApplicationState( Mode.list, instance.getEntity(), EIEntity.NULL_ENTITY, EIEntity.NULL_ENTITY ); }
@Override public void drawAfterSave(final EIInstance instance) { ApplicationState.getInstance().updateResourceProviderCache(); final EIEntity providerEntity = ResourceProvider.getProperResourceProviderEntity( instance ); ApplicationState.getInstance().updateApplicationState( Mode.view, instance.getEntity(), instance.getInstanceType(), providerEntity ); }
@Override public void onSuccess(final EIInstance eiInstance) { ApplicationState.getInstance().updateApplicationState( Mode.duplicate, eiInstance.getEntity(), eiInstance.getInstanceType(), ApplicationState.getInstance().getResourceProviderEntity() ); listener.showData( generateDuplicateForm( eiInstance ) ); // Note: app state is set in a way that does NOT trigger a re-draw. NOBODY // else should use Mode.duplicate, or respond to it } } );
public void createAndReleaseInstance(final EIInstance instance, final RootAsyncCallback<EIInstance> callback) { log.debug( "creating and releasing instance " + instance.getEntity() + " with type " + instance.getInstanceClass() ); repositoryService.createAndReleaseInstance( securityProxy.getSessionId(), instance, ApplicationState.getInstance().getWorkspaceEntity(), new AsyncCallback<Void>() { @Override public void onFailure(final Throwable caught) { callback.onFailure( caught ); } @Override public void onSuccess(final Void result) { log.debug( "creation succeeded" ); instance.setWFState( WorkflowState.DRAFT.getEntity() ); callback.onSuccess( instance ); } } ); }
private void configureStandardContactButton(String buttonText, Anchor contactButton, ResourceFacet facet) { contactButton.setText( buttonText ); final Anchor anchor = new Anchor(); anchor.setName( "contactPanel" ); formPanel.add( anchor ); final BasicContactPanel contactPanel = new BasicContactPanel( eiInstance.getEntity(), facet ); formPanel.add( contactPanel ); contactButton.addClickHandler( createContactButtonHandler(contactPanel) ); }
/** * @return */ private void configureTributaryContactButton(String buttonText, Anchor contactButton) { contactButton.setText( buttonText ); final Anchor anchor = new Anchor(); anchor.setName( "contactPanel" ); formPanel.add( anchor ); final TributaryContactPanel contactPanel = new TributaryContactPanel( eiInstance.getEntity() ); formPanel.add( contactPanel ); contactButton.addClickHandler( createContactButtonHandler(contactPanel) ); }
@Override public void drawAfterSave(final EIInstance instance) { if ( ResourceProvider.isResourceProviderType( instance.getInstanceType() ) ) { log.debug( "updating resource provider cache" ); ApplicationState.getInstance().updateResourceProviderCache(); } final EIEntity providerEntity = ResourceProvider.getProperResourceProviderEntity( instance ); ApplicationState.getInstance().updateApplicationState( Mode.view, instance.getEntity(), instance.getInstanceType(), providerEntity ); }
@Override public void onClick(final ClickEvent event) { SearchResourceAnalytics resourceAnalytics = new SearchResourceAnalytics(eiInstance); SearchCitationAnalytics citationAnalytics = new SearchCitationAnalytics(resourceAnalytics); SearchApplicationController.recordAnalyticsEvent(citationAnalytics.toString(), citationAnalytics.getResourceFragment()); final CitationPanel panel = new CitationPanel(eiInstance.getEntity().getURI().toString()); panel.showPopup(); } };
private EIInstanceMinimal(final EIInstance instance) { super( instance.getEntity() ); instanceType = instance.getInstanceType(); created = instance.getCreationDate(); modified = instance.getModificationDate(); // skip for now - we're not using it // this.otherEITypes; owner = isNull( instance.getWFOwner() ) ? EIEntity.NULL_ENTITY : instance.getWFOwner(); WFState = isNull( instance.getWFState() ) ? EIEntity.NULL_ENTITY : instance.getWFState(); }
public FlowPanel generateDuplicateForm(final EIInstance instance) { final FlowPanel vp = new FlowPanel(); vp.setStyleName( "formPanel" ); final InstancePanel formsPanel = InstanceEditPanel.createNewForm( instance, getNewFormRedisplay() ); //We are duplicating a resource provider record; update app state to clear left nav if(ResourceProvider.isResourceProviderType( instance.getEntity() )) { ApplicationState.getInstance().updateFromEIInstance( EIEntity.NULL_ENTITY, instance.getInstanceType() ); } vp.add( formsPanel ); return vp; }
public void viewAfterSave(final boolean showSuccessMsg, final EIInstance instance) { listener.clearDataPanel(); if ( showSuccessMsg ) { final HTML msg = new HTML( "<font color='green'>" + UIMessages.SAVE_SUCCESS + "</font>" ); listener.showData( msg ); } ApplicationState.getInstance().updateApplicationState( Mode.view, instance.getEntity(), ApplicationState.getInstance().getTypeEntity(), ApplicationState.getInstance().getResourceProviderEntity().equals(EIEntity.NULL_ENTITY)?ResourceProvider.getProperResourceProviderEntity(instance):ApplicationState.getInstance().getResourceProviderEntity() ); }