Search in sources :

Example 11 with PerspectiveId

use of edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId in project webprotege by protegeproject.

the class ProjectViewPlaceTokenizer method getPlace.

public ProjectViewPlace getPlace(String token) {
    GWT.log("[ProjectViewPlaceTokenizer] Parsing: " + token);
    token = URL.decode(token);
    GWT.log("[ProjectViewPlaceTokenizer] Decoded: " + token);
    MatchResult result = regExp.exec(token);
    GWT.log("[ProjectViewPlaceTokenizer] MatchResult: " + result);
    String projectId = result.getGroup(1);
    String perspectiveId = result.getGroup(2);
    String selectionString = result.getGroup(4);
    GWT.log("[ProjectViewPlaceTokenizer] Parsed: ProjectId: " + projectId);
    GWT.log("[ProjectViewPlaceTokenizer] Parsed: PerspectiveId: " + perspectiveId);
    GWT.log("[ProjectViewPlaceTokenizer] Parsed: Selection: " + selectionString);
    ProjectViewPlace.Builder builder = new ProjectViewPlace.Builder(ProjectId.get(projectId), new PerspectiveId(perspectiveId));
    if (selectionString != null) {
        ItemTokenizer tokenizer = new ItemTokenizer();
        List<ItemToken> tokenList = tokenizer.parseTokens(selectionString);
        for (ItemToken t : tokenList) {
            OWLDataFactoryImpl dataFactory = new OWLDataFactoryImpl();
            ItemTokenParser parser = new ItemTokenParser();
            DefaultPrefixManager prefixManager = new DefaultPrefixManager();
            prefixManager.setPrefix("owl:", Namespaces.OWL.getPrefixIRI());
            List<Item<?>> entity = parser.parse(t, new DefaultItemTypeMapper(dataFactory, prefixManager));
            for (Item<?> item : entity) {
                builder.withSelectedItem(item);
            }
        }
    }
    return builder.build();
}
Also used : DefaultPrefixManager(org.semanticweb.owlapi.util.DefaultPrefixManager) PerspectiveId(edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId) MatchResult(com.google.gwt.regexp.shared.MatchResult) OWLDataFactoryImpl(uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl)

Example 12 with PerspectiveId

use of edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId in project webprotege by protegeproject.

the class PlaceUrl_TestCase method setUp.

@Before
public void setUp() throws Exception {
    when(typeMapper.getPerspectiveId(Matchers.any())).thenReturn(new PerspectiveId("TheClassPerspective"));
    when(typeMapper.getDefaultPerspectiveId()).thenReturn(new PerspectiveId("TheDefaultPerspective"));
    when(hostProvider.get()).thenReturn(THE_APPLICATION_HOST);
    when(portProvider.get()).thenReturn(Optional.empty());
    when(pathProvider.get()).thenReturn(THE_APPLICATION_PATH);
    when(appNameProvider.get()).thenReturn(THE_APPLICATION_NAME);
    when(schemeProvider.get()).thenReturn(ApplicationScheme.HTTPS);
    placeUrl = new PlaceUrl(schemeProvider, hostProvider, portProvider, pathProvider, appNameProvider, typeMapper);
}
Also used : PerspectiveId(edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId) Before(org.junit.Before)

Aggregations

PerspectiveId (edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId)12 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)3 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)3 Nonnull (javax.annotation.Nonnull)3 PerspectiveLayout (edu.stanford.bmir.protege.web.shared.perspective.PerspectiveLayout)2 Place (com.google.gwt.place.shared.Place)1 MatchResult (com.google.gwt.regexp.shared.MatchResult)1 UiHandler (com.google.gwt.uibinder.client.UiHandler)1 AbstractUiAction (edu.stanford.bmir.protege.web.client.action.AbstractUiAction)1 PopupMenu (edu.stanford.bmir.protege.web.client.library.popupmenu.PopupMenu)1 GetPerspectiveLayoutResult (edu.stanford.bmir.protege.web.shared.perspective.GetPerspectiveLayoutResult)1 GetPerspectivesResult (edu.stanford.bmir.protege.web.shared.perspective.GetPerspectivesResult)1 ResetPerspectiveLayoutResult (edu.stanford.bmir.protege.web.shared.perspective.ResetPerspectiveLayoutResult)1 ProjectViewPlace (edu.stanford.bmir.protege.web.shared.place.ProjectViewPlace)1 Before (org.junit.Before)1 DefaultPrefixManager (org.semanticweb.owlapi.util.DefaultPrefixManager)1 OWLDataFactoryImpl (uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl)1