当前位置: 首页>>代码示例>>Java>>正文


Java MultiViewPerspective类代码示例

本文整理汇总了Java中org.netbeans.core.api.multiview.MultiViewPerspective的典型用法代码示例。如果您正苦于以下问题:Java MultiViewPerspective类的具体用法?Java MultiViewPerspective怎么用?Java MultiViewPerspective使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MultiViewPerspective类属于org.netbeans.core.api.multiview包,在下文中一共展示了MultiViewPerspective类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
/** Perform the action. Sets/unsets maximzed mode. */
 public void actionPerformed(java.awt.event.ActionEvent ev) {
     WindowManager wm = WindowManager.getDefault();
     MultiViewHandler handler = MultiViews.findMultiViewHandler(wm.getRegistry().getActivated());
     if (handler != null) {
         MultiViewPerspective pers = handler.getSelectedPerspective();
         MultiViewPerspective[] all = handler.getPerspectives();
         for (int i = 0; i < all.length; i++) {
             if (pers.getDisplayName().equals(all[i].getDisplayName())) {
                 int newIndex = i != 0 ? i -1 : all.length - 1;
   MultiViewDescription selectedDescr = Accessor.DEFAULT.extractDescription(pers);
   if (selectedDescr instanceof ContextAwareDescription) {
if (((ContextAwareDescription) selectedDescr).isSplitDescription()) {
    newIndex = i > 1 ? i - 2 : all.length - 1;
} else {
    newIndex = i != 0 ? i - 2 : all.length - 2;
}
   }
                 handler.requestActive(all[newIndex]);
   break;
             }
         }
     } else {
         Utilities.disabledActionBeep();
     }
 }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:GetLeftEditorAction.java

示例2: MultiViewModel

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
/**
     * constructor used at deserialization...
     */
    MultiViewModel(MultiViewDescription[] descs, MultiViewDescription defaultDescr, 
                   MultiViewModel.ActionRequestObserverFactory factory, Map<MultiViewDescription, MultiViewElement> existingElements) {
        observerFactory = factory;
        nestedElements = new HashMap<MultiViewDescription, MultiViewElement>();
//        nestedPerspectiveComponents = new HashMap();
        nestedPerspectives = new HashMap<MultiViewDescription,MultiViewPerspective>();
        nestedCallbacks = new HashMap<MultiViewElement, MultiViewElementCallback>();
        shownElements = new HashSet<MultiViewElement>(descs.length + 3);
        descriptions = descs;
        for (int i = 0; i < descriptions.length; i++) {
            MultiViewElement element = existingElements.get(descriptions[i]);
            nestedElements.put(descriptions[i], element);
            nestedPerspectives.put(descriptions[i], Accessor.DEFAULT.createPerspective(descriptions[i]));
            if (element != null) {
                // set the observer..
                MultiViewElementCallback call = factory.createElementCallback(descriptions[i]);
                nestedCallbacks.put(element, call);
                element.setMultiViewCallback(call);
//                nestedPerspectiveComponents.put(descriptions[i], Accessor.DEFAULT.createPersComponent(element));
            }
        }
        currentEditor = (defaultDescr == null || !nestedElements.containsKey(defaultDescr) ? descriptions[0] : defaultDescr);
        group = new BtnGroup();
	groupSplit = new BtnGroup();
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:MultiViewModel.java

示例3: actionPerformed

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
/** Perform the action. Sets/unsets maximzed mode. */
 public void actionPerformed(java.awt.event.ActionEvent ev) {
     WindowManager wm = WindowManager.getDefault();
     MultiViewHandler handler = MultiViews.findMultiViewHandler(wm.getRegistry().getActivated());
     if (handler != null) {
         MultiViewPerspective pers = handler.getSelectedPerspective();
         MultiViewPerspective[] all = handler.getPerspectives();
         for (int i = 0; i < all.length; i++) {
             if (pers.equals(all[i])) {
                 int newIndex = i != all.length  - 1 ? i + 1 : 0;
   MultiViewDescription selectedDescr = Accessor.DEFAULT.extractDescription(pers);
   if (selectedDescr instanceof ContextAwareDescription) {
if (((ContextAwareDescription) selectedDescr).isSplitDescription()) {
    newIndex = i != all.length  - 1 ? i + 2 : 1;
} else {
    newIndex = i != all.length  - 2 ? i + 2 : 0;
}
   }
                 handler.requestActive(all[newIndex]);
   break;
             }
         }
     } else {
         Utilities.disabledActionBeep();
     }
 }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:GetRightEditorAction.java

示例4: propertyChange

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (TopComponent.Registry.PROP_TC_OPENED.equals(evt.getPropertyName())) {
        final Object newValue = evt.getNewValue();
        if (newValue instanceof TopComponent) {
            final TopComponent opened = (TopComponent) newValue;
            final FileObject moduleInfo = findModuleInfo(opened);
            if (moduleInfo != null) {
                final MultiViewHandler multiViewHandler = MultiViews.findMultiViewHandler(opened);
                if (multiViewHandler != null) {
                    final MultiViewPerspective current = multiViewHandler.getSelectedPerspective();
                    multiViewHandler.addMultiViewDescription(
                            new GraphMultiViewDescription(Lookups.fixed(moduleInfo)),
                            -1);
                    multiViewHandler.requestActive(current);
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:Install.java

示例5: activateHistoryTab

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
private boolean activateHistoryTab(final MultiViewHandler handler, final TopComponent tc) {
    if (handler != null) {
        MultiViewPerspective[] perspectives = handler.getPerspectives();
        for (final MultiViewPerspective p : perspectives) {
            if(p.preferredID().equals(HistoryTopComponent.PREFERRED_ID)) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        tc.open();
                        tc.requestActive();
                        handler.requestActive(p);
                    }
                });
                return true;
            } 
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ShowHistoryAction.java

示例6: propertyChange

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (!puDataObject.isChangedFromUI()) {
        // repaint view if the wiew is active and something is changed with elements listed above
        MultiViewPerspective selectedPerspective = dObj.getSelectedPerspective();
        if (selectedPerspective != null && PUDataObject.PREFERRED_ID_DESIGN.equals(selectedPerspective.preferredID())) {
            repaintingTask.schedule(100);
        } else {
            needInit = true;
        }
    }

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:PersistenceToolBarMVElement.java

示例7: getPerspectives

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
MultiViewPerspective[] getPerspectives() {
    MultiViewPerspective[] toReturn = new MultiViewPerspective[descriptions.length];
    for (int i = 0; i < descriptions.length; i++) {
        toReturn[i] = nestedPerspectives.get(descriptions[i]);
    }
    return toReturn;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:MultiViewModel.java

示例8: requestActive

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
public void requestActive(MultiViewPerspective pers) {
    MultiViewDescription desc = Accessor.DEFAULT.extractDescription(pers);
    if (model.getActiveDescription() != desc) {
        tabs.changeActiveManually(desc);
        model.getActiveElement().componentActivated();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:MultiViewPeer.java

示例9: getSubComponents

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
static SubComponent[] getSubComponents( final MultiViewPeer peer ) {
    MultiViewModel model = peer.getModel();
    MultiViewPerspective[] perspectives = model.getPerspectives();
    ArrayList<SubComponent> res = new ArrayList<SubComponent>(perspectives.length);
    for( int i=0; i<perspectives.length; i++ ) {
        final MultiViewPerspective mvp = perspectives[i];
 MultiViewDescription descr = Accessor.DEFAULT.extractDescription(mvp);
        if( descr instanceof ContextAwareDescription ) {
            //don't show split elements unless they're really showing on the screen
            ContextAwareDescription contextDescr = ( ContextAwareDescription ) descr;
            if( contextDescr.isSplitDescription() && !peer.tabs.isShowing( descr ) ) {
                continue;
            }
        }
 Lookup lookup = descr == null ? peer.getLookup() :
  model.getElementForDescription(descr, false) == null ? peer.getLookup() : model.getElementForDescription(descr, false).getLookup();
 boolean showing = peer.tabs.isShowing(descr);
        res.add( new SubComponent( Actions.cutAmpersand(mvp.getDisplayName()), null, new ActionListener() {

            @Override
            public void actionPerformed( ActionEvent e ) {
                peer.getMultiViewHandlerDelegate().requestActive( mvp );
            }
        }, mvp == model.getSelectedPerspective(), lookup, showing ) );
    }
    return res.toArray( new SubComponent[res.size()] );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:MultiViewTopComponent.java

示例10: testMultiViewsCreate

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
public void testMultiViewsCreate() {
       TopComponent mvc = MultiViews.createMultiView("text/figaro", new LP(Lookup.EMPTY));
       assertNotNull("MultiViewComponent created", mvc);
       mvc.open();
       mvc.requestActive();
       
       MultiViewHandler handler = MultiViews.findMultiViewHandler(mvc);
       assertNotNull("Handler found", handler);
       MultiViewPerspective[] arr = handler.getPerspectives();
       assertEquals("Two perspetives found", 2, arr.length);
       assertEquals("Figaro", arr[0].getDisplayName());
       assertEquals("Figaro", arr[1].getDisplayName());
MultiViewDescription description = Accessor.DEFAULT.extractDescription(arr[0]);
assertTrue(description instanceof ContextAwareDescription);
       assertFalse("First one is not for split", ((ContextAwareDescription)description).isSplitDescription());
description = Accessor.DEFAULT.extractDescription(arr[1]);
assertTrue(description instanceof ContextAwareDescription);
       assertTrue("Second one is for split", ((ContextAwareDescription)description).isSplitDescription());

       CloseH.retValue = true;
       MVE.closeState = MultiViewFactory.createUnsafeCloseState("warn", new AbstractAction() {

           @Override
           public void actionPerformed( ActionEvent e ) {
               MVE.closeState = null;
           }
       }, null);
       assertTrue("Closed OK", mvc.close());
       assertNotNull(CloseH.globalElements);
       assertEquals("One handle", 1, CloseH.globalElements.length);
       assertEquals("states are the same", MVE.closeState, CloseH.globalElements[0]);
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:MultiViewProcessorTest.java

示例11: doCheck

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
private void doCheck(TopComponent mvc, InstanceContent ic) {
       assertNotNull("MultiViewComponent cloned", mvc);
       MultiViewHandler handler = MultiViews.findMultiViewHandler(mvc);
       assertNotNull("Handler found", handler);
       MultiViewPerspective[] arr = handler.getPerspectives();
       assertEquals("Two perspetives found", 2, arr.length);
       assertEquals("Contextual", arr[0].getDisplayName());
assertEquals("Contextual", arr[1].getDisplayName());
MultiViewDescription description = Accessor.DEFAULT.extractDescription(arr[0]);
assertTrue(description instanceof ContextAwareDescription);
       assertFalse("First one is not for split", ((ContextAwareDescription)description).isSplitDescription());
description = Accessor.DEFAULT.extractDescription(arr[1]);
assertTrue(description instanceof ContextAwareDescription);
       assertTrue("Second one is for split", ((ContextAwareDescription)description).isSplitDescription());

       assertPersistence("Always", TopComponent.PERSISTENCE_ALWAYS, mvc);
       
       mvc.open();
       mvc.requestActive();
       mvc.requestVisible();
       
       handler.requestActive(arr[0]);
       assertNull("No integer now", mvc.getLookup().lookup(Integer.class));
       ic.add(1);
       assertEquals("1 now", Integer.valueOf(1), mvc.getLookup().lookup(Integer.class));

((MultiViewCloneableTopComponent)mvc).splitComponent(JSplitPane.HORIZONTAL_SPLIT, -1);
handler.requestActive(arr[0]);
ic.remove(1);
       assertNull("No integer now", mvc.getLookup().lookup(Integer.class));
       ic.add(2);
       assertEquals("2 now", Integer.valueOf(2), mvc.getLookup().lookup(Integer.class));
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:MultiViewProcessorTest.java

示例12: testMultiViewsContextCreate

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
public void testMultiViewsContextCreate() {
       InstanceContent ic = new InstanceContent();
       Lookup lookup = new AbstractLookup(ic);
       
       TopComponent mvc = MultiViews.createMultiView("text/context", new LP(lookup));
       assertNotNull("MultiViewComponent created", mvc);
       MultiViewHandler handler = MultiViews.findMultiViewHandler(mvc);
       assertNotNull("Handler found", handler);
       MultiViewPerspective[] arr = handler.getPerspectives();
       assertEquals("Two perspetives found", 2, arr.length);
       assertEquals("Contextual", arr[0].getDisplayName());
assertEquals("Contextual", arr[1].getDisplayName());
MultiViewDescription description = Accessor.DEFAULT.extractDescription(arr[0]);
assertTrue(description instanceof ContextAwareDescription);
       assertFalse("First one is not for split", ((ContextAwareDescription)description).isSplitDescription());
description = Accessor.DEFAULT.extractDescription(arr[1]);
assertTrue(description instanceof ContextAwareDescription);
       assertTrue("Second one is for split", ((ContextAwareDescription)description).isSplitDescription());
       
       mvc.open();
       mvc.requestActive();
       mvc.requestVisible();
       
       handler.requestActive(arr[0]);
       assertNull("No integer now", mvc.getLookup().lookup(Integer.class));
       ic.add(1);
       assertEquals("1 now", Integer.valueOf(1), mvc.getLookup().lookup(Integer.class));

((MultiViewTopComponent)mvc).splitComponent(JSplitPane.HORIZONTAL_SPLIT, -1);
ic.remove(1);
handler.requestActive(arr[1]);
       assertNull("No integer now", mvc.getLookup().lookup(Integer.class));
       ic.add(2);
       assertEquals("2 now", Integer.valueOf(2), mvc.getLookup().lookup(Integer.class));
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:MultiViewProcessorTest.java

示例13: doToolbarCheck

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
private void doToolbarCheck(int select) throws Exception {
    CloneableTopComponent tc = MultiViews.createCloneableMultiView("text/toolbar", this);
    tc.open();
    assertVisible("MultiView visible", tc);
    
    assertEquals("One toolbar exists: " + MVE.allToolbars, 1, MVE.allToolbars.size());
    
    MultiViewHandler handle = MultiViews.findMultiViewHandler(tc);
    final MultiViewPerspective[] perspectives = handle.getPerspectives();
    assertEquals("Four perspectives", 4, perspectives.length);
    handle.requestVisible(perspectives[2]);
    
    assertEquals("two toolbars exist", 2, MVE.allToolbars.size());
    
    for (int i = 0; i < 2; i++) {
        handle.requestVisible(perspectives[i == 0 ? i : i + 1]);
        assertVisible("Toolbar is showing(" + i +")", MVE.allToolbars.get(i));
    }
    
    handle.requestVisible(perspectives[select]);
    
    W waiter = new W();
    editorSettingsPreferences.addPreferenceChangeListener(waiter);
    editorSettingsPreferences.putBoolean("toolbarVisible", false);
    waiter.waitThree();
    
    for (int i = 0; i < 2; i++) {
        handle.requestVisible(perspectives[i == 0 ? i : i + 1]);
        assertFalse("No Toolbar is showing anymore", MVE.allToolbars.get(i).isShowing());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:ToolbarVisibleTest.java

示例14: testLookupProvidersAreConsistent

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
public void testLookupProvidersAreConsistent() throws Exception {
    InstanceContent ic = new InstanceContent();
    Lookup context = new AbstractLookup(ic);

    CloneableEditorSupport ces = createSupport(context);
    ic.add(ces);
    ic.add(10);

    final CloneableTopComponent tc = MultiViews.createCloneableMultiView("text/plaintest", new LP(context));
    final CloneableEditorSupport.Pane p = (CloneableEditorSupport.Pane) tc;
    EventQueue.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            tc.open();
            tc.requestActive();
            p.updateName();
        }
    });

    assertNull("No icon yet", tc.getIcon());
    MultiViewHandler handler = MultiViews.findMultiViewHandler(tc);
    final MultiViewPerspective[] one = handler.getPerspectives();
    assertEquals("Two elements only" + Arrays.asList(one), 2, handler.getPerspectives().length);
    assertEquals("First one is source", "source", one[0].preferredID());
    assertEquals("Second one is also source", "source", one[1].preferredID());
    handler.requestVisible(one[0]);
    
    List<Lookup.Provider> arr = new ArrayList<Provider>();
    findProviders(tc, arr);
    assertEquals("Two providers: " + arr, 2, arr.size());

    assertSame("Both return same lookup", arr.get(0).getLookup(), arr.get(1).getLookup());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:MultiViewEditorElementTest.java

示例15: showArtifactViewer

import org.netbeans.core.api.multiview.MultiViewPerspective; //导入依赖的package包/类
private static void showArtifactViewer(NBVersionInfo info, Artifact artifact, List<ArtifactRepository> repos, String panelHint) {
    ArtifactViewerFactory fact = Lookup.getDefault().lookup(ArtifactViewerFactory.class);
    if (fact == null) {
        Logger.getLogger(ArtifactViewer.class.getName()).info("No implementation of ArtifactViewerFactory available.");
        return;
    }
    Lookup l;
    if (info != null) {
        l = fact.createLookup(info);
    } else {
        l = fact.createLookup(artifact, repos);
    }
    TopComponent tc = fact.createTopComponent(l);
    tc.open();
    tc.requestActive();
    if (panelHint != null) {
        MultiViewHandler hand = MultiViews.findMultiViewHandler(tc);
        if (hand == null) {
            return;
        }
        for (MultiViewPerspective pers : hand.getPerspectives()) {
            if (panelHint.equals(pers.preferredID())) {
                hand.requestVisible(pers);
                return;
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:ArtifactViewer.java


注:本文中的org.netbeans.core.api.multiview.MultiViewPerspective类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。