/** Creates a new page of the given type with the given code */ protected Editor createPage(String _type, String _name, String _code) { Editor page = new CodeEditor(ejs, this); page.setName(_name); if (_code != null) page.readString(_code); else page.clear(); return page; }
public void testSerializableToBlob() throws Exception { Book book = new Book(); Editor editor = new Editor(); editor.setName("O'Reilly"); book.setEditor(editor); book.setCode2(new char[] {'r'}); Session s; Transaction tx; s = openSession(); tx = s.beginTransaction(); s.persist(book); tx.commit(); s.close(); s = openSession(); tx = s.beginTransaction(); Book loadedBook = (Book) s.get(Book.class, book.getId()); assertNotNull(loadedBook.getEditor()); assertEquals(book.getEditor().getName(), loadedBook.getEditor().getName()); loadedBook.setEditor(null); tx.commit(); s.close(); s = openSession(); tx = s.beginTransaction(); loadedBook = (Book) s.get(Book.class, book.getId()); assertNull(loadedBook.getEditor()); tx.commit(); s.close(); }
private void renameCurrentPage(String _name) { int index = tabbedPanel.getSelectedIndex(); if (index < 0) return; _name = getUniqueName(_name); // Gonzalo 070128 tabbedPanel.setTitleAt(index, _name); Editor page = pageList.get(index); page.setName(_name); if (!page.isActive()) tabbedPanel.setTitleAt(index, page.getName() + " (D)"); changed = true; }