diff options
Diffstat (limited to 'odk/examples/DevelopersGuide')
-rw-r--r-- | odk/examples/DevelopersGuide/Database/Sales.java | 44 | ||||
-rw-r--r-- | odk/examples/DevelopersGuide/Forms/HsqlDatabase.java | 18 | ||||
-rw-r--r-- | odk/examples/DevelopersGuide/GUI/UnoDialogSample.java | 21 |
3 files changed, 0 insertions, 83 deletions
diff --git a/odk/examples/DevelopersGuide/Database/Sales.java b/odk/examples/DevelopersGuide/Database/Sales.java index ff1ec6555761..7a983c727ec9 100644 --- a/odk/examples/DevelopersGuide/Database/Sales.java +++ b/odk/examples/DevelopersGuide/Database/Sales.java @@ -33,7 +33,6 @@ *************************************************************************/ import com.sun.star.uno.*; -import com.sun.star.util.Date; import com.sun.star.beans.XPropertySet; import com.sun.star.sdbc.*; @@ -108,49 +107,6 @@ public class Sales - // inserts a row programmatically. - private void insertRow() throws com.sun.star.uno.Exception - { - // example for a programmatic way to do updates. - XStatement stmt = con.createStatement(); - XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt); - xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE)); - xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE)); - XResultSet rs = stmt.executeQuery("SELECT * FROM SALES"); - XRow row = UnoRuntime.queryInterface(XRow.class,rs); - - // insert a new row - XRowUpdate updateRow = UnoRuntime.queryInterface(XRowUpdate.class,rs); - XResultSetUpdate updateRs = UnoRuntime. queryInterface(XResultSetUpdate.class,rs); - updateRs.moveToInsertRow(); - updateRow.updateInt(1, 4); - updateRow.updateInt(2, 102); - updateRow.updateInt(3, 5); - updateRow.updateString(4, "FTOP Darjeeling tea"); - updateRow.updateDate(5, new Date((short)1,(short)2,(short)2002)); - updateRow.updateFloat(6, 150); - updateRs.insertRow(); - } - - // deletes a row programmatically. - private void deleteRow() throws com.sun.star.uno.Exception - { - // example for a programmatic way to do updates. - XStatement stmt = con.createStatement(); - XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt); - xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE)); - xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE)); - XResultSet rs = stmt.executeQuery("SELECT * FROM SALES"); - XRow row = UnoRuntime.queryInterface(XRow.class,rs); - - XResultSetUpdate updateRs = UnoRuntime. queryInterface(XResultSetUpdate.class,rs); - // move to the inserted row - rs.absolute(4); - updateRs.deleteRow(); - } - - - // displays the column names public void displayColumnNames() throws com.sun.star.uno.Exception { diff --git a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java index 8350c9291690..311908d313dc 100644 --- a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java +++ b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java @@ -89,24 +89,6 @@ public class HsqlDatabase storable.storeAsURL( m_databaseDocumentFile, new PropertyValue[]{} ); } - /** returns a connection to the database - * - * Multiple calls to this method return the same connection. The HsqlDatabase object keeps - * the ownership of the connection, so you don't need to (and should not) dispose/close it. - * - */ - private XConnection defaultConnection() throws SQLException - { - if ( m_connection != null ) - return m_connection; - m_connection = m_databaseDocument.getDataSource().getConnection(new String(),new String()); - return m_connection; - } - - - - - /** closes the database document * * Any CloseVetoExceptions fired by third parties are ignored, and any reference to the diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java index 5bf285392333..3c52f56fd10e 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java @@ -70,10 +70,8 @@ import com.sun.star.awt.XToolkit; import com.sun.star.awt.XTopWindow; import com.sun.star.awt.XWindow; import com.sun.star.awt.XWindowPeer; -import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XMultiPropertySet; import com.sun.star.beans.XPropertySet; -import com.sun.star.configuration.theDefaultProvider; import com.sun.star.container.XIndexContainer; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; @@ -184,25 +182,6 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } - private XNameAccess getRegistryKeyContent(String _sKeyName){ - try { - PropertyValue[] aNodePath = new PropertyValue[1]; - XMultiServiceFactory xMSFConfig = theDefaultProvider.get(m_xContext); - aNodePath[0] = new PropertyValue(); - aNodePath[0].Name = "nodepath"; - aNodePath[0].Value = _sKeyName; - Object oNode = xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath); - XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oNode); - return xNameAccess; - } catch (Exception exception) { - exception.printStackTrace(System.err); - return null; - } - } - - - - protected void createDialog(XMultiComponentFactory _xMCF) { try { Object oDialogModel = _xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", m_xContext); |