本文整理汇总了Java中org.openide.util.io.NbMarshalledObject.get方法的典型用法代码示例。如果您正苦于以下问题:Java NbMarshalledObject.get方法的具体用法?Java NbMarshalledObject.get怎么用?Java NbMarshalledObject.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.util.io.NbMarshalledObject
的用法示例。
在下文中一共展示了NbMarshalledObject.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSerializeAndDeserialize
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void testSerializeAndDeserialize() throws Exception {
InstanceContent ic = new InstanceContent();
Lookup context = new AbstractLookup(ic);
CloneableEditorSupport ces = createSupport(context);
ic.add(ces);
ic.add(10);
MultiViewEditorElement mvee = new MultiViewEditorElement(context);
assertEquals("ces", ces, mvee.getLookup().lookup(CloneableEditorSupport.class));
assertEquals("ten", Integer.valueOf(10), mvee.getLookup().lookup(Integer.class));
NbMarshalledObject mar = new NbMarshalledObject(mvee);
MultiViewEditorElement deser = (MultiViewEditorElement)mar.get();
assertEquals("ten", Integer.valueOf(10), deser.getLookup().lookup(Integer.class));
assertEquals("ces", ces, deser.getLookup().lookup(CloneableEditorSupport.class));
}
示例2: testGetOpenedPanesWorksAfterDeserializationIssue39236
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void testGetOpenedPanesWorksAfterDeserializationIssue39236 () throws Exception {
support.open ();
CloneableEditor ed = (CloneableEditor)support.getRef ().getAnyComponent ();
JEditorPane[] panes = support.getOpenedPanes ();
assertNotNull (panes);
assertEquals ("One is there", 1, panes.length);
NbMarshalledObject obj = new NbMarshalledObject (ed);
ed.close ();
panes = support.getOpenedPanes ();
assertNull ("No panes anymore", panes);
ed = (CloneableEditor)obj.get ();
panes = support.getOpenedPanes ();
assertNotNull ("One again", panes);
assertEquals ("One is there again", 1, panes.length);
}
示例3: testGlobalStateOnDeserializedPanel
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void testGlobalStateOnDeserializedPanel () throws Exception {
EP panel = new EP (null);
ExplorerPanel.setConfirmDelete(false);
setupExplorerManager (panel.getExplorerManager());
NbMarshalledObject mar = new NbMarshalledObject (panel);
Object obj = mar.get ();
EP deserializedPanel = (EP) obj;
// activate the actions
ActionsInfraHid.UT.setActivated (deserializedPanel);
deserializedPanel.componentActivated();
ActionsInfraHid.UT.setCurrentNodes (deserializedPanel.getExplorerManager().getRootContext ().getChildren ().getNodes ());
// deletes without asking a question, if the question appears something
// is wrong
delete.actionPerformed(new java.awt.event.ActionEvent (this, 0, ""));
}
示例4: skipForNowtestSelectedNodesInDeserializedPanel
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void skipForNowtestSelectedNodesInDeserializedPanel () throws Exception {
ExplorerPanel panel = new ExplorerPanel ();
FileObject fo = FileUtil.getConfigRoot();
Node root = new SerializableNode ();
panel.getExplorerManager ().setRootContext (root);
panel.getExplorerManager ().setSelectedNodes (new Node[] {root});
assertNotNull ("Array of selected nodes is not null.", panel.getExplorerManager ().getSelectedNodes ());
assertFalse ("Array of selected nodes is not empty.", panel.getExplorerManager ().getSelectedNodes ().length == 0);
assertEquals ("The selected node is Filesystems root.", panel.getExplorerManager ().getSelectedNodes ()[0], root);
NbMarshalledObject mar = new NbMarshalledObject (panel);
Object obj = mar.get ();
ExplorerPanel deserializedPanel = (ExplorerPanel) obj;
assertNotNull ("Deserialized panel is not null.", deserializedPanel);
assertNotNull ("[Deserialized panel] Array of selected nodes is not null.", deserializedPanel.getExplorerManager ().getSelectedNodes ());
assertFalse ("[Deserialized panel] Array of selected nodes is not empty.", deserializedPanel.getExplorerManager ().getSelectedNodes ().length == 0);
assertEquals ("[Deserialized panel] The selected node is Filesystems root.", deserializedPanel.getExplorerManager ().getSelectedNodes ()[0], root);
}
示例5: testDeserAndGC
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void testDeserAndGC() throws Exception {
MyCOS cos = MyCOS.find("test1");
CloneableTopComponent ctc = cos.openCloneableTopComponent();
assertEquals("Associated", cos.allEditors, ctc.getReference());
NbMarshalledObject mar = new NbMarshalledObject(ctc);
Reference<MyCOS> first = new WeakReference<MyCOS>(cos);
cos = null;
assertTrue("Closed", ctc.close());
ctc = null;
assertGC("Can GC away", first);
CloneableTopComponent newCtc = (CloneableTopComponent)mar.get();
Ref newRef = newCtc.getReference();
MyCOS newOne = MyCOS.find("test1");
assertEquals("Just two created", 2, MyCOS.cnt);
assertEquals("Associated 2", newOne.allEditors, newRef);
}
示例6: testSerialization
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void testSerialization() throws Exception {
ListenerList<MyL> ll = new ListenerList<MyL>();
ll.add(new MyL());
ll.add(new MyL());
ll.add(new MyL());
NbMarshalledObject mo = new NbMarshalledObject(ll);
@SuppressWarnings("unchecked")
ListenerList<MyL> sll = (ListenerList<MyL>)mo.get();
List<MyL> lla = ll.getListeners();
List<MyL> slla = sll.getListeners();
assertEquals(lla.size(), slla.size());
for (int i = lla.size() - 1; i >= 0; i--) {
assertEquals(lla.get(i), slla.get(i));
}
}
示例7: readExternal
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
@Override
public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException {
super.readExternal(oi);
final NbMarshalledObject readObject = (NbMarshalledObject) oi.readObject();
if (readObject != null) {
try {
Object[] state = (Object[]) readObject.get();
if (state != null && state.length > 0) {
Integer dividerLocation = (Integer) state[0];
if (dividerLocation != null) {
this.splitPane.setDividerLocation(dividerLocation.intValue());
}
}
} catch (Exception e) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
}
}
}
示例8: readExternal
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException {
super.readExternal(oi);
final NbMarshalledObject readObject =(NbMarshalledObject)oi.readObject();
if (readObject != null) {
try {
Object[] state = (Object[])readObject.get();
if (state != null && state.length > 0) {
this.getKeyStoreBean().setName( (String)state[0] );
}
if (state != null && state.length > 1) {
this.aliasesSplitPane.setDividerLocation( ((Integer)state[1]).intValue() );
}
if (state != null && state.length > 2) {
KeyStoreBeanHistory newKsbh = (KeyStoreBeanHistory)state[2];
setKeyStoreBeanHistory( newKsbh );
}
} catch (Exception e) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
}
}
}
示例9: readExternal
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
@Override
public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException {
super.readExternal(oi);
final NbMarshalledObject readObject =(NbMarshalledObject)oi.readObject();
if (readObject != null) {
try {
Object[] state = (Object[])readObject.get();
if (state == null) {
return ;
}
final int stateLength = state.length;
if (stateLength > 0 && state[0] instanceof Integer) {
int dividerLocation = ((Integer)state[0]);
this.splitPane.setDividerLocation( dividerLocation );
}
} catch (Exception e) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
}
}
}
示例10: readExternal
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
@Override
public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException {
super.readExternal(oi);
final NbMarshalledObject readObject = (NbMarshalledObject) oi.readObject();
if (readObject != null) {
try {
final Object[] state = (Object[]) readObject.get();
final String newFreeCharacters = (String) state[0];
final Integer newNumberOfCharacters = (Integer) state[1];
if (state.length > 0) {
this.randomPasswordPanel.setFreeCharacters(newFreeCharacters);
this.randomPasswordPanel.setNumberOfCharacters(newNumberOfCharacters);
}
} catch (Exception e) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
}
}
}
示例11: testCloneableMultiViewsSerialize
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void testCloneableMultiViewsSerialize() throws Exception {
InstanceContent ic = new InstanceContent();
Lookup lookup = new AbstractLookup(ic);
CloneableTopComponent cmv = MultiViews.createCloneableMultiView("text/context", new LP(lookup));
assertPersistence("Always", TopComponent.PERSISTENCE_ALWAYS, cmv);
assertNotNull("MultiViewComponent created", cmv);
NbMarshalledObject mar = new NbMarshalledObject(cmv);
TopComponent mvc = (TopComponent) mar.get();
doCheck(mvc, ic);
}
示例12: testGetOpenedPanesWorksAfterDeserializationIssue39236
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void testGetOpenedPanesWorksAfterDeserializationIssue39236 () throws Exception {
support.open ();
CloneableEditor ed = (CloneableEditor)support.getRef ().getAnyComponent ();
ic.add(20);
assertEquals("twenty", Integer.valueOf(20), ed.getLookup().lookup(Integer.class));
ic.remove(20);
assertNull("no twenty", ed.getLookup().lookup(Integer.class));
JEditorPane[] panes = support.getOpenedPanes ();
assertNotNull (panes);
assertEquals ("One is there", 1, panes.length);
NbMarshalledObject obj = new NbMarshalledObject (ed);
ed.close ();
panes = support.getOpenedPanes ();
assertNull ("No panes anymore", panes);
ed = (CloneableEditor)obj.get ();
panes = support.getOpenedPanes ();
assertNotNull ("One again", panes);
assertEquals ("One is there again", 1, panes.length);
ic.add(10);
assertEquals("ten", Integer.valueOf(10), ed.getLookup().lookup(Integer.class));
}
示例13: testSerialization
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void testSerialization() throws Exception {
PriorityListenerList<EventListener> ll = new PriorityListenerList<EventListener>();
ll.add(new L(), 3);
ll.add(new L(), 1);
ll.add(new L(), 1);
NbMarshalledObject mo = new NbMarshalledObject(ll);
PriorityListenerList sll = (PriorityListenerList)mo.get();
EventListener[][] lla = ll.getListenersArray();
EventListener[][] slla = sll.getListenersArray();
assertEquals(lla.length, slla.length);
for (int priority = lla.length - 1; priority >= 0; priority--) {
assertEquals(lla[priority].length, slla[priority].length);
}
}
示例14: readExternal
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException {
super.readExternal(oi);
final NbMarshalledObject readObject = (NbMarshalledObject) oi.readObject();
if (readObject != null) {
final Runnable r = new Runnable() {
public void run() {
try {
Object[] state = (Object[]) readObject.get();
if (state.length >= 3) {
LocaleTopComponent.this.formatCommands[0].setState(state[0]);
LocaleTopComponent.this.formatCommands[1].setState(state[1]);
LocaleTopComponent.this.formatCommands[2].setState(state[2]);
}
if (state.length >= 4 && state[3] instanceof Locale) {
final Locale locale = (Locale) state[3];
LocaleTopComponent.this.localeComboBox.setSelectedItem(locale);
}
if (state.length >= 5 && state[4] instanceof Integer) {
final Integer selectedTabIndex = (Integer) state[4];
int componentCount = LocaleTopComponent.this.localeTabbedPane.getComponentCount();
if (selectedTabIndex >= 0 && selectedTabIndex < componentCount) {
LocaleTopComponent.this.localeTabbedPane.setSelectedIndex(selectedTabIndex);
}
}
} catch (Exception e) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
}
}
};
SwingUtilities.invokeLater(r);
}
}
示例15: readExternal
import org.openide.util.io.NbMarshalledObject; //导入方法依赖的package包/类
public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException {
super.readExternal(oi);
final NbMarshalledObject readObject =(NbMarshalledObject)oi.readObject();
if (readObject != null) {
try {
Object[] state = (Object[])readObject.get();
final DigestActionCommand dac = (DigestActionCommand)state[0];
this.digestPanel.setDigestActionCommand( dac );
} catch (Exception e) {
ErrorManager.getDefault().notify(ErrorManager.WARNING, e);
}
}
}