You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/01/27 02:29:58 UTC
svn commit: r1236486 [29/43] - in
/incubator/ooo/devtools/netbeansintegration: ./ build/
build/public-package-jars/ javahelp/ javahelp/org/ javahelp/org/openoffice/
javahelp/org/openoffice/extensions/
javahelp/org/openoffice/extensions/docs/ javahelp/o...
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ExceptionDataTypePanel.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ExceptionDataTypePanel.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ExceptionDataTypePanel.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ExceptionDataTypePanel.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ExceptionDataTypePanel.java,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: sg $ $Date: 2007/08/15 13:45:12 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.projecttemplates.component.dialogs;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.MissingResourceException;
+import javax.swing.JPanel;
+import org.openide.explorer.ExplorerManager;
+import org.openide.explorer.propertysheet.PropertySheet;
+import org.openide.nodes.Node;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.component.*;
+import org.openoffice.extensions.projecttemplates.component.datamodel.types.node.IdlTypeTreeCreator;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.FunctionException;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException;
+
+/**
+ *
+ * @author sg128468
+ */
+public class ExceptionDataTypePanel extends JPanel
+ implements ExplorerManager.Provider, PropertyChangeListener {
+
+ private ExplorerManager manager = new ExplorerManager();
+
+ private ChangeEventPanel panel;
+ private Node node;
+
+ private String oldName;
+ private boolean edit;
+ private ComponentActions actions;
+
+ private ValidateDataType dialog;
+
+ /**
+ * Creates new form InterfaceDataTypeDialog
+ */
+// public ExceptionDataTypePanel(java.awt.Frame parent, Component component,
+// ChangeEventPanel panel, boolean modal, Node object, boolean edit) {
+ public ExceptionDataTypePanel(ValidateDataType dialog, DialogProperties props) {
+ initComponents();
+
+ this.edit = props.getBooleanProperty(props.EDIT);
+ String pkgName = props.getStringProperty(props.PKG);
+ String name = props.getStringProperty(props.NAME);
+ panel = (ChangeEventPanel)props.getProperty(props.PANEL);
+ this.actions = new ComponentActions(manager, panel);
+ this.dialog = dialog;
+
+ if (edit) {
+ node = (Node)props.getProperty(props.NODE);
+ NbNodeObject ob = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ oldName = ob.getDisplayName();
+ }
+ else {
+ if (name == null) name = "Exception"; // NOI18N
+ node = (Node)IdlTypeTreeCreator.createInitialException(name, pkgName);
+ }
+ manager.setRootContext(node);
+
+ PropertySheet propSheet = (PropertySheet)jPanel1;
+ propSheet.setNodes(new Node[]{node});
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ jPanel1 = new PropertySheet();
+
+ setBackground(new java.awt.Color(238, 238, 238));
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ public ExplorerManager getExplorerManager() {
+ return this.manager;
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ valid();
+// panel.fireChangeEvent(); // Notify that the panel changed
+ }
+
+ private void valid() {
+ NbNodeObject ob = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ FunctionException exc = (FunctionException)ob;
+ try {
+ if (exc.getSimpleProperty(exc.PROPERTY_CONTAINER_NAME).length() == 0
+ || exc.getSimpleProperty(exc.PROPERTY_CONTAINER_PACKAGE).length() == 0) {
+ dialog.setEnableError(true,
+ NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Error_Name"));
+ return;
+ }
+ } catch (UnknownOpenOfficeOrgPropertyException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ } catch (MissingResourceException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+ dialog.setEnableError(false, null);
+ }
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel jPanel1;
+ // End of variables declaration//GEN-END:variables
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/InterfaceDataTypePanel.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/InterfaceDataTypePanel.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/InterfaceDataTypePanel.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/InterfaceDataTypePanel.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="jSplitPane1" pref="508" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="deleteButton" max="32767" attributes="1"/>
+ <Component id="addParameterButton" alignment="0" max="32767" attributes="1"/>
+ <Component id="addFunctionButton" alignment="0" pref="139" max="32767" attributes="1"/>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="addFunctionButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="addParameterButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="deleteButton" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Component id="jSplitPane1" alignment="0" min="-2" pref="300" max="-2" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JSplitPane" name="jSplitPane1">
+ <Properties>
+ <Property name="dividerLocation" type="int" value="200"/>
+ </Properties>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
+ <EtchetBorder/>
+ </Border>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PropertySheet();"/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+ <JSplitPaneConstraints position="right"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ </Container>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
+ <EtchetBorder/>
+ </Border>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+ <JSplitPaneConstraints position="left"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton" name="addFunctionButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/component/dialogs/Bundle.properties" key="LBL_Button_NewFunction" replaceFormat="NbBundle.getMessage(NewDataTypeBasePanel.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addFunctionActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JButton" name="addParameterButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/component/dialogs/Bundle.properties" key="LBL_Button_NewParameter" replaceFormat="NbBundle.getMessage(NewDataTypeBasePanel.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addParameterActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JButton" name="deleteButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/component/dialogs/Bundle.properties" key="LBL_Button_Delete" replaceFormat="NbBundle.getMessage(NewDataTypeBasePanel.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ </SubComponents>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/InterfaceDataTypePanel.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/InterfaceDataTypePanel.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/InterfaceDataTypePanel.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/InterfaceDataTypePanel.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: InterfaceDataTypePanel.java,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: sg $ $Date: 2007/08/15 13:45:12 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.projecttemplates.component.dialogs;
+
+import java.awt.Component;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+import java.util.MissingResourceException;
+import javax.swing.ActionMap;
+import javax.swing.tree.TreeSelectionModel;
+import org.openide.WizardDescriptor;
+import org.openide.explorer.ExplorerManager;
+import org.openide.explorer.ExplorerUtils;
+import org.openide.explorer.propertysheet.PropertySheet;
+import org.openide.explorer.view.BeanTreeView;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.Utilities;
+import org.openoffice.extensions.projecttemplates.component.*;
+import org.openoffice.extensions.projecttemplates.component.datamodel.types.node.ComponentTypeChildren;
+import org.openoffice.extensions.projecttemplates.component.datamodel.types.node.ComponentTypeNode;
+import org.openoffice.extensions.projecttemplates.component.datamodel.types.node.IdlTypeTreeCreator;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.Interface;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException;
+
+/**
+ *
+ * @author sg128468
+ */
+public class InterfaceDataTypePanel extends javax.swing.JPanel
+ implements ExplorerManager.Provider, PropertyChangeListener {
+
+ private static final String ICON_PATH = "org/openoffice/extensions/projecttemplates/calcaddin/icons/netbeans.png"; // NOI18N
+ private ExplorerManager manager = new ExplorerManager();
+ private PropertySheet propSheet;
+ private Node node;
+
+ private Lookup lookup;
+ private ChangeEventPanel panel;
+ // all actions that can be done here
+ private ComponentActions actions;
+ private String oldName;
+ private boolean edit;
+
+ private ValidateDataType dialog;
+
+ /**
+ * Creates new form InterfaceDataTypeDialog
+ */
+ public InterfaceDataTypePanel(ValidateDataType dialog, DialogProperties props) {
+ initComponents();
+
+ this.edit = props.getBooleanProperty(props.EDIT);
+ this.panel = (ChangeEventPanel)props.getProperty(props.PANEL);
+ this.actions = new ComponentActions(manager, panel);
+ this.dialog = dialog;
+
+ if (edit) {
+ node = (Node)props.getProperty(props.NODE);
+ NbNodeObject ob = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ oldName = ob.getDisplayName();
+ }
+ else {
+ node = (Node)IdlTypeTreeCreator.createInitialInterfaceTree(
+ props.getStringProperty(props.IFC), props.getStringProperty(props.PKG));
+ }
+ manager.setRootContext(node);
+
+ manager.addPropertyChangeListener(this);
+
+ propSheet = (PropertySheet)jPanel1;
+ propSheet.setNodes(new Node[]{node});
+
+ BeanTreeView componentView = (BeanTreeView)jScrollPane1;
+ componentView.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ jSplitPane1 = new javax.swing.JSplitPane();
+ jPanel1 = new PropertySheet();
+ jScrollPane1 = new BeanTreeView();
+ addFunctionButton = new javax.swing.JButton();
+ addParameterButton = new javax.swing.JButton();
+ deleteButton = new javax.swing.JButton();
+
+ jSplitPane1.setDividerLocation(200);
+ jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+ jSplitPane1.setRightComponent(jPanel1);
+
+ jScrollPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+ jSplitPane1.setLeftComponent(jScrollPane1);
+
+ org.openide.awt.Mnemonics.setLocalizedText(addFunctionButton, NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Button_NewFunction"));
+ addFunctionButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ addFunctionActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(addParameterButton, NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Button_NewParameter"));
+ addParameterButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ addParameterActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(deleteButton, NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Button_Delete"));
+ deleteButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ deleteActionPerformed(evt);
+ }
+ });
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 508, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
+ .add(deleteButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(addParameterButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(addFunctionButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(addFunctionButton)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(addParameterButton)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(deleteButton))
+ .add(jSplitPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 300, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteActionPerformed
+
+ actions.deleteActions();
+
+ }//GEN-LAST:event_deleteActionPerformed
+
+ private void addParameterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addParameterActionPerformed
+
+ actions.addParameterAction();
+
+ }//GEN-LAST:event_addParameterActionPerformed
+
+ private void addFunctionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addFunctionActionPerformed
+
+ actions.addFunctionAction();
+
+ }//GEN-LAST:event_addFunctionActionPerformed
+
+ public ExplorerManager getExplorerManager() {
+ return this.manager;
+ }
+
+ public Lookup getLookup() {
+ return this.lookup;
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ Node[] selectedNodes = manager.getSelectedNodes();
+ if (selectedNodes != null && selectedNodes.length == 1) {
+ propSheet.setNodes(selectedNodes);
+ NbNodeObject nodeObject = (NbNodeObject)selectedNodes[0].getLookup().lookup(NbNodeObject.class);
+ if (nodeObject.getType() == NbNodeObject.PROPERTY_TYPE){
+ deleteButton.setEnabled(false);
+ addFunctionButton.setEnabled(false);
+ addParameterButton.setEnabled(false);
+ }
+ else if (nodeObject.getType() == NbNodeObject.PARAMETER_TYPE) {
+ deleteButton.setEnabled(true);
+ addFunctionButton.setEnabled(false);
+ addParameterButton.setEnabled(true);
+ }
+ else if (nodeObject.getType() == NbNodeObject.FUNCTION_TYPE) {
+ deleteButton.setEnabled(true);
+ addFunctionButton.setEnabled(true);
+ addParameterButton.setEnabled(true);
+ }
+ else {
+ deleteButton.setEnabled(false);
+ addFunctionButton.setEnabled(true);
+ addParameterButton.setEnabled(false);
+ }
+ }
+ valid();
+// panel.fireChangeEvent(); // Notify that the panel changed
+ }
+
+ private void valid() {
+ NbNodeObject ob = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ Interface ifc = (Interface)ob;
+ try {
+ if (ifc.getSimpleProperty(ifc.PROPERTY_CONTAINER_NAME).length() == 0 ||
+ ifc.getSimpleProperty(ifc.PROPERTY_CONTAINER_PACKAGE).length() == 0) {
+ dialog.setEnableError(true,
+ NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Error_Name"));
+ return;
+ }
+ } catch (MissingResourceException ex) {
+ ex.printStackTrace();
+ } catch (UnknownOpenOfficeOrgPropertyException ex) {
+ ex.printStackTrace();
+ }
+ dialog.setEnableError(false, null);
+ }
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton addFunctionButton;
+ private javax.swing.JButton addParameterButton;
+ private javax.swing.JButton deleteButton;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JSplitPane jSplitPane1;
+ // End of variables declaration//GEN-END:variables
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/NewDataTypeBasePanel.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/NewDataTypeBasePanel.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/NewDataTypeBasePanel.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/NewDataTypeBasePanel.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabel1" min="-2" pref="95" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="dataTypeComboBox" pref="373" max="32767" attributes="0"/>
+ </Group>
+ <Component id="containerPanel" alignment="0" pref="480" max="32767" attributes="0"/>
+ <Component id="errorMessageLabel" alignment="1" pref="480" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="dataTypeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="containerPanel" pref="223" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="errorMessageLabel" min="-2" pref="16" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="containerPanel">
+ <Properties>
+ <Property name="name" type="java.lang.String" value="dataTypeList"/>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="getPluggedInPanel();"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ </Container>
+ <Component class="javax.swing.JLabel" name="errorMessageLabel">
+ <Properties>
+ <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
+ <Font name="Dialog" size="12" style="0"/>
+ </Property>
+ <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+ <Color blue="0" green="0" red="ff" type="rgb"/>
+ </Property>
+ <Property name="text" type="java.lang.String" value="jLabel1"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel1">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="dataTypeComboBox"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/component/dialogs/Bundle.properties" key="LBL_DataType" replaceFormat="NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_DataType")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="dataTypeComboBox">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="new DefaultComboBoxModel(getItems())" type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/NewDataTypeBasePanel.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/NewDataTypeBasePanel.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/NewDataTypeBasePanel.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/NewDataTypeBasePanel.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: NewDataTypeBasePanel.java,v $
+ *
+ * $Revision: 1.5 $
+ *
+ * last change: $Author: sg $ $Date: 2007/08/15 13:45:12 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.projecttemplates.component.dialogs;
+
+import java.awt.Dialog;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JPanel;
+import org.openide.DialogDescriptor;
+import org.openide.DialogDisplayer;
+import org.openide.explorer.ExplorerManager;
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.component.ComponentPanelVisual2IdlFiles;
+import org.openoffice.extensions.projecttemplates.component.datamodel.DataType;
+import org.openoffice.extensions.projecttemplates.component.datamodel.types.node.ComponentTypeNode;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+
+/**
+ *
+ * @author sg128468
+ */
+public class NewDataTypeBasePanel extends javax.swing.JPanel
+ implements ActionListener, ValidateDataType {
+
+ private static final String ICON_PATH =
+ "/org/openoffice/extensions/projecttemplates/component/icons/error.png"; // NOI18N
+
+ private static final String NEW_DATA_TYPE_ENUM_HELP =
+ "org.openoffice.extensions.data.type.enum"; // NOI18N
+ private static final String NEW_DATA_TYPE_EXCEPTION_HELP =
+ "org.openoffice.extensions.data.type.exception"; // NOI18N
+ private static final String NEW_DATA_TYPE_INTERFACE_HELP =
+ "org.openoffice.extensions.data.type.interface"; // NOI18N
+ private static final String NEW_DATA_TYPE_POLYSTRUCT_HELP =
+ "org.openoffice.extensions.data.type.polystruct"; // NOI18N
+ private static final String NEW_DATA_TYPE_SERVICE_HELP =
+ "org.openoffice.extensions.data.type.service"; // NOI18N
+ private static final String NEW_DATA_TYPE_STRUCT_HELP =
+ "org.openoffice.extensions.data.type.struct"; // NOI18N
+
+ private DialogProperties props;
+ private DialogDescriptor dialogDescriptor;
+ private String oldName;
+ private String helpCtxString;
+
+ /** Creates new form NewDataTypeBasePanel */
+ public NewDataTypeBasePanel(DialogProperties props) {
+ this.props = props;
+ Node object = (Node)props.getProperty(props.NODE);
+ if (object != null) {
+ NbNodeObject ob = (NbNodeObject)object.getLookup().lookup(NbNodeObject.class);
+ this.oldName = ob.getDisplayName();
+ }
+ initComponents();
+ errorMessageLabel.setText(" "); // NOI18N
+ }
+
+ public void setEnableError(boolean enable, String message) {
+ if (enable) {
+ errorMessageLabel.setText(message);
+ errorMessageLabel.setIcon(
+ new javax.swing.ImageIcon(getClass().getResource(ICON_PATH)));
+ }
+ else {
+ errorMessageLabel.setText(" "); // NOI18N
+ errorMessageLabel.setIcon(null);
+ }
+ dialogDescriptor.setValid(!enable); // set ok button valid/invalid
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ containerPanel = getPluggedInPanel();
+ errorMessageLabel = new javax.swing.JLabel();
+ jLabel1 = new javax.swing.JLabel();
+ dataTypeComboBox = new javax.swing.JComboBox();
+
+ containerPanel.setName("dataTypeList");
+
+ errorMessageLabel.setFont(new java.awt.Font("Dialog", 0, 12));
+ errorMessageLabel.setForeground(new java.awt.Color(255, 0, 0));
+ errorMessageLabel.setText("jLabel1");
+
+ jLabel1.setLabelFor(dataTypeComboBox);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_DataType"));
+
+ dataTypeComboBox.setModel(new DefaultComboBoxModel(getItems()));
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 95, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(dataTypeComboBox, 0, 373, Short.MAX_VALUE))
+ .add(containerPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, errorMessageLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel1)
+ .add(dataTypeComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(containerPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(errorMessageLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel containerPanel;
+ private javax.swing.JComboBox dataTypeComboBox;
+ private javax.swing.JLabel errorMessageLabel;
+ private javax.swing.JLabel jLabel1;
+ // End of variables declaration//GEN-END:variables
+
+ public static synchronized void start(final DialogProperties props) {
+ // get the title
+ String title = null;
+ if (props.getBooleanProperty(props.EDIT)) {
+ title =
+ NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Title_Edit");
+ }
+ else {
+ title =
+ NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Title_Create");
+ }
+ NewDataTypeBasePanel basePanel = new NewDataTypeBasePanel(props);
+ DialogDescriptor ddsc = new DialogDescriptor(basePanel, title);
+ basePanel.addDialogDescriptor(ddsc);
+ Dialog d = DialogDisplayer.getDefault().createDialog(ddsc);
+ LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "type " + props.getIntProperty(props.DATA_TYPE)); // NOI18N
+ d.setVisible(true);
+ }
+
+ private JPanel getPluggedInPanel() {
+ switch(props.getIntProperty(props.DATA_TYPE)) {
+ case DataType.EXCEPTION_TYPE:
+ helpCtxString = NEW_DATA_TYPE_EXCEPTION_HELP;
+ return new ExceptionDataTypePanel(this, props);
+ case DataType.POLY_STRUCT_TYPE:
+ helpCtxString = NEW_DATA_TYPE_POLYSTRUCT_HELP;
+ return new PolyStructDataTypePanel(this, props);
+ case DataType.ENUM_TYPE:
+ helpCtxString = NEW_DATA_TYPE_ENUM_HELP;
+ return new EnumDataTypePanel(this, props);
+ case DataType.INTERFACE_TYPE:
+ helpCtxString = NEW_DATA_TYPE_INTERFACE_HELP;
+ return new InterfaceDataTypePanel(this, props);
+ case DataType.SERVICE_TYPE:
+ helpCtxString = NEW_DATA_TYPE_SERVICE_HELP;
+ return new ServiceDataTypePanel(this, props);
+ case DataType.STRUCT_TYPE:
+ helpCtxString = NEW_DATA_TYPE_STRUCT_HELP;
+ return new StructDataTypePanel(this, props);
+ default:
+ LogWriter.getLogWriter().log(LogWriter.LEVEL_CRITICAL, "Unkown type for plugged panel creation."); // NOI18N
+ }
+ return null;
+ }
+
+ private void addDialogDescriptor(DialogDescriptor ddsc) {
+ this.dialogDescriptor = ddsc;
+ dialogDescriptor.setButtonListener(this);
+ // helpCtxString is set in c'tor, so it's available here
+ dialogDescriptor.setHelpCtx(new HelpCtx(helpCtxString));
+ }
+
+ private String[] getItems() {
+ return (String[])props.getProperty(props.SELECTION);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("OK")) { // NOI18N
+ ExplorerManager.Provider prov = (ExplorerManager.Provider)containerPanel;
+ ComponentTypeNode node = (ComponentTypeNode)prov.getExplorerManager().getRootContext();
+ NbNodeObject object = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ if (oldName == null) oldName = object.getDisplayName();
+ ComponentPanelVisual2IdlFiles.getComponentPanelVisual2IdlFiles().addNewDataType(
+ oldName, object.getDisplayName(), object);
+ }
+ }
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/PolyStructDataTypePanel.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/PolyStructDataTypePanel.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/PolyStructDataTypePanel.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/PolyStructDataTypePanel.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <Component id="jSplitPane1" pref="413" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="1" max="-2" attributes="0">
+ <Component id="addTemplateButton" alignment="1" max="32767" attributes="1"/>
+ <Component id="addPropertyButton" alignment="1" max="32767" attributes="1"/>
+ <Component id="deleteButton" alignment="1" max="32767" attributes="1"/>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="addTemplateButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="addPropertyButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="deleteButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="182" max="-2" attributes="0"/>
+ </Group>
+ <Component id="jSplitPane1" alignment="0" pref="278" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JSplitPane" name="jSplitPane1">
+ <Properties>
+ <Property name="dividerLocation" type="int" value="200"/>
+ </Properties>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PropertySheet();"/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+ <JSplitPaneConstraints position="right"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ </Container>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+ <JSplitPaneConstraints position="left"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton" name="addTemplateButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/component/dialogs/Bundle.properties" key="LBL_Button_AddTemplate" replaceFormat="org.openide.util.NbBundle.getBundle(NewDataTypeBasePanel.class).getString("LBL_Button_AddTemplate")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addTemplateButtonActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JButton" name="addPropertyButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/component/dialogs/Bundle.properties" key="LBL_Button_AddMember" replaceFormat="org.openide.util.NbBundle.getBundle(NewDataTypeBasePanel.class).getString("LBL_Button_AddMember")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addPropertyButtonActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JButton" name="deleteButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/component/dialogs/Bundle.properties" key="LBL_Button_Delete" replaceFormat="org.openide.util.NbBundle.getBundle(NewDataTypeBasePanel.class).getString("LBL_Button_Delete")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteButtonActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ </SubComponents>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/PolyStructDataTypePanel.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/PolyStructDataTypePanel.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/PolyStructDataTypePanel.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/PolyStructDataTypePanel.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: PolyStructDataTypePanel.java,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: sg $ $Date: 2007/08/15 13:45:12 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.projecttemplates.component.dialogs;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.MissingResourceException;
+import javax.swing.JPanel;
+import javax.swing.tree.TreeSelectionModel;
+import org.openide.explorer.ExplorerManager;
+import org.openide.explorer.propertysheet.PropertySheet;
+import org.openide.explorer.view.BeanTreeView;
+import org.openide.nodes.Node;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.component.*;
+import org.openoffice.extensions.projecttemplates.component.datamodel.types.node.IdlTypeTreeCreator;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.datamodel.Parameter;
+import org.openoffice.extensions.util.datamodel.PolyStruct;
+import org.openoffice.extensions.util.datamodel.TemplateType;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException;
+
+/**
+ *
+ * @author sg128468
+ */
+public class PolyStructDataTypePanel extends JPanel
+ implements ExplorerManager.Provider, PropertyChangeListener {
+
+ private ExplorerManager manager = new ExplorerManager();
+ private PropertySheet propSheet;
+ private ChangeEventPanel panel;
+ private ValidateDataType dialog;
+ private Node node;
+
+ private String oldName;
+ private boolean edit;
+ private ComponentActions actions;
+
+ /**
+ * Creates new Poly Struct panel
+ */
+ public PolyStructDataTypePanel(ValidateDataType dialog, DialogProperties props) {
+ initComponents();
+
+ this.edit = props.getBooleanProperty(props.EDIT);
+ String pkgName = props.getStringProperty(props.PKG);
+ String name = props.getStringProperty(props.NAME);
+
+ panel = (ChangeEventPanel)props.getProperty(props.PANEL);
+ this.actions = new ComponentActions(manager, panel);
+ this.dialog = dialog;
+
+ if (edit) {
+ node = (Node)props.getProperty(props.NODE);
+ NbNodeObject ob = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ oldName = ob.getDisplayName();
+ }
+ else {
+ if (name == null) name = "PolyStruct"; // NOI18N
+ node = (Node)IdlTypeTreeCreator.createInitialPolyStruct(name, pkgName);
+ }
+ manager.setRootContext(node);
+
+ manager.addPropertyChangeListener(this);
+
+ propSheet = (PropertySheet)jPanel1;
+ propSheet.setNodes(new Node[]{node});
+
+ BeanTreeView componentView = (BeanTreeView)jScrollPane1;
+ componentView.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ jSplitPane1 = new javax.swing.JSplitPane();
+ jPanel1 = new PropertySheet();
+ jScrollPane1 = new BeanTreeView();
+ addTemplateButton = new javax.swing.JButton();
+ addPropertyButton = new javax.swing.JButton();
+ deleteButton = new javax.swing.JButton();
+
+ jSplitPane1.setDividerLocation(200);
+ jSplitPane1.setRightComponent(jPanel1);
+
+ jSplitPane1.setLeftComponent(jScrollPane1);
+
+ org.openide.awt.Mnemonics.setLocalizedText(addTemplateButton, org.openide.util.NbBundle.getBundle(NewDataTypeBasePanel.class).getString("LBL_Button_AddTemplate"));
+ addTemplateButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ addTemplateButtonActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(addPropertyButton, org.openide.util.NbBundle.getBundle(NewDataTypeBasePanel.class).getString("LBL_Button_AddMember"));
+ addPropertyButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ addPropertyButtonActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(deleteButton, org.openide.util.NbBundle.getBundle(NewDataTypeBasePanel.class).getString("LBL_Button_Delete"));
+ deleteButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ deleteButtonActionPerformed(evt);
+ }
+ });
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
+ .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
+ .add(addTemplateButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(addPropertyButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(deleteButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(addTemplateButton)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(addPropertyButton)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(deleteButton)
+ .add(182, 182, 182))
+ .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
+
+ Node[] nodes = manager.getSelectedNodes();
+ if (nodes != null && nodes.length == 1) {
+ Node node = nodes[0];
+ NbNodeObject nodeObject = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ PolyStruct parent = (PolyStruct)nodeObject.getParent();
+ switch(nodeObject.getType()) {
+ case NbNodeObject.PARAMETER_TYPE:
+ parent.removePropertyType((Parameter)nodeObject);
+ break;
+ case NbNodeObject.TEMPLATE_TYPE:
+ parent.removeTemplateType((TemplateType)nodeObject);
+ break;
+ default:
+ // do nothing
+ }
+ this.actions.updateUI(node.getParentNode());
+ }
+
+ }//GEN-LAST:event_deleteButtonActionPerformed
+
+ private void addPropertyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPropertyButtonActionPerformed
+
+ Node[] nodes = manager.getSelectedNodes();
+ if (nodes != null && nodes.length == 1) {
+ Node node = nodes[0];
+ NbNodeObject nodeObject = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ Object parent = nodeObject.getParent();
+ if (parent != null) {
+ ((PolyStruct)parent).addPropertyType(nodeObject);
+ this.actions.updateUI(node.getParentNode());
+ }
+ else {
+ ((PolyStruct)nodeObject).addPropertyType();
+ this.actions.updateUI(node);
+ }
+ }
+
+ }//GEN-LAST:event_addPropertyButtonActionPerformed
+
+ private void addTemplateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTemplateButtonActionPerformed
+
+ Node[] nodes = manager.getSelectedNodes();
+ if (nodes != null && nodes.length == 1) {
+ Node node = nodes[0];
+ NbNodeObject nodeObject = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ Object parent = nodeObject.getParent();
+ if (parent != null) {
+ ((PolyStruct)parent).addTemplateType(nodeObject);
+ this.actions.updateUI(node.getParentNode());
+ }
+ else {
+ ((PolyStruct)nodeObject).addTemplateType();
+ this.actions.updateUI(node);
+ }
+ }
+
+
+ }//GEN-LAST:event_addTemplateButtonActionPerformed
+
+ public ExplorerManager getExplorerManager() {
+ return this.manager;
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ Node[] nodes = manager.getSelectedNodes();
+ if (nodes != null && nodes.length == 1) {
+ propSheet.setNodes(nodes);
+ NbNodeObject nodeObject = (NbNodeObject)nodes[0].getLookup().lookup(NbNodeObject.class);
+ if (nodeObject.getType() == NbNodeObject.PROPERTY_TYPE){
+ deleteButton.setEnabled(false);
+ addPropertyButton.setEnabled(false);
+ addTemplateButton.setEnabled(false);
+ }
+ else if (nodeObject.getType() == NbNodeObject.TEMPLATE_TYPE) {
+ deleteButton.setEnabled(true);
+ addPropertyButton.setEnabled(false);
+ addTemplateButton.setEnabled(true);
+ }
+ else if (nodeObject.getType() == NbNodeObject.PARAMETER_TYPE) {
+ deleteButton.setEnabled(true);
+ addPropertyButton.setEnabled(true);
+ addTemplateButton.setEnabled(false);
+ }
+ else {
+ deleteButton.setEnabled(false);
+ addPropertyButton.setEnabled(true);
+ addTemplateButton.setEnabled(true);
+ }
+ }
+ valid();
+// panel.fireChangeEvent(); // Notify that the panel changed
+ }
+
+ private void valid() {
+ NbNodeObject ob = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ PolyStruct struct = (PolyStruct)ob;
+ try {
+ if (struct.getSimpleProperty(struct.PROPERTY_CONTAINER_NAME).length() == 0 ||
+ struct.getSimpleProperty(struct.PROPERTY_CONTAINER_PACKAGE).length() == 0) {
+ dialog.setEnableError(true,
+ NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Error_Name"));
+ return;
+ }
+ else if (struct.getTemplateTypeNames().length == 0) {
+ dialog.setEnableError(true,
+ NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Error_Template"));
+ return;
+ }
+ } catch (MissingResourceException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ } catch (UnknownOpenOfficeOrgPropertyException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+ dialog.setEnableError(false, null);
+ }
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton addPropertyButton;
+ private javax.swing.JButton addTemplateButton;
+ private javax.swing.JButton deleteButton;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JSplitPane jSplitPane1;
+ // End of variables declaration//GEN-END:variables
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ServiceDataTypePanel.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ServiceDataTypePanel.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ServiceDataTypePanel.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ServiceDataTypePanel.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jSplitPane1" pref="618" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jSplitPane1" min="-2" pref="300" max="-2" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JSplitPane" name="jSplitPane1">
+ <Properties>
+ <Property name="dividerLocation" type="int" value="200"/>
+ </Properties>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
+ <EtchetBorder/>
+ </Border>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PropertySheet();"/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+ <JSplitPaneConstraints position="right"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ </Container>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
+ <EtchetBorder/>
+ </Border>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+ <JSplitPaneConstraints position="left"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ </Container>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ServiceDataTypePanel.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ServiceDataTypePanel.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ServiceDataTypePanel.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/ServiceDataTypePanel.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ServiceDataTypePanel.java,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: sg $ $Date: 2007/08/15 13:45:12 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.projecttemplates.component.dialogs;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.MissingResourceException;
+import javax.swing.tree.TreeSelectionModel;
+import org.openide.explorer.ExplorerManager;
+import org.openide.explorer.propertysheet.PropertySheet;
+import org.openide.explorer.view.BeanTreeView;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.component.*;
+import org.openoffice.extensions.projecttemplates.component.datamodel.types.node.IdlTypeTreeCreator;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.datamodel.Service;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException;
+
+/**
+ *
+ * @author sg128468
+ */
+public class ServiceDataTypePanel extends javax.swing.JPanel
+ implements ExplorerManager.Provider, PropertyChangeListener {
+
+ private ExplorerManager manager = new ExplorerManager();
+ private PropertySheet propSheet;
+
+ private Lookup lookup;
+ private ChangeEventPanel panel;
+ private ValidateDataType dialog;
+ private Node node;
+ // all actions that can be done here
+ private ComponentActions actions;
+ private String oldName;
+ private boolean edit;
+
+ /**
+ * Creates new form InterfaceDataTypeDialog
+ */
+public ServiceDataTypePanel(ValidateDataType dialog, DialogProperties props) {
+
+ initComponents();
+ this.edit = props.getBooleanProperty(props.EDIT);
+ this.panel = (ChangeEventPanel)props.getProperty(props.PANEL);
+ this.actions = new ComponentActions(manager, panel);
+ this.dialog = dialog;
+
+ if (edit) {
+ node = (Node)props.getProperty(props.NODE);
+ NbNodeObject ob = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ oldName = ob.getDisplayName();
+ }
+ else {
+ node = (Node)IdlTypeTreeCreator.createInitialServiceTree(
+ props.getStringProperty(props.SRV), props.getStringProperty(props.PKG));
+ }
+ manager.setRootContext(node);
+
+ manager.addPropertyChangeListener(this);
+
+ propSheet = (PropertySheet)jPanel1;
+ propSheet.setNodes(new Node[]{node});
+
+ BeanTreeView componentView = (BeanTreeView)jScrollPane1;
+ componentView.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ jSplitPane1 = new javax.swing.JSplitPane();
+ jPanel1 = new PropertySheet();
+ jScrollPane1 = new BeanTreeView();
+
+ jSplitPane1.setDividerLocation(200);
+ jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+ jSplitPane1.setRightComponent(jPanel1);
+
+ jScrollPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+ jSplitPane1.setLeftComponent(jScrollPane1);
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jSplitPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 300, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ public ExplorerManager getExplorerManager() {
+ return this.manager;
+ }
+
+ public Lookup getLookup() {
+ return this.lookup;
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ Node[] selectedNodes = manager.getSelectedNodes();
+ if (selectedNodes != null && selectedNodes.length == 1) {
+ propSheet.setNodes(selectedNodes);
+ }
+ valid();
+// panel.fireChangeEvent(); // Notify that the panel changed
+ }
+
+ private void valid() {
+ NbNodeObject ob = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ Service srv = (Service)ob;
+ try {
+ if (srv.getSimpleProperty(srv.PROPERTY_CONTAINER_NAME).length() == 0 ||
+ srv.getSimpleProperty(srv.PROPERTY_CONTAINER_PACKAGE).length() == 0) {
+ dialog.setEnableError(true,
+ NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Error_Name"));
+ return;
+ }
+ else if (srv.getSimpleProperty(srv.PROPERTY_CONTAINER_INTERFACE).length() == 0) {
+ dialog.setEnableError(true,
+ NbBundle.getMessage(NewDataTypeBasePanel.class, "LBL_Error_Interface"));
+ return;
+ }
+ } catch (MissingResourceException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ } catch (UnknownOpenOfficeOrgPropertyException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+ dialog.setEnableError(false, null);
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JSplitPane jSplitPane1;
+ // End of variables declaration//GEN-END:variables
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/StructDataTypePanel.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/StructDataTypePanel.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/StructDataTypePanel.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/component/dialogs/StructDataTypePanel.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="jSplitPane1" pref="573" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="deletejButton" max="32767" attributes="1"/>
+ <Component id="addFunctionjButton" alignment="0" pref="129" max="32767" attributes="1"/>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="addFunctionjButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="deletejButton" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Component id="jSplitPane1" alignment="0" min="-2" pref="300" max="-2" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JSplitPane" name="jSplitPane1">
+ <Properties>
+ <Property name="dividerLocation" type="int" value="200"/>
+ </Properties>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
+ <EtchetBorder/>
+ </Border>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PropertySheet();"/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+ <JSplitPaneConstraints position="right"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ </Container>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
+ <EtchetBorder/>
+ </Border>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/>
+ </AuxValues>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+ <JSplitPaneConstraints position="left"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton" name="addFunctionjButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/component/Bundle.properties" key="LBL_Button_AddType" replaceFormat="NbBundle.getMessage(ComponentWizardIterator.class, "LBL_Button_AddType")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addFunctionActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JButton" name="deletejButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/component/Bundle.properties" key="LBL_ButtonDelete" replaceFormat="NbBundle.getMessage(ComponentWizardIterator.class, "LBL_ButtonDelete")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteActionPerformed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ </SubComponents>
+</Form>