本文整理汇总了Java中org.netbeans.core.spi.multiview.MultiViewElement类的典型用法代码示例。如果您正苦于以下问题:Java MultiViewElement类的具体用法?Java MultiViewElement怎么用?Java MultiViewElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultiViewElement类属于org.netbeans.core.spi.multiview包,在下文中一共展示了MultiViewElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MultiViewModel
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的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();
}
示例2: addPropertyChangeListeners
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
private void addPropertyChangeListeners() {
if( null != model ) {
for (MultiViewDescription mvd : model.getDescriptions()) {
if( mvd instanceof ContextAwareDescription && ((ContextAwareDescription)mvd).isSplitDescription() )
continue; //#240371 - don't update name from spit elements
MultiViewElement el = model.getElementForDescription( mvd, false );
if (el == null) {
continue;
}
if (el.getVisualRepresentation() instanceof Pane) {
Pane pane = (Pane)el.getVisualRepresentation();
final CloneableTopComponent tc = pane.getComponent();
if (!Arrays.asList(tc.getPropertyChangeListeners()).contains(propListener)) {
tc.addPropertyChangeListener(propListener);
}
}
}
}
}
示例3: updateName
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
public void updateName() {
// is called before setMultiViewDescriptions() need to check for null.
if (model != null) {
for (MultiViewDescription mvd : model.getDescriptions()) {
if( mvd instanceof ContextAwareDescription && ((ContextAwareDescription)mvd).isSplitDescription() )
continue; //#240371 - don't update name from spit elements
MultiViewElement el = model.getElementForDescription(
mvd, MultiViewCloneableTopComponent.isSourceView(mvd)
);
if (el == null) {
continue;
}
if (el.getVisualRepresentation() instanceof Pane) {
Pane pane = (Pane)el.getVisualRepresentation();
pane.updateName();
final CloneableTopComponent tc = pane.getComponent();
peer.setDisplayName(tc.getDisplayName());
peer.setIcon(tc.getIcon());
if (!Arrays.asList(tc.getPropertyChangeListeners()).contains(propListener)) {
tc.addPropertyChangeListener(propListener);
}
}
}
}
}
示例4: createXmlMultiViewElement
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
@MultiViewElement.Registration(
mimeType=PUDataLoader.REQUIRED_MIME,
iconBase=ICON,
persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
preferredID=PREFERRED_ID_SOURCE,
displayName="#CTL_SourceTabCaption",
position=2000
)
@Messages("CTL_SourceTabCaption=Source")
public static XmlMultiViewElement createXmlMultiViewElement(Lookup lookup) {
return new XmlMultiViewElement(lookup.lookup(XmlMultiViewDataObject.class));
}
示例5: createMultiViewEditorElement
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
@MultiViewElement.Registration(
displayName="#CTL_SourceTabCaption",
iconBase="org/apache/tools/ant/module/resources/AntIcon.gif",
persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
preferredID="ant",
mimeType=MIME_TYPE,
position=1
)
@Messages("CTL_SourceTabCaption=&Source")
public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) {
return new MultiViewEditorElement(context);
}
示例6: getCreatedElements
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
/**
* returns all elements that were so far created/instantiated.
*/
synchronized Collection getCreatedElements() {
Collection<MultiViewElement> col = new ArrayList<MultiViewElement>(nestedElements.size());
for (Map.Entry<MultiViewDescription, MultiViewElement> entry : nestedElements.entrySet()) {
if (entry.getValue() != null) {
col.add(entry.getValue());
}
}
return col;
}
示例7: getElementForDescription
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
/**
* used primarily at deserialization time.
*/
synchronized MultiViewElement getElementForDescription(MultiViewDescription description, boolean create) {
MultiViewElement element = nestedElements.get(description);
if (element == null && create) {
element = description.createElement();
MultiViewElementCallback call = observerFactory.createElementCallback(description);
nestedCallbacks.put(element, call);
element.setMultiViewCallback(call);
nestedElements.put(description, element);
// nestedPerspectiveComponents.put(description, Accessor.DEFAULT.createPersComponent(element));
}
return element;
}
示例8: _setMultiViewDescriptions
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
private void _setMultiViewDescriptions(MultiViewDescription[] descriptions, MultiViewDescription defaultDesc) {
Map<MultiViewDescription, MultiViewElement> createdElements = Collections.emptyMap();
if (model != null) {
model.removeElementSelectionListener(selListener);
createdElements = model.getCreatedElementsMap();
}
model = new MultiViewModel(descriptions, defaultDesc, factory, createdElements);
model.addElementSelectionListener(selListener);
tabs.setModel(model);
}
示例9: setDeserializedMultiViewDescriptions
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
void setDeserializedMultiViewDescriptions(int splitOrientation, MultiViewDescription[] descriptions,
MultiViewDescription defaultDesc, MultiViewDescription defaultDescSplit, Map<MultiViewDescription, MultiViewElement> existingElements) {
if (model != null) {
model.removeElementSelectionListener(selListener);
}
// if Design view was active before closing, set default to Source view
if( splitOrientation != -1 )
defaultDescSplit = defaultDescSplit.getDisplayName().startsWith("&Design") ? descriptions[1] : defaultDescSplit; //NOI18N
model = new MultiViewModel(descriptions, defaultDesc, factory, existingElements);
model.addElementSelectionListener(selListener);
tabs.setModel(model);
this.initialSplitOrientation = splitOrientation;
this.initialSplitDescription = defaultDescSplit;
}
示例10: assignLookup
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
final void assignLookup(MultiViewTopComponentLookup lkp) {
if (lkp.isInitialized()) {
return;
}
final MultiViewElement el = getModel().getActiveElement();
if (el != null) {
assignLookup(el, lkp);
}
}
示例11: peerComponentClosed
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
void peerComponentClosed() {
Iterator it = model.getCreatedElements().iterator();
while (it.hasNext()) {
MultiViewElement el = (MultiViewElement)it.next();
model.markAsHidden(el);
el.componentClosed();
}
tabs.peerComponentClosed();
}
示例12: getEditorPane
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
JEditorPane getEditorPane() {
if (model != null) {
MultiViewElement el = model.getActiveElement();
if (el != null && el.getVisualRepresentation() instanceof Pane) {
Pane pane = (Pane)el.getVisualRepresentation();
return pane.getEditorPane();
}
}
return null;
}
示例13: selectionChanged
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
public void selectionChanged(MultiViewDescription oldOne, MultiViewDescription newOne) {
if (isActivated()) {
MultiViewElement el = model.getElementForDescription(oldOne);
el.componentDeactivated();
}
hideElement(oldOne);
showCurrentElement();
delegateUndoRedo.updateListeners(model.getElementForDescription(oldOne),
model.getElementForDescription(newOne));
}
示例14: updateListeners
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
void updateListeners(MultiViewElement old, MultiViewElement fresh) {
Iterator it = listeners.iterator();
while (it.hasNext()) {
ChangeListener elem = (ChangeListener) it.next();
if (old.getUndoRedo() != null) {
old.getUndoRedo().removeChangeListener(elem);
}
if (fresh.getUndoRedo() != null) {
fresh.getUndoRedo().addChangeListener(elem);
}
}
fireElementChange();
}
示例15: getEditorPane
import org.netbeans.core.spi.multiview.MultiViewElement; //导入依赖的package包/类
public javax.swing.JEditorPane getEditorPane() {
if (peer == null || peer.model == null) {
return null;
}
MultiViewElement paneEl = findPaneElement();
if (paneEl != null) {
CloneableEditorSupport.Pane pane = (CloneableEditorSupport.Pane)paneEl.getVisualRepresentation();
return pane.getEditorPane();
}
// hopeless case, don't try to create new elements. it's users responsibility to
// switch to the editor element before getEditorPane()
return null;
}