[Libreoffice-commits] core.git: 2 commits - wizards/com
Xisco Fauli
anistenis at gmail.com
Sun Jun 9 13:05:33 PDT 2013
wizards/com/sun/star/wizards/web/AbstractErrorHandler.java | 229 -
wizards/com/sun/star/wizards/web/BackgroundsDialog.java | 274 --
wizards/com/sun/star/wizards/web/CallWizard.java | 284 --
wizards/com/sun/star/wizards/web/ErrorHandler.java | 102
wizards/com/sun/star/wizards/web/ExtensionVerifier.java | 53
wizards/com/sun/star/wizards/web/FTPDialog.java | 741 -----
wizards/com/sun/star/wizards/web/FTPDialogResources.java | 89
wizards/com/sun/star/wizards/web/IconsDialog.java | 192 -
wizards/com/sun/star/wizards/web/ImageListDialog.java | 266 --
wizards/com/sun/star/wizards/web/LogTaskListener.java | 88
wizards/com/sun/star/wizards/web/MANIFEST.MF | 2
wizards/com/sun/star/wizards/web/Process.java | 808 ------
wizards/com/sun/star/wizards/web/ProcessErrorHandler.java | 82
wizards/com/sun/star/wizards/web/ProcessErrors.java | 38
wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java | 57
wizards/com/sun/star/wizards/web/StatusDialog.java | 289 --
wizards/com/sun/star/wizards/web/StylePreview.java | 145 -
wizards/com/sun/star/wizards/web/TOCPreview.java | 111
wizards/com/sun/star/wizards/web/WWD_Events.java | 1276 ----------
wizards/com/sun/star/wizards/web/WWD_Events.py | 1
wizards/com/sun/star/wizards/web/WWD_General.java | 377 --
wizards/com/sun/star/wizards/web/WWD_Startup.java | 942 -------
wizards/com/sun/star/wizards/web/WWHID.java | 169 -
wizards/com/sun/star/wizards/web/WebConfigSet.py | 5
wizards/com/sun/star/wizards/web/WebWizard.java | 54
wizards/com/sun/star/wizards/web/WebWizard.py | 1
wizards/com/sun/star/wizards/web/WebWizardConst.java | 64
wizards/com/sun/star/wizards/web/WebWizardDialog.java | 879 ------
wizards/com/sun/star/wizards/web/WebWizardDialogResources.java | 339 --
wizards/com/sun/star/wizards/web/data/CGArgument.java | 26
wizards/com/sun/star/wizards/web/data/CGContent.java | 59
wizards/com/sun/star/wizards/web/data/CGDesign.java | 82
wizards/com/sun/star/wizards/web/data/CGDocument.java | 435 ---
wizards/com/sun/star/wizards/web/data/CGExporter.java | 49
wizards/com/sun/star/wizards/web/data/CGFilter.java | 26
wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java | 83
wizards/com/sun/star/wizards/web/data/CGIconSet.java | 26
wizards/com/sun/star/wizards/web/data/CGImage.java | 26
wizards/com/sun/star/wizards/web/data/CGLayout.java | 78
wizards/com/sun/star/wizards/web/data/CGPublish.java | 86
wizards/com/sun/star/wizards/web/data/CGSession.java | 101
wizards/com/sun/star/wizards/web/data/CGSessionName.java | 29
wizards/com/sun/star/wizards/web/data/CGSettings.java | 203 -
wizards/com/sun/star/wizards/web/data/CGStyle.java | 47
wizards/com/sun/star/wizards/web/data/ConfigSetItem.java | 41
wizards/com/sun/star/wizards/web/data/TypeDetection.java | 65
wizards/com/sun/star/wizards/web/export/AbstractExporter.java | 175 -
wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java | 76
wizards/com/sun/star/wizards/web/export/CopyExporter.java | 67
wizards/com/sun/star/wizards/web/export/Exporter.java | 47
wizards/com/sun/star/wizards/web/export/FilterExporter.java | 78
wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java | 84
wizards/com/sun/star/wizards/web/status/ErrorLog.java | 48
wizards/com/sun/star/wizards/web/status/ErrorReporter.java | 25
wizards/com/sun/star/wizards/web/status/LogTaskListener.java | 66
wizards/com/sun/star/wizards/web/status/Task.java | 163 -
wizards/com/sun/star/wizards/web/status/TaskEvent.java | 47
wizards/com/sun/star/wizards/web/status/TaskListener.java | 37
58 files changed, 5 insertions(+), 10327 deletions(-)
New commits:
commit 352d6ffa8e3aee793486d8e065ad044b58ca5dac
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sun Jun 9 21:59:05 2013 +0200
fdo#38820 - Remove java web wizard
Change-Id: Iff32e2dbde7f0a7eedd5cf62c5b37fba8bb9ff54
diff --git a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java b/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java
deleted file mode 100644
index cd388ed..0000000
--- a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import com.sun.star.awt.VclWindowPeerAttribute;
-import com.sun.star.awt.XWindowPeer;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.wizards.common.SystemDialog;
-
-/**
- * An abstract implementation of ErrorHandler, which
- * uses a renderer method geMessageFor(Exception, Object, int, int)
- * (in this class still abstract...)
- * to render the errors, and displays
- * error messeges.
- */
-public abstract class AbstractErrorHandler implements ErrorHandler
-{
-
- XMultiServiceFactory xmsf;
- XWindowPeer peer;
-
- protected AbstractErrorHandler(XMultiServiceFactory xmsf, XWindowPeer peer_)
- {
- this.xmsf = xmsf;
- peer = peer_;
- }
-
- /**
- * Implementation of ErrorHandler:
- * shows a message box with the rendered error.
- * @param arg identifies the error. This object is passed to the render method
- * which returns the right error message.
- * @return true/false for continue/abort.
- */
- public boolean error(Exception ex, Object arg, int ix, int errorType)
- {
- //ex.printStackTrace();
- switch (errorType)
- {
- case ErrorHandler.ERROR_FATAL:
- return !showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- case ErrorHandler.ERROR_PROCESS_FATAL:
- return !showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- case ErrorHandler.ERROR_NORMAL_ABORT:
- return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- case ErrorHandler.ERROR_NORMAL_IGNORE:
- return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- case ErrorHandler.ERROR_QUESTION_CANCEL:
- return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- case ErrorHandler.ERROR_QUESTION_OK:
- return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- case ErrorHandler.ERROR_QUESTION_NO:
- return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- case ErrorHandler.ERROR_QUESTION_YES:
- return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- case ErrorHandler.ERROR_WARNING:
- return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- case ErrorHandler.ERROR_MESSAGE:
- return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
- }
- throw new IllegalArgumentException("unknown error type");
- }
-
- /**
- * @deprecated
- * @param message
- * @param errorType
- * @return true if the ok/yes button is clicked, false otherwise.
- */
- protected boolean showMessage(String message, int errorType)
- {
- return showMessage(xmsf, peer, message, errorType);
- }
-
- /**
- * display a message
- * @deprecated
- * @param xmsf
- * @param message the message to display
- * @param errorType an int constant from the ErrorHandler interface.
- * @return
- */
- public static boolean showMessage(XMultiServiceFactory xmsf, XWindowPeer peer, String message, int errorType)
- {
- String serviceName = getServiceNameFor(errorType);
- int attribute = getAttributeFor(errorType);
- int b = SystemDialog.showMessageBox(xmsf, peer, serviceName, attribute, message);
- return b == getTrueFor(errorType);
- }
-
- public static boolean showMessage(XMultiServiceFactory xmsf, XWindowPeer peer,
- String message,
- String dialogtype,
- int buttons,
- int defaultButton,
- int returnTrueOn)
- {
- int b = SystemDialog.showMessageBox(xmsf, peer, dialogtype, defaultButton + buttons, message);
- return b == returnTrueOn;
- }
-
- /**
- * normally ok(1) is the value for true.
- * but a question dialog may use yes. so i use this method
- * for each error type to get its type of "true" value.
- * @param errorType
- * @return
- */
- private static int getTrueFor(int errorType)
- {
- switch (errorType)
- {
- case ErrorHandler.ERROR_FATAL:
- case ErrorHandler.ERROR_PROCESS_FATAL:
- case ErrorHandler.ERROR_NORMAL_ABORT:
- case ErrorHandler.ERROR_NORMAL_IGNORE:
- case ErrorHandler.ERROR_QUESTION_CANCEL:
- case ErrorHandler.ERROR_QUESTION_OK:
-
- return 1;
-
- case ErrorHandler.ERROR_QUESTION_NO:
- case ErrorHandler.ERROR_QUESTION_YES:
-
- return 2;
-
- case ErrorHandler.ERROR_WARNING:
- case ErrorHandler.ERROR_MESSAGE:
-
- return 1;
- }
- throw new IllegalArgumentException("unkonown error type");
- }
-
- /**
- * @param errorType
- * @return the Uno attributes for each error type.
- */
- private static int getAttributeFor(int errorType)
- {
- switch (errorType)
- {
- case ErrorHandler.ERROR_FATAL:
- return VclWindowPeerAttribute.OK;
- case ErrorHandler.ERROR_PROCESS_FATAL:
- return VclWindowPeerAttribute.OK;
- case ErrorHandler.ERROR_NORMAL_ABORT:
- return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_CANCEL;
- case ErrorHandler.ERROR_NORMAL_IGNORE:
- return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_OK;
- case ErrorHandler.ERROR_QUESTION_CANCEL:
- return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_CANCEL;
- case ErrorHandler.ERROR_QUESTION_OK:
- return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_OK;
- case ErrorHandler.ERROR_QUESTION_NO:
- return VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO;
- case ErrorHandler.ERROR_QUESTION_YES:
- return VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_YES;
- case ErrorHandler.ERROR_WARNING:
- return VclWindowPeerAttribute.OK;
- case ErrorHandler.ERROR_MESSAGE:
- return VclWindowPeerAttribute.OK;
- }
- throw new IllegalArgumentException("unkonown error type");
- }
-
- /**
- * @deprecated
- * @param errorType
- * @return the uno service name for each error type
- */
- private static String getServiceNameFor(int errorType)
- {
- switch (errorType)
- {
- case ErrorHandler.ERROR_FATAL:
- return "errorbox";
- case ErrorHandler.ERROR_PROCESS_FATAL:
- return "errorbox";
- case ErrorHandler.ERROR_NORMAL_ABORT:
- return "errorbox";
- case ErrorHandler.ERROR_NORMAL_IGNORE:
- return "warningbox";
- case ErrorHandler.ERROR_QUESTION_CANCEL:
- return "querybox";
- case ErrorHandler.ERROR_QUESTION_OK:
- return "querybox";
- case ErrorHandler.ERROR_QUESTION_NO:
- return "querybox";
- case ErrorHandler.ERROR_QUESTION_YES:
- return "querybox";
- case ErrorHandler.ERROR_WARNING:
- return "warningbox";
- case ErrorHandler.ERROR_MESSAGE:
- return "infobox";
- }
- throw new IllegalArgumentException("unkonown error type");
- }
-
- /**
- * renders the error
- * @param ex the exception
- * @param arg a free argument
- * @param ix a free argument
- * @param type the error type (from the int constants
- * in ErrorHandler interface)
- * @return a Strings which will be displayed in the message box,
- * and which describes the error, and the needed action from the user.
- */
- protected abstract String getMessageFor(Exception ex, Object arg, int ix, int type);
-}
-
-
diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java
deleted file mode 100644
index 0fc9b57..0000000
--- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import javax.swing.DefaultListModel;
-
-import com.sun.star.awt.Size;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.wizards.common.ConfigSet;
-import com.sun.star.wizards.common.Configuration;
-import com.sun.star.wizards.common.FileAccess;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.common.SystemDialog;
-import com.sun.star.wizards.ui.ImageList;
-import com.sun.star.wizards.web.data.CGImage;
-import com.sun.star.wizards.web.data.CGSettings;
-
-public class BackgroundsDialog extends ImageListDialog
-{
-
- private FileAccess fileAccess;
- private SystemDialog sd;
- private CGSettings settings;
-
- /**
- * @param xmsf
- */
- public BackgroundsDialog(
- XMultiServiceFactory xmsf,
- ConfigSet set_, WebWizardDialogResources resources) throws Exception
- {
-
- super(xmsf, WWHID.HID_BG, new String[]
- {
- resources.resBackgroundsDialog,
- resources.resBackgroundsDialogCaption,
- resources.resOK,
- resources.resCancel,
- resources.resHelp,
- resources.resDeselect,
- resources.resOther,
- resources.resCounter
- });
-
- sd = SystemDialog.createOpenDialog(xmsf);
- sd.addFilter(resources.resImages, "*.jpg;*.jpeg;*.jpe;*.gif", true);
- sd.addFilter(resources.resAllFiles, "*.*", false);
-
- settings = (CGSettings) set_.root;
-
- fileAccess = new FileAccess(xmsf);
- il.setListModel(new Model(set_));
- il.setImageSize(new Size(40, 40));
- il.setRenderer(new BGRenderer(0));
- build();
-
-
- }
-
- /**
- * trigered when the user clicks the "other" button.
- * opens a "file open" dialog, adds the selected
- * image to the list and to the web wizard configuration,
- * and then jumps to the new image, selecting it in the list.
- * @see #add(String)
- */
- public void other()
- {
- String filename[] = sd.callOpenDialog(false, settings.cp_DefaultSession.cp_InDirectory);
- if (filename != null && filename.length > 0 && filename[0] != null)
- {
- settings.cp_DefaultSession.cp_InDirectory = FileAccess.getParentDir(filename[0]);
- int i = add(filename[0]);
- il.setSelected(i);
- il.display(i);
- }
- }
-
- /**
- * adds the given image to the image list (to the model)
- * and to the web wizard configuration.
- * @param s
- * @return
- */
- private int add(String s)
- {
-
- //first i check the item does not already exists in the list...
- for (int i = 0; i < il.getListModel().getSize(); i++)
- {
- if (il.getListModel().getElementAt(i).equals(s))
- {
- return i;
- }
- }
- ((DefaultListModel) il.getListModel()).addElement(s);
- try
- {
- Object configView = Configuration.getConfigurationRoot(xMSF, FileAccess.connectURLs(WebWizardConst.CONFIG_PATH, "BackgroundImages"), true);
- int i = Configuration.getChildrenNames(configView).length + 1;
- Object o = Configuration.addConfigNode(configView, PropertyNames.EMPTY_STRING + i);
- Configuration.set(s, "Href", o);
- Configuration.commit(configView);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- return il.getListModel().getSize() - 1;
-
- }
-
- /**
- * an ImageList Imagerenderer implemtation.
- * The image URL is the object given from the list model.
- * the image name, got from the "render" method is
- * the filename portion of the url.
- *
- */
- private class BGRenderer implements ImageList.IImageRenderer
- {
-
- private int cut;
-
- public BGRenderer(int cut_)
- {
- cut = cut_;
- }
-
- public Object[] getImageUrls(Object listItem)
- {
- Object[] sRetUrls;
- if (listItem != null)
- {
- sRetUrls = new Object[1];
- sRetUrls[0] = listItem;
- return sRetUrls;
- }
- return null;
- }
-
- public String render(Object object)
- {
- return object == null ? PropertyNames.EMPTY_STRING : FileAccess.getPathFilename(fileAccess.getPath((String) object, null));
- }
- }
-
- /**
- * This is a list model for the image list of the
- * backgrounds dialog.
- * It takes the Backgrounds config set as an argument,
- * and "parses" it to a list of files:
- * It goes through each image in the set, and checks it:
- * if it is a directory it lists all image files in this directory.
- * if it is a file, it adds the file to the list.
- */
- private class Model extends DefaultListModel
- {
-
- /**
- * constructor. </br>
- * see class description for a description of
- * the handling of the given model
- * @param model the configuration set of the background images.
- */
- public Model(ConfigSet model)
- {
- try
- {
- for (int i = 0; i < model.getSize(); i++)
- {
- CGImage image = (CGImage) model.getElementAt(i);
- String path = sd.xStringSubstitution.substituteVariables(image.cp_Href, false);
- if (fileAccess.exists(path, false))
- {
- addDir(path);
- }
- else
- {
- remove((String) model.getKey(image));
- }
- }
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- /**
- * when instanciating the model, it checks if each image
- * exists. If it doesnot, it will be removed from
- * the configuration.
- * This is what this method does...
- * @param imageName
- */
- private void remove(String imageName)
- {
- try
- {
- Object conf = Configuration.getConfigurationRoot(xMSF, WebWizardConst.CONFIG_PATH + "/BackgroundImages", true);
- Configuration.removeNode(conf, imageName);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- /**
- * if the given url is a directory
- * adds the images in the given directory,
- * otherwise (if it is a file) adds the file to the list.
- * @param url
- */
- private void addDir(String url)
- {
- if (fileAccess.isDirectory(url))
- {
- add(fileAccess.listFiles(url, false));
- }
- else
- {
- add(url);
- }
- }
-
- /**
- * adds the given filenames (urls) to
- * the list
- * @param filenames
- */
- private void add(String[] filenames)
- {
- for (int i = 0; i < filenames.length; i++)
- {
- add(filenames[i]);
- }
- }
-
- /**
- * adds the given image url to the list.
- * if and only if it ends with jpg, jpeg or gif
- * (case insensitive)
- * @param filename image url.
- */
- private void add(String filename)
- {
- String lcase = filename.toLowerCase();
- if (lcase.endsWith("jpg") ||
- lcase.endsWith("jpeg") ||
- lcase.endsWith("gif"))
- {
- Model.this.addElement(filename);
- }
- }
- }
-}
diff --git a/wizards/com/sun/star/wizards/web/CallWizard.java b/wizards/com/sun/star/wizards/web/CallWizard.java
deleted file mode 100644
index 2976bd5..0000000
--- a/wizards/com/sun/star/wizards/web/CallWizard.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import com.sun.star.beans.XPropertyAccess;
-import com.sun.star.comp.loader.FactoryHelper;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.lang.XSingleServiceFactory;
-import com.sun.star.lang.XTypeProvider;
-import com.sun.star.registry.XRegistryKey;
-import com.sun.star.task.XJob;
-import com.sun.star.task.XJobExecutor;
-import com.sun.star.uno.Type;
-import com.sun.star.wizards.common.Desktop;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.common.Resource;
-
-/**
- * This class capsulates the class, that implements the minimal component, a factory for
- * creating the service (<CODE>__getServiceFactory</CODE>).
- */
-public class CallWizard
-{
-
- /**
- * Gives a factory for creating the service. This method is called by the
- * <code>JavaLoader</code>
- *
- * <p></p>
- *
- * @param stringImplementationName The implementation name of the component.
- * @param xMSF The service manager, who gives access to every known service.
- * @param xregistrykey Makes structural information (except regarding tree
- * structures) of a single registry key accessible.
- *
- * @return Returns a <code>XSingleServiceFactory</code> for creating the component.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey)
- {
- XSingleServiceFactory xsingleservicefactory = null;
-
- if (stringImplementationName.equals(WizardImplementation.class.getName()))
- {
- xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey);
- }
-
- return xsingleservicefactory;
- }
-
- /**
- * This class implements the component. At least the interfaces XServiceInfo,
- * XTypeProvider, and XInitialization should be provided by the service.
- */
- public static class WizardImplementation implements XInitialization, XTypeProvider, XServiceInfo, XJobExecutor
- {
-
- /**
- * The constructor of the inner class has a XMultiServiceFactory parameter.
- *
- * @param xmultiservicefactoryInitialization A special service factory could be
- * introduced while initializing.
- */
- public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization)
- {
- xmultiservicefactory = xmultiservicefactoryInitialization;
-
- if (xmultiservicefactory != null)
- {
- }
- }
- private static WebWizard webWizard = null;
-
- /**
- * Execute Wizard
- *
- * @param str only valid parameter is 'start' at the moment.
- */
- public void trigger(String str)
- {
- if (str.equalsIgnoreCase(PropertyNames.START))
- {
- if (webWizard == null)
- {
- WebWizard ww = null;
- try
- {
- webWizard = new WebWizard(xmultiservicefactory);
- ww = webWizard;
- webWizard.show();
- webWizard = null;
- }
- catch (Exception ex)
- {
- webWizard = null;
- ex.printStackTrace();
- Resource.showCommonResourceError(xmultiservicefactory);
- }
- finally
- {
- webWizard = null;
- try
- {
- if (ww != null)
- {
- ww.cleanup();
- }
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- }
- }
- else
- {
- webWizard.activate();
- }
-
-
- }
- } //*******************************************
- /**
- * The service name, that must be used to get an instance of this service.
- */
- private static final String __serviceName = "com.sun.star.wizards.web.CallWizard";
- /**
- * The service manager, that gives access to all registered services.
- */
- private XMultiServiceFactory xmultiservicefactory;
-
- /**
- * This method is a member of the interface for initializing an object directly
- * after its creation.
- *
- * @param object This array of arbitrary objects will be passed to the component
- * after its creation.
- *
- * @throws com.sun.star.uno.Exception Every exception will not be handled, but
- * will be passed to the caller.
- */
- public void initialize(Object[] object) throws com.sun.star.uno.Exception
- {
- //wizardStarted = false;
- }
-
- /**
- * This method returns an array of all supported service names.
- *
- * @return Array of supported service names.
- */
- public java.lang.String[] getSupportedServiceNames()
- {
- String[] stringSupportedServiceNames = new String[1];
- stringSupportedServiceNames[0] = __serviceName;
-
- return (stringSupportedServiceNames);
- }
-
- /**
- * This method returns true, if the given service will be supported by the
- * component.
- *
- * @param stringService Service name.
- *
- * @return True, if the given service name will be supported.
- */
- public boolean supportsService(String stringService)
- {
- boolean booleanSupportsService = false;
-
- if (stringService.equals(__serviceName))
- {
- booleanSupportsService = true;
- }
-
- return (booleanSupportsService);
- }
-
- /**
- * This method returns an array of bytes, that can be used to unambiguously
- * distinguish between two sets of types, e.g. to realise hashing functionality
- * when the object is introspected. Two objects that return the same ID also
- * have to return the same set of types in getTypes(). If an unique
- * implementation Id cannot be provided this method has to return an empty
- * sequence. Important: If the object aggregates other objects the ID has to be
- * unique for the whole combination of objects.
- *
- * @return Array of bytes, in order to distinguish between two sets.
- */
- public byte[] getImplementationId()
- {
- byte[] byteReturn =
- {
- };
-
- try
- {
- byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
- }
- catch (Exception exception)
- {
- System.err.println(exception);
- }
-
- return (byteReturn);
- }
-
- /**
- * Return the class name of the component.
- *
- * @return Class name of the component.
- */
- public java.lang.String getImplementationName()
- {
- return (WizardImplementation.class.getName());
- }
-
- /**
- * Provides a sequence of all types (usually interface types) provided by the
- * object.
- *
- * @return Sequence of all types (usually interface types) provided by the
- * service.
- */
- public com.sun.star.uno.Type[] getTypes()
- {
- Type[] typeReturn =
- {
- };
-
- try
- {
- typeReturn = new Type[]
- {
- new Type(XPropertyAccess.class), new Type(XJob.class), new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class)
- };
- }
- catch (Exception exception)
- {
- System.err.println(exception);
- }
-
- return (typeReturn);
- }
- }
-
- public static void main(String[] s)
- {
-
- String ConnectStr =
- "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager";
- try
- {
- XMultiServiceFactory xmsf = Desktop.connect(ConnectStr);
- CallWizard.WizardImplementation ww = new CallWizard.WizardImplementation(xmsf);
- ww.trigger(PropertyNames.START);
-
- }
- catch (Exception exception)
- {
- exception.printStackTrace(System.err);
- }
- }
-}
diff --git a/wizards/com/sun/star/wizards/web/ErrorHandler.java b/wizards/com/sun/star/wizards/web/ErrorHandler.java
deleted file mode 100644
index 8bd2bea..0000000
--- a/wizards/com/sun/star/wizards/web/ErrorHandler.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import com.sun.star.awt.VclWindowPeerAttribute;
-
-public interface ErrorHandler
-{
-
- public static final String MESSAGE_INFO = "infobox";
- public static final String MESSAGE_QUESTION = "querybox";
- public static final String MESSAGE_ERROR = "errorbox";
- public static final String MESSAGE_WARNING = "warningbox";
- public static int BUTTONS_OK = VclWindowPeerAttribute.OK;
- public static int BUTTONS_OK_CANCEL = VclWindowPeerAttribute.OK_CANCEL;
- public static int BUTTONS_YES_NO = VclWindowPeerAttribute.YES_NO;
- public static int RESULT_CANCEL = 0;
- public static int RESULT_OK = 1;
- public static int RESULT_YES = 2;
- public static int DEF_OK = VclWindowPeerAttribute.DEF_OK;
- public static int DEF_CANCEL = VclWindowPeerAttribute.DEF_CANCEL;
- public static int DEF_YES = VclWindowPeerAttribute.DEF_YES;
- public static int DEF_NO = VclWindowPeerAttribute.DEF_NO;
- /**
- * Error type for fatal errors which should abort application
- * execution. Should actually never be used :-)
- */
- public static final int ERROR_FATAL = 0;
- /**
- * An Error type for errors which should stop the current process.
- */
- public static final int ERROR_PROCESS_FATAL = 1;
- /**
- * An Error type for errors to which the user can choose, whether
- * to continue or to abort the current process.
- * default is abort.
- */
- public static final int ERROR_NORMAL_ABORT = 2;
- /**
- * An Error type for errors to which the user can choose, whether
- * to continue or to abort the current process.
- * default is continue.
- */
- public static final int ERROR_NORMAL_IGNORE = 3;
- /**
- * An error type for warnings which requires user interaction.
- * (a question :-) )
- * Default is abort (cancel).
- */
- public static final int ERROR_QUESTION_CANCEL = 4;
- /**
- * An error type for warnings which requires user interaction
- * (a question :-) )
- * Default is to continue (ok).
- */
- public static final int ERROR_QUESTION_OK = 5;
- /**
- * An error type for warnings which requires user interaction.
- * (a question :-) )
- * Default is abort (No).
- */
- public static final int ERROR_QUESTION_NO = 6;
- /**
- * An error type for warnings which requires user interaction
- * (a question :-) )
- * Default is to continue (Yes).
- */
- public static final int ERROR_QUESTION_YES = 7;
- /**
- * An error type which is just a warning...
- */
- public static final int ERROR_WARNING = 8;
- /**
- * An error type which just tells the user something
- * ( like "you look tired! you should take a bath! and so on)
- */
- public static final int ERROR_MESSAGE = 9;
-
- /**
- * @param ex the exception that accured
- * @param arg an object as help for recognizing the exception
- * @param ix an integer which helps for detailed recognizing of the exception
- * @param errorType one of the int constants defined by this Interface
- * @return true if the execution should continue, false if it should stop.
- */
- public boolean error(Exception ex, Object arg, int ix, int errorType);
-}
diff --git a/wizards/com/sun/star/wizards/web/ExtensionVerifier.java b/wizards/com/sun/star/wizards/web/ExtensionVerifier.java
deleted file mode 100644
index 0b79632..0000000
--- a/wizards/com/sun/star/wizards/web/ExtensionVerifier.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import com.sun.star.wizards.common.UCB;
-
-/**
- * Verifies all String that do not end with
- * the given extension.
- * This is used to exclude from a copy all the
- * xsl files, so I copy from a layout directory
- * all the files that do *not* end with xsl.
- *
- */
-public class ExtensionVerifier implements UCB.Verifier
-{
-
- private String extension;
-
- public ExtensionVerifier(String extension_)
- {
- extension = "." + extension_;
- }
-
- /**
- * @return true if the given object is
- * a String which does not end with the
- * given extension.
- */
- public boolean verify(Object object)
- {
- if (object instanceof String)
- {
- return !((String) object).endsWith(extension);
- }
- return false;
- }
-}
diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java
deleted file mode 100644
index 13faea9..0000000
--- a/wizards/com/sun/star/wizards/web/FTPDialog.java
+++ /dev/null
@@ -1,741 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.sun.star.awt.PushButtonType;
-import com.sun.star.awt.XButton;
-import com.sun.star.awt.XControl;
-import com.sun.star.awt.XFixedText;
-import com.sun.star.awt.XTextComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.ucb.AuthenticationRequest;
-import com.sun.star.ucb.InteractiveAugmentedIOException;
-import com.sun.star.ucb.InteractiveNetworkConnectException;
-import com.sun.star.ucb.InteractiveNetworkResolveNameException;
-import com.sun.star.ucb.OpenCommandArgument2;
-import com.sun.star.ucb.OpenMode;
-import com.sun.star.wizards.common.Desktop;
-import com.sun.star.wizards.common.FileAccess;
-import com.sun.star.wizards.common.HelpIds;
-import com.sun.star.wizards.common.Helper;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.common.SystemDialog;
-import com.sun.star.wizards.common.UCB;
-import com.sun.star.wizards.ui.UIConsts;
-import com.sun.star.wizards.ui.UnoDialog;
-import com.sun.star.wizards.ui.UnoDialog2;
-import com.sun.star.wizards.ui.event.DataAware;
-import com.sun.star.wizards.ui.event.UnoDataAware;
-import com.sun.star.wizards.web.data.CGPublish;
-import com.sun.star.wizards.web.data.CGSettings;
-
-/**
- * This is the FTP Dialog. <br/>
- * The Dialog enables the user:
- * (*) entering FTP server and user information.
- * (*) testing the connection.
- * (*) choosing a directory on the server.
- * If a connection was established successfully, the user may
- * press OK, which will change
- * the CGPublish object propertiers according the user's input.
- * If no connection was established. the OK and Choose-Dir button are disabled.
- * See the method "disconnect()" which disables them.
- *
- * I use here the DataAware concept to automatically update
- * the members ip, username, and password (via the methods setXXX(...))
- * for details see the ui.events.DataAware classes. <br/>
- */
-public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
-{
-
- /**
- * A Constant used for the setLabel(int) method to change the
- * status-display. "unknown" is the status when the user first
- * opens the dialog, or changes the servername/username/password.
- */
- private final static int STATUS_UNKONWN = 0;
- /**
- * A Constant used for the setLabel(int) method to change the
- * status-display. (connection established)
- */
- private final static int STATUS_OK = 1;
- /**
- * A Constant used for the setLabel(int) method to change the
- * status-display.
- */
- private final static int STATUS_USER_PWD_WRONG = 2;
- /**
- * A Constant used for the setLabel(int) method to change the
- * status-display.
- */
- private final static int STATUS_SERVER_NOT_FOUND = 3;
- /**
- * A Constant used for the setLabel(int) method to change the
- * status-display.
- */
- private final static int STATUS_NO_RIGHTS = 4;
- /**
- * A Constant used for the setLabel(int) method to change the
- * status-display.
- */
- private final static int STATUS_HOST_UNREACHABLE = 5;
- /**
- * A Constant used for the setLabel(int) method to change the
- * status-display.
- */
- private final static int STATUS_CONNECTING = 6;
- /**
- * The icon url for error
- */
- private final static String ICON_ERROR = "ftperror.gif";
- /**
- * The icon url for ok (connection ok)
- */
- private final static String ICON_OK = "ftpconnected.gif";
- /**
- * The icon url for unknown - this is the status when
- * the user first opens the dialog
- */
- private final static String ICON_UNKNOWN = "ftpunknown.gif";
- /**
- * The icon url for an icon representing the "connecting" state.
- */
- private final static String ICON_CONNECTING = "ftpconnecting.gif"; //GUI Components as Class members.
- //Fixed Line
- private XControl ln1;
- private XFixedText lblFTPAddress;
- private XTextComponent txtHost;
- private XFixedText lblUsername;
- private XTextComponent txtUsername;
- private XFixedText lblPassword;
- private XTextComponent txtPassword;
- //Fixed Line
- private XControl ln2;
- private XButton btnTestConnection;
- private XControl imgStatus;
- private XFixedText lblStatus;
- //Fixed Line
- private XControl ln3;
- private XTextComponent txtDir;
- private XButton btnDir;
- private XButton btnOK;
- private XButton btnCancel;
- private XButton btnHelp;
- //Font Descriptors as Class members.
-
- //Resources Object
- private FTPDialogResources resources;
- private List<DataAware> dataAware = new ArrayList<DataAware>();
- public String username = PropertyNames.EMPTY_STRING;
- public String password = PropertyNames.EMPTY_STRING;
- /**
- * The ftp host name
- */
- public String host = PropertyNames.EMPTY_STRING;
- /**
- * The ftp directory.
- */
- private String dir = PropertyNames.EMPTY_STRING;
- /**
- * the ftp publish object which contains the
- * data for this dialog.
- */
- private CGPublish publish;
- private UCB ucb;
- /**
- * used for the status images url.
- */
- private String imagesDirectory;
-
- /**
- * constructor.
- * constructs the UI.
- * @param xmsf
- * @param p the publishert object that contains the data
- * for this dialog
- * @throws Exception
- */
- public FTPDialog(XMultiServiceFactory xmsf, CGPublish p) throws Exception
- {
- super(xmsf);
- publish = p;
-
-
- imagesDirectory = FileAccess.connectURLs(((CGSettings) (publish.root)).soTemplateDir, "../wizard/bitmap/");
-
- //Load Resources
- resources = new FTPDialogResources(xmsf);
- ucb = new UCB(xmsf);
-
- //set dialog properties...
- Helper.setUnoPropertyValues(xDialogModel,
- new String[]
- {
- PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- Boolean.TRUE, 160, HelpIds.getHelpIdString(HID_FTP), Boolean.TRUE, "FTPDialog", 167, 82, resources.resFTPDialog_title, 222
- });
-
- //add controls to dialog
- build();
- //make the hostname, username and password textfield data-aware.
- configure();
- //make sure we display a disconnected status.
- disconnect();
- }
-
- /**
- * Add controls to dialog.
- */
- public void build()
- {
- final String[] PROPNAMES_LABEL = new String[]
- {
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- };
- final String[] PROPNAMES_BUTTON = new String[]
- {
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- };
- final String[] PROPNAMES_BUTTON2 = new String[]
- {
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- };
-
- ln1 = insertFixedLine("ln1",
- PROPNAMES_LABEL,
- new Object[]
- {
- INTEGERS[8], resources.resln1_value, "ln1", INTEGERS[6], INTEGERS[6], new Short((short) 0), 210
- });
- lblFTPAddress = insertLabel("lblFTPAddress",
- PROPNAMES_LABEL,
- new Object[]
- {
- INTEGERS[8], resources.reslblFTPAddress_value, "lblFTPAddress", INTEGER_12, 20, new Short((short) 1), 95
- });
- txtHost = insertTextField("txtHost", "disconnect",
- new String[]
- {
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- INTEGER_12, HelpIds.getHelpIdString(HID_FTP_SERVER), "txtIP", 110, 18, new Short((short) 2), 106
- });
- lblUsername = insertLabel("lblUsername",
- PROPNAMES_LABEL,
- new Object[]
- {
- INTEGERS[8], resources.reslblUsername_value, "lblUsername", INTEGER_12, 36, new Short((short) 3), 85
- });
- txtUsername = insertTextField("txtUsername", "disconnect",
- new String[]
- {
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- INTEGER_12, HelpIds.getHelpIdString(HID_FTP_USERNAME), "txtUsername", 110, 34, new Short((short) 4), 106
- });
- lblPassword = insertLabel("lblPassword",
- PROPNAMES_LABEL,
- new Object[]
- {
- INTEGERS[8], resources.reslblPassword_value, "lblPassword", INTEGER_12, 52, new Short((short) 5), 85
- });
- txtPassword = insertTextField("txtPassword", "disconnect",
- new String[]
- {
- "EchoChar", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- new Short((short) 42), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_PASS), "txtPassword", 110, 50, new Short((short) 6), 106
- });
- ln2 = insertFixedLine("ln2",
- PROPNAMES_LABEL,
- new Object[]
- {
- INTEGERS[8], resources.resln2_value, "ln2", INTEGERS[6], 68, new Short((short) 7), 210
- });
- btnTestConnection = insertButton("btnConnect", "connect",
- PROPNAMES_BUTTON,
- new Object[]
- {
- INTEGER_14, HelpIds.getHelpIdString(HID_FTP_TEST), resources.resbtnConnect_value, "btnConnect", INTEGER_12, 80, new Short((short) 8), INTEGER_50
- });
-
- imgStatus = insertImage("imgStatus",
- new String[]
- {
- PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", "Tabstop", PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- new Short((short) 0), INTEGER_14, 68, 80, Boolean.FALSE, Boolean.FALSE, INTEGER_14
- });
-
- lblStatus = insertLabel("lblStatus",
- PROPNAMES_LABEL,
- new Object[]
- {
- INTEGERS[8], resources.resFTPDisconnected, "lblStatus", 86, 82, new Short((short) 9), 99
- });
-
- ln3 = insertFixedLine("ln3",
- PROPNAMES_LABEL,
- new Object[]
- {
- INTEGERS[8], resources.resln3_value, "ln3", INTEGERS[6], 100, new Short((short) 10), 210
- });
-
- txtDir = insertTextField("txtDir",
- null, new String[]
- {
- PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, "Text", PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- Boolean.FALSE, INTEGER_12, HelpIds.getHelpIdString(HID_FTP_TXT_PATH), "txtDir", INTEGER_12, 113, new Short((short) 11), resources.restxtDir_value, 184
- });
- btnDir = insertButton("btnDir", "chooseDirectory",
- PROPNAMES_BUTTON,
- new Object[]
- {
- INTEGER_14, HelpIds.getHelpIdString(HID_FTP_BTN_PATH), resources.resbtnDir_value, "btnDir", 199, 112, new Short((short) 12), INTEGER_16
- });
-
- btnOK = insertButton("btnOK", null,
- PROPNAMES_BUTTON2,
- new Object[]
- {
- INTEGER_14, HelpIds.getHelpIdString(HID_FTP_OK), resources.resbtnOK_value, "btnOK", 165, 142, new Short((short) PushButtonType.OK_value), new Short((short) 13), INTEGER_50
- });
-
- btnCancel = insertButton("btnCancel",
- null, PROPNAMES_BUTTON2,
- new Object[]
- {
- INTEGER_14, HelpIds.getHelpIdString(HID_FTP_CANCEL), resources.resbtnCancel_value, "btnCancel", 113, 142, new Short((short) PushButtonType.CANCEL_value), new Short((short) 14), INTEGER_50
- });
-
- btnHelp = insertButton("btnHelp", null,
- PROPNAMES_BUTTON2,
- new Object[]
- {
- INTEGER_14, PropertyNames.EMPTY_STRING, resources.resbtnHelp_value, "btnHelp", 57, 142, new Short((short) PushButtonType.HELP_value), new Short((short) 15), INTEGER_50
- });
-
- }
-
- /**
- * Make hostname, username and password text fields data aware.
- */
- private void configure()
- {
- dataAware.add(UnoDataAware.attachEditControl(this, "host", txtHost, null, true));
- dataAware.add(UnoDataAware.attachEditControl(this, "username", txtUsername, null, true));
- dataAware.add(UnoDataAware.attachEditControl(this, "password", txtPassword, null, true));
- }
-
- /**
- * Shows the dialog.
- * If the user clicks ok, changes the given CGPublish properties to the
- * user input.
- * @param parent a dialog to center this dialog to.
- * @return 0 for cancel, 1 for ok.
- * @throws Exception - well, if something goes wrong...
- */
- public short execute(UnoDialog parent) throws Exception
- {
- host = extractHost(publish.cp_URL);
- username = publish.cp_Username == null ? PropertyNames.EMPTY_STRING : publish.cp_Username;
- password = publish.password == null ? PropertyNames.EMPTY_STRING : publish.password;
- dir = extractDir(publish.cp_URL);
- setLabel(STATUS_UNKONWN);
-
- enableTestButton();
- updateUI();
- short result = executeDialog(parent);
- //change the CGPublish properties
- if (result == 1)
- {
- publish.cp_URL = "ftp://" + host() + getDir();
- publish.cp_Username = username;
- publish.password = password;
- }
-
- return result;
- }
-
- /**
- * updates the hostname, username, password and
- * directory text fields.
- * is called uppon initialization.
- */
- private void updateUI()
- {
- DataAware.updateUI(dataAware);
- setDir(dir);
- }
-
- /**
- * extract the hostname out of the url used by the
- * publisher. This url does not include the username:password string.
- * @param ftpUrl
- * @return
- */
- private String extractHost(String ftpUrl)
- {
- if (ftpUrl == null || ftpUrl.length() < 6)
- {
- return PropertyNames.EMPTY_STRING;
- }
- String url = ftpUrl.substring(6);
- int i = url.indexOf("/");
- if (i == -1)
- {
- return url;
- }
- else
- {
- return url.substring(0, i);
- }
- }
-
- /**
- * used to get data from the CGPublish object.
- * @param ftpUrl
- * @return the directory portion of the ftp-url
- */
- private String extractDir(String ftpUrl)
- {
- if (ftpUrl == null || ftpUrl.length() < 6)
- {
- return "/";
- }
- String url = ftpUrl.substring(6);
- int i = url.indexOf("/");
- if (i == -1)
- {
- return "/";
- }
- else
- {
- return url.substring(i);
- }
- }
-
- /**
- * enables/disables the "test" button
- * according to the status of the hostname, username, password text fields.
- * If one of these fields is empty, the button is disabled.
- */
- private void enableTestButton()
- {
- setEnabled(btnTestConnection, !(isEmpty(host) || isEmpty(username) || isEmpty(password)));
-
- }
-
- /**
- * @param s
- * @return true if the string is null or PropertyNames.EMPTY_STRING.
- */
- private final boolean isEmpty(String s)
- {
- return (s == null) || (s.equals(PropertyNames.EMPTY_STRING));
- }
-
- /**
- * @return the ftp url with username and password,
- * but without the directory portion.
- */
- public String getAcountUrl()
- {
- return "ftp://" + username + ":" + password + "@" + host();
- }
-
- /**
- * return the host name without the "ftp://"
- * @return
- */
- private String host()
- {
- return host(host);
- }
-
- private static String host(String s)
- {
- return (s.startsWith("ftp://") ? s.substring(6) : s);
- }
-
- /**
- * @return the full ftp url including username, password and directory portion.
- */
- private String getFullUrl()
- {
- return getAcountUrl() + dir;
- }
-
- /**
- * First I try to connect to the full url, including directory.
- * If an InteractiveAugmentedIOException accures, I try again,
- * this time without the dir spec. If this works, I change the dir
- * to "/", if not I say to the user its his problem...
- *
- */
- public void connect()
- {
- setEnabled(btnTestConnection, false);
- setLabel(STATUS_CONNECTING);
- boolean success = false;
- try
- {
- connect(getFullUrl());
- success = true;
- }
- catch (InteractiveAugmentedIOException iaioex)
- {
- try
- {
- connect(getAcountUrl());
- setDir("/");
- success = true;
- }
- catch (Exception ex)
- {
- setLabel(STATUS_NO_RIGHTS);
- }
- }
- catch (InteractiveNetworkResolveNameException inrne)
- {
- setLabel(STATUS_SERVER_NOT_FOUND);
- }
- catch (AuthenticationRequest ar)
- {
- setLabel(STATUS_USER_PWD_WRONG);
- }
- catch (InteractiveNetworkConnectException incx)
- {
- setLabel(STATUS_HOST_UNREACHABLE);
- }
- catch (Exception ex)
- {
- setLabel(-1);
- ex.printStackTrace();
- }
-
-
- if (success)
- {
- setLabel(STATUS_OK);
- setEnabled(btnDir, true);
- setEnabled(btnOK, true);
- }
-
- setEnabled(btnTestConnection, true);
-
- }
-
- /**
- * To try the conenction I do some actions that
- * seem logical to me: <br/>
- * I get a ucb content.
- * I list the files in this content.
- * I call the ucb "open" command.
- * I get the PropertyNames.PROPERTY_TITLE property of this content.
- * @param acountUrl
- * @throws Exception
- */
- private void connect(String acountUrl) throws Exception
- {
- Object content = ucb.getContent(acountUrl);
-
- //list files in the content.
- List<String> l = ucb.listFiles(acountUrl, null);
-
- //open the content
- OpenCommandArgument2 aArg = new OpenCommandArgument2();
- aArg.Mode = OpenMode.FOLDERS; // FOLDER, DOCUMENTS -> simple filter
- aArg.Priority = 32768; // Ignored by most implementations
-
- ucb.executeCommand(content, "open", aArg);
-
- //get the title property of the content.
- Object obj = ucb.getContentProperty(content, PropertyNames.PROPERTY_TITLE, String.class);
-
- }
-
- /**
- * changes the ftp subdirectory, in both
- * the UI and the data.
- * @param s the directory.
- */
- public void setDir(String s)
- {
- dir = s;
- Helper.setUnoPropertyValue(getModel(txtDir), "Text", dir);
- }
-
- /**
- * @return the ftp subdirecrtory.
- */
- public String getDir()
- {
- return dir;
- }
-
- /**
- * changes the status label to disconnected status, and
- * disables the ok and choose-dir buttons.
- * This method is called also when the hostname, username
- * and passwordtext fields change.
- */
- public void disconnect()
- {
- enableTestButton();
- setEnabled(btnOK, false);
- setEnabled(btnDir, false);
- setLabel(STATUS_UNKONWN);
- }
-
- /**
- * used for debuging.
- * @param args
- */
- public static void main(String args[])
- {
- String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager";
- try
- {
- XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
- CGPublish p = new CGPublish();
- p.cp_URL = "ftp://tv-1/Folder";
- p.cp_Username = "ronftp";
- p.password = "ronftp";
-
- FTPDialog dialog = new FTPDialog(xLocMSF, p);
- dialog.execute(null);
- }
- catch (Exception exception)
- {
- exception.printStackTrace();
- }
- }
-
- /**
- * changes the status label and icon, according to the
- * given status
- * @param status one opf the private status-constants.
- * if this param is not one of them, an "unknown error" status is displayed.
- */
- private void setLabel(int status)
- {
- switch (status)
- {
- //not connected yet
- case STATUS_UNKONWN:
- setLabel(resources.resFTPDisconnected, ICON_UNKNOWN);
- break;
- //connected!
- case STATUS_OK:
- setLabel(resources.resFTPConnected, ICON_OK);
- break;
- case STATUS_USER_PWD_WRONG:
- setLabel(resources.resFTPUserPwdWrong, ICON_ERROR);
- break;
- //problem resolving server name
- case STATUS_SERVER_NOT_FOUND:
- setLabel(resources.resFTPServerNotFound, ICON_ERROR);
- break;
- //rights problem
- case STATUS_NO_RIGHTS:
- setLabel(resources.resFTPRights, ICON_ERROR);
- break;
- //host unreachable (firewall?)
- case STATUS_HOST_UNREACHABLE:
- setLabel(resources.resFTPHostUnreachable, ICON_ERROR);
- break;
- case STATUS_CONNECTING:
- setLabel(resources.resConnecting, ICON_CONNECTING);
- break;
- default:
- setLabel(resources.resFTPUnknownError, ICON_ERROR);
- }
- }
-
- /**
- * changes the text of the status label and
- * (TODO) the status image.
- * @param label
- * @param image
- */
- private void setLabel(String label, String image)
- {
- Helper.setUnoPropertyValue(getModel(lblStatus), PropertyNames.PROPERTY_LABEL, label);
- Helper.setUnoPropertyValue(getModel(imgStatus), PropertyNames.PROPERTY_IMAGEURL, imageUrl(image));
- }
-
- private String imageUrl(String s)
- {
- return imagesDirectory + s;
- }
-
- /**
- * called when the user clicks
- * the choose-dir button. ("...")
- * Opens the pickFolder dialog.
- * checks if the returned folder is an ftp folder.
- * sets the textbox and the data to the new selected dir.
- */
- public void chooseDirectory()
- {
- SystemDialog sd = SystemDialog.createOfficeFolderDialog(xMSF);
- String newUrl = sd.callFolderDialog(resources.resFTPDirectory, PropertyNames.EMPTY_STRING, getFullUrl());
- if (newUrl != null)
- {
- /* if the user chose a local directory,
- * sI do not accept it.
- */
- if (newUrl.startsWith("ftp://"))
- {
- setDir(extractDir(newUrl));
- }
- else
- {
- AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), resources.resIllegalFolder, ErrorHandler.ERROR_PROCESS_FATAL);
- }
- }
- }
-
- /**
- * practical to have such a method...
- * @param p the publisher obejct that contains the ftp connection info.
- * @return the full ftp url with username password and everything one needs.
- */
- public static final String getFullURL(CGPublish p)
- {
- return "ftp://" + p.cp_Username + ":" + p.password + "@" + host(p.cp_URL);
- }
-}
diff --git a/wizards/com/sun/star/wizards/web/FTPDialogResources.java b/wizards/com/sun/star/wizards/web/FTPDialogResources.java
deleted file mode 100644
index e0b61e3..0000000
--- a/wizards/com/sun/star/wizards/web/FTPDialogResources.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.wizards.common.Resource;
-
-public class FTPDialogResources extends Resource
-{
-
- final static String UNIT_NAME = "dbwizres";
- final static String MODULE_NAME = "dbw";
- final static int RID_FTPDIALOG_START = 4200;
- final static int RID_COMMON_START = 500;
- String resFTPDialog_title;
- String reslblUsername_value;
- String reslblPassword_value;
- String resbtnConnect_value;
- String resbtnOK_value;
- String resbtnHelp_value;
- String resbtnCancel_value;
- String resln1_value;
- String reslblFTPAddress_value;
- String resln2_value;
- String resln3_value;
- String restxtDir_value;
- String resbtnDir_value;
- String resFTPDisconnected;
- String resFTPConnected;
- String resFTPUserPwdWrong;
- String resFTPServerNotFound;
- String resFTPRights;
- String resFTPHostUnreachable;
- String resFTPUnknownError;
- String resFTPDirectory;
- String resIllegalFolder;
- String resConnecting;
-
- public FTPDialogResources(XMultiServiceFactory xmsf)
- {
- super(xmsf, UNIT_NAME, MODULE_NAME);
-
- /**
- * Delete the String, uncomment the getResText method
- *
- */
- resFTPDialog_title = getResText(RID_FTPDIALOG_START + 0);
- reslblUsername_value = getResText(RID_FTPDIALOG_START + 1);
- reslblPassword_value = getResText(RID_FTPDIALOG_START + 2);
- resbtnConnect_value = getResText(RID_FTPDIALOG_START + 3);
- resln1_value = getResText(RID_FTPDIALOG_START + 4);
- reslblFTPAddress_value = getResText(RID_FTPDIALOG_START + 5);
- resln2_value = getResText(RID_FTPDIALOG_START + 6);
- resln3_value = getResText(RID_FTPDIALOG_START + 7);
- resbtnDir_value = getResText(RID_FTPDIALOG_START + 8);
- resFTPDisconnected = getResText(RID_FTPDIALOG_START + 9);
- resFTPConnected = getResText(RID_FTPDIALOG_START + 10);
- resFTPUserPwdWrong = getResText(RID_FTPDIALOG_START + 11);
- resFTPServerNotFound = getResText(RID_FTPDIALOG_START + 12);
- resFTPRights = getResText(RID_FTPDIALOG_START + 13);
- resFTPHostUnreachable = getResText(RID_FTPDIALOG_START + 14);
- resFTPUnknownError = getResText(RID_FTPDIALOG_START + 15);
- resFTPDirectory = getResText(RID_FTPDIALOG_START + 16);
- resIllegalFolder = getResText(RID_FTPDIALOG_START + 17);
- resConnecting = getResText(RID_FTPDIALOG_START + 18);
-
- resbtnCancel_value = getResText(RID_COMMON_START + 11);
- resbtnOK_value = getResText(RID_COMMON_START + 18);
- resbtnHelp_value = getResText(RID_COMMON_START + 15);
-
- restxtDir_value = "/";
-
- }
-}
diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.java b/wizards/com/sun/star/wizards/web/IconsDialog.java
deleted file mode 100644
index 572834c..0000000
--- a/wizards/com/sun/star/wizards/web/IconsDialog.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import javax.swing.ListModel;
-
-import com.sun.star.awt.Size;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.wizards.common.ConfigSet;
-import com.sun.star.wizards.common.FileAccess;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.ui.ImageList;
-import com.sun.star.wizards.web.data.CGIconSet;
-
-/**
- * The dialog class for choosing an icon set.
- * This class simulates a model, though it does not functions really as one,
- * since it does not cast events.
- * It also implements the ImageList.ImageRenderer interface, to handle
- * its own objects.
- */
-public class IconsDialog extends ImageListDialog implements ImageList.IImageRenderer, ListModel
-{
-
- private ConfigSet set;
- String htmlexpDirectory;
- /**
- * this icons filename prefixes are used to display the icons.
- */
- private String[] icons = new String[]
- {
- "firs", "prev", "next", "last", "nav", "text", "up", "down"
- };
- private Integer[] objects;
-
- /**
- * @param xmsf
- * @param set_ the configuration set of the supported
- * icon sets.
- */
- public IconsDialog(XMultiServiceFactory xmsf,
- ConfigSet set_,
- WebWizardDialogResources resources)
- throws Exception
- {
- super(xmsf, WWHID.HID_IS, new String[]
- {
- resources.resIconsDialog,
- resources.resIconsDialogCaption,
- resources.resOK,
- resources.resCancel,
- resources.resHelp,
- resources.resDeselect,
- resources.resOther,
- resources.resCounter
- });
-
- htmlexpDirectory = FileAccess.getOfficePath(xmsf, "Gallery", "share", PropertyNames.EMPTY_STRING);
- set = set_;
- objects = new Integer[set.getSize() * icons.length];
- for (int i = 0; i < objects.length; i++)
- {
- objects[i] = new Integer(i);
- }
- il.setListModel(this);
- il.setRenderer(this);
- il.setRows(4);
- il.setCols(8);
- il.setImageSize(new Size(20, 20));
- il.setShowButtons(false);
- il.setRowSelect(true);
- il.scaleImages = Boolean.FALSE;
-
- showDeselectButton = true;
- showOtherButton = false;
-
- build();
- }
-
- public String getIconset()
- {
- if (getSelected() == null)
- {
- return null;
- }
- else
- {
- return (String) set.getKey(((Number) getSelected()).intValue() / icons.length);
- }
- }
-
- public void setIconset(String iconset)
- {
- int icon = set.getIndexOf(set.getElement(iconset)) * icons.length;
- this.setSelected(icon >= 0 ? objects[icon] : null);
- }
-
- public synchronized void addListDataListener(javax.swing.event.ListDataListener listener)
- {
- }
-
- public synchronized void removeListDataListener(javax.swing.event.ListDataListener listener)
- {
- }
-
- /* (non-Javadoc)
- * @see javax.swing.ListModel#getSize()
- */
- public int getSize()
- {
- return set.getSize() * icons.length;
- }
- /* (non-Javadoc)
- * @see javax.swing.ListModel#getElementAt(int)
- */
-
- public Object getElementAt(int arg0)
- {
- return objects[arg0];
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.ui.ImageList.ImageRenderer#getImageUrls(java.lang.Object)
- */
- public Object[] getImageUrls(Object listItem)
- {
- int i = ((Number) listItem).intValue();
- int iset = getIconsetNum(i);
- int icon = getIconNum(i);
- String[] sRetUrls = new String[2];
- sRetUrls[0] = htmlexpDirectory + "/htmlexpo/" +
- getIconsetPref(iset) +
- icons[icon] +
- getIconsetPostfix(iset);
- sRetUrls[1] = sRetUrls[0];
- return sRetUrls;
- }
- /* (non-Javadoc)
- * @see com.sun.star.wizards.common.Renderer#render(java.lang.Object)
- */
-
- public String render(Object object)
- {
- if (object == null)
- {
- return PropertyNames.EMPTY_STRING;
- }
- int i = ((Number) object).intValue();
- int iset = getIconsetNum(i);
- return getIconset(iset).cp_Name;
- }
-
- private int getIconsetNum(int i)
- {
- return i / icons.length;
- }
-
- private int getIconNum(int i)
- {
- return i % icons.length;
- }
-
- private String getIconsetPref(int iconset)
- {
- return getIconset(iconset).cp_FNPrefix;
- }
-
- private String getIconsetPostfix(int iconset)
- {
- return getIconset(iconset).cp_FNPostfix;
- }
-
- private CGIconSet getIconset(int i)
- {
- return (CGIconSet) set.getElementAt(i);
- }
-}
diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.java b/wizards/com/sun/star/wizards/web/ImageListDialog.java
deleted file mode 100644
index f9e446a..0000000
--- a/wizards/com/sun/star/wizards/web/ImageListDialog.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import com.sun.star.awt.FontDescriptor;
-import com.sun.star.awt.Size;
-import com.sun.star.awt.XButton;
-import com.sun.star.awt.XFixedText;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.wizards.common.Helper;
-import com.sun.star.wizards.common.HelpIds;
-import com.sun.star.wizards.common.JavaTools;
-import com.sun.star.wizards.common.IRenderer;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.ui.ImageList;
-import com.sun.star.wizards.ui.UIConsts;
-import com.sun.star.wizards.ui.UnoDialog2;
-import com.sun.star.wizards.ui.ImageList.Counter;
-
-/**
- * This class is a general implementation for a
- * dialog which displays a choice of images.
- * The model and the renderer are
- * still abstract in this class.
- * To use the class one should extend it,
- * in the constructor then set the imageList
- * properties (member name il) like image size, grid size,
- * model renderer aso, and then call "build".
- * This class uses a counter renderer which
- * gets an expression which contains %START %END %TOTAL and replaces
- * them with the actual numbers.
- * <BR/>
- * two buttons: "other" and "none" which are there
- * to enable choosing images that are not in the list and
- * "no image" respectivley, are optional, with default to true,
- * so dialogs which do not need those, should set the corresponding
- * members showDeselectButton and/or showOtherButton to false.
- * <br/>
- * the consturctor should receive, among others, an Array of String resources - see
- * constructor documentation for details.
- */
-public abstract class ImageListDialog extends UnoDialog2 implements UIConsts
-{
-
- private String[] resources;
- private final static int RES_TITLE = 0;
- private final static int RES_LABEL = 1;
- private final static int RES_OK = 2;
- private final static int RES_CANCEL = 3;
- private final static int RES_HELP = 4;
- private final static int RES_DESELECT = 5;
- private final static int RES_OTHER = 6;
- private final static int RES_COUNTER = 7; //GUI Components as Class members.
- private XButton btnOK;
- private XButton btnCancel;
- private XButton btnHelp;
- private XButton btnOther;
- private XButton btnDeselect;
- private static final String START = "%START";
- private static final String END = "%END";
- private static final String TOTAL = "%TOTAL";
- protected int cutFilename = 0;
- protected boolean showDeselectButton = true;
- protected boolean showOtherButton = true;
- private XFixedText lblTitle;
- //Font Descriptors as Class members.
- private FontDescriptor fontDescriptor1 = new FontDescriptor();
- protected ImageList il; //private FileAccess fileAccess;
- private Object result;
- private int hid;
-
- /**
- * @param xmsf
- * @param resources_ a string array with the following strings :
- * dialog title, label text, ok, cancel, help, deselect, other.
- * <br/> if "deselect" and "other" are not displayed,
- * the array can also be shorter. but if "other" is displayed
- * and "deselect" not, both must be there :-(
- */
- public ImageListDialog(
- XMultiServiceFactory xmsf, int hid_, String[] resources_)
- {
- super(xmsf);
- hid = hid_;
- resources = resources_;
- il = new ImageList();
- il.counterRenderer = new ARenderer(resources[RES_COUNTER]);
- }
-
- /**
- * adds the controls to the dialog, depending on
- * the size of the image list.
- * This method should be called by subclasses after setting
- * the il ImageList member properties
- */
- protected void build()
- {
- //set dialog properties...
-
- int ilWidth = (il.getImageSize().Width + il.getGap().Width) * il.getCols() + il.getGap().Width;
- int ilHeight = (il.getImageSize().Height + il.getGap().Height) * il.getRows() + il.getGap().Height;
-
- int dialogWidth = 6 + ilWidth + 6 + 50 + 6;
- int dialogHeight = 3 + 16 + 3 + (ilHeight + 8 + 14) + 6;
-
- Helper.setUnoPropertyValues(xDialogModel,
- new String[]
- {
- PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- Boolean.TRUE, new Integer(dialogHeight), HelpIds.getHelpIdString(hid), Boolean.TRUE, "imgDialog", 59, 24, INTEGERS[1], resources[RES_TITLE], new Integer(dialogWidth)
- });
- //Set member- FontDescriptors...
- fontDescriptor1.Weight = 150;
-
- final String[] PROPNAMES = new String[]
- {
- "DefaultButton", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- };
-
- Integer iButtonsX = new Integer(6 + ilWidth + 6);
-
- btnOK = insertButton("btnOK", null,
- PROPNAMES,
- new Object[]
- {
- Boolean.TRUE, INTEGER_14, HelpIds.getHelpIdString(hid + 3), resources[RES_OK], "btnOK", iButtonsX, 22, new Short((short) com.sun.star.awt.PushButtonType.OK_value), new Short((short) 7), INTEGER_50
- });
- btnCancel = insertButton("btnCancel", null,
- PROPNAMES,
- new Object[]
- {
- Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(hid + 4), resources[RES_CANCEL], "btnCancel", iButtonsX, 41, new Short((short) com.sun.star.awt.PushButtonType.CANCEL_value), new Short((short) 8), INTEGER_50
- });
- btnHelp = insertButton("btnHelp", null,
- PROPNAMES,
- new Object[]
- {
- Boolean.FALSE, INTEGER_14, PropertyNames.EMPTY_STRING, resources[RES_HELP], "CommandButton3", iButtonsX, 71, new Short((short) com.sun.star.awt.PushButtonType.HELP_value), new Short((short) 9), INTEGER_50
- });
-
- if (showOtherButton)
- {
-
- int otherY = 22 + ilHeight - 14 - (showDeselectButton ? 19 : 0);
-
- btnOther = insertButton("btnOther", "other",
- PROPNAMES,
- new Object[]
- {
- Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(hid + 1), resources[RES_OTHER], "btnOther", iButtonsX, new Integer(otherY), new Short((short) com.sun.star.awt.PushButtonType.STANDARD_value), new Short((short) 5), INTEGER_50
- });
- }
-
- if (showDeselectButton)
- {
-
- int deselectY = 22 + ilHeight - 14;
-
- btnDeselect = insertButton("btnNoImage", "deselect",
- PROPNAMES,
- new Object[]
- {
- Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(hid + 2), resources[RES_DESELECT], "btnNoImage", iButtonsX, new Integer(deselectY), new Short((short) com.sun.star.awt.PushButtonType.STANDARD_value), new Short((short) 4), INTEGER_50
- });
- }
-
- il.setStep(new Short((short) 1));
- il.setPos(new Size(6, 22));
- il.helpURL = hid + 5;
- il.tabIndex = 1;
- il.create(this);
-
- lblTitle = insertLabel("lblTitle",
- new String[]
- {
- PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- fontDescriptor1, INTEGERS[8], resources[RES_LABEL], "lblTitle", INTEGERS[6], INTEGERS[6], INTEGERS[1], new Short((short) 4), 216
- });
-
- }
-
- /**
- * is called when the user clicks "none"
- */
- public void deselect()
- {
- il.setSelected(-1);
- }
-
- /**
- * is called when the user clicks "other"
- *
- */
- public void other()
- {
- }
-
- /**
- * @return the currently elected object.
- */
- public Object getSelected()
- {
- return il.getSelectedObject();
- }
-
- /**
- * sets the currently selected object.
- * @param obj the object (out of the model) to be selected.
- */
- public void setSelected(Object obj)
- {
- il.setSelected(obj);
- il.showSelected();
- }
-
- /**
- * The counter renderer, which uses a template.
- * The template replaces the Strings "%START", "%END" and
- * "%TOTAL" with the respective values.
- *
- */
- public static class ARenderer implements IRenderer
- {
-
- String template;
-
- /**
- * @param aTemplate a template for this renderer.
- * The strings %START, %END ,%TOTAL will be replaced
- * with the actual values.
- */
- public ARenderer(String aTemplate)
- {
- template = aTemplate;
- }
-
- public String render(Object counter)
- {
- String s = JavaTools.replaceSubString(template, PropertyNames.EMPTY_STRING + ((Counter) counter).start, START);
- s = JavaTools.replaceSubString(s, PropertyNames.EMPTY_STRING + ((Counter) counter).end, END);
- s = JavaTools.replaceSubString(s, PropertyNames.EMPTY_STRING + ((Counter) counter).max, TOTAL);
- return s;
- }
- }
-}
diff --git a/wizards/com/sun/star/wizards/web/LogTaskListener.java b/wizards/com/sun/star/wizards/web/LogTaskListener.java
deleted file mode 100644
index b3784a5..0000000
--- a/wizards/com/sun/star/wizards/web/LogTaskListener.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.wizards.web;
-
-import com.sun.star.wizards.common.PropertyNames;
-import java.io.PrintStream;
-
-import com.sun.star.wizards.ui.event.TaskEvent;
-import com.sun.star.wizards.ui.event.TaskListener;
-
-/**
- * used for debugging.
- */
-public class LogTaskListener implements TaskListener, ErrorHandler
-{
-
- private PrintStream out;
-
- public LogTaskListener(PrintStream os)
- {
- out = os;
- }
-
- public LogTaskListener()
- {
- this(System.out);
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.web.status.TaskListener#taskStarted(com.sun.star.wizards.web.status.TaskEvent)
- */
- public void taskStarted(TaskEvent te)
- {
- out.println("TASK " + te.getTask().getTaskName() + " STARTED.");
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.web.status.TaskListener#taskFinished(com.sun.star.wizards.web.status.TaskEvent)
- */
- public void taskFinished(TaskEvent te)
- {
- out.println("TASK " + te.getTask().getTaskName() + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded.");
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.web.status.TaskListener#taskStatusChanged(com.sun.star.wizards.web.status.TaskEvent)
- */
- public void taskStatusChanged(TaskEvent te)
- {
- out.println("TASK " + te.getTask().getTaskName() + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax());
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent)
- */
- public void subtaskNameChanged(TaskEvent te)
- {
- out.println("SUBTASK Name:" + te.getTask().getSubtaskName());
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.web.status.ErrorReporter#error(java.lang.Exception, java.lang.Object, java.lang.String)
- */
- public boolean error(Exception ex, Object arg, int ix, int i)
- {
- System.out.println(PropertyNames.EMPTY_STRING + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage());
- ex.printStackTrace();
- return true;
- }
-}
diff --git a/wizards/com/sun/star/wizards/web/MANIFEST.MF b/wizards/com/sun/star/wizards/web/MANIFEST.MF
deleted file mode 100644
index 1a7a0e5..0000000
--- a/wizards/com/sun/star/wizards/web/MANIFEST.MF
+++ /dev/null
@@ -1,2 +0,0 @@
-RegistrationClassName: com.sun.star.wizards.web.CallWizard
-UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/web/Process.java b/wizards/com/sun/star/wizards/web/Process.java
deleted file mode 100644
index 42160c1..0000000
--- a/wizards/com/sun/star/wizards/web/Process.java
+++ /dev/null
@@ -1,808 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.web;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.w3c.dom.Document;
-
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.wizards.common.ConfigSet;
-import com.sun.star.wizards.common.FileAccess;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.common.UCB;
-import com.sun.star.wizards.ui.event.Task;
-import com.sun.star.wizards.web.data.CGContent;
-import com.sun.star.wizards.web.data.CGDocument;
-import com.sun.star.wizards.web.data.CGExporter;
-import com.sun.star.wizards.web.data.CGLayout;
-import com.sun.star.wizards.web.data.CGPublish;
-import com.sun.star.wizards.web.data.CGSettings;
-import com.sun.star.wizards.web.export.Exporter;
-
-/**
- * This class is used to process a CGSession object
- * and generate a site. </br>
- * it does the following: <br/>
- * 1. create a temporary directory.<br/>
- * 2. export documents to the temporary directory.<br/>
- * 3. generate the TOC page, includes copying images from the
- * web wizard work directory and other layout files.<br/>
- * 4. publish, or copy, from the temporary directory to
- * different destinations.<br/>
- * 5. delete the temporary directory.<br/>
- * <br/>
- * to follow up the status/errors it uses a TaskListener object,
- * and an ErrorHandler. <br/>
- * in practice, the TaskListener is the status dialog,
- * and the Errorhandler does the interaction with the user,
- * if something goes wrong.<br/>
- * Note that this class takes it in count that
- * the given session object is prepared for it -
- * all preparations are done in WWD_Events.finishWizard methods.
- * <br/>
- * <br/>
- *
- * note on error handling: <br/>
- * on "catch" clauses I tries to decide whether the
- * exception is fatal or not. For fatal exception an error message
- * is displayed (or rather: the errorHandler is being called...)
- * and a false is returned.
- * In less-fatal errors, the errorHandler "should decide" which means,
- * the user is given the option to "OK" or to "Cancel" and depending
- * on that interaction I cary on.
- */
-public class Process implements WebWizardConst, ProcessErrors
-{
-
- private static final int TASKS_PER_DOC = 5;
- private static final int TASKS_PER_XSL = 2;
- private static final int TASKS_PER_PUBLISH = 2;
- private static final int TASKS_IN_PREPARE = 1;
- private static final int TASKS_IN_EXPORT = 2;
- private static final int TASKS_IN_GENERATE = 2;
- private static final int TASKS_IN_PUBLISH = 2;
- private static final int TASKS_IN_FINISHUP = 1;
- private CGSettings settings;
- private XMultiServiceFactory xmsf;
- private ErrorHandler errorHandler;
- private String tempDir;
- private FileAccess fileAccess;
- private UCB ucb;
- public Task myTask;
- /**
- * This is a cache for exporters, so I do not need to
- * instanciate the same exporter more than once.
- */
- private Map<CGExporter, Exporter> exporters = new HashMap<CGExporter, Exporter>(3);
- private boolean result;
-
- public Process(
- CGSettings settings,
- XMultiServiceFactory xmsf,
- ErrorHandler er)
- throws Exception
- {
- this.xmsf = xmsf;
- this.settings = settings;
- fileAccess = new FileAccess(xmsf);
- errorHandler = er;
-
- ucb = new UCB(xmsf);
-
- int taskSteps = getTaskSteps();
- myTask = new Task(TASK, TASK_PREPARE, taskSteps);
-
- }
-
- /**
- * @return to how many destinations should the
- * generated site be published.
- */
- private int countPublish()
- {
- int count = 0;
- ConfigSet publishers = settings.cp_DefaultSession.cp_Publishing;
- for (int i = 0; i < publishers.getSize(); i++)
- {
- if (((CGPublish) publishers.getElementAt(i)).cp_Publish)
- {
- count++;
- }
- }
- return count;
- }
-
- /**
- * @return the number of task steps that this
- * session should have
- */
- private int getTaskSteps()
- {
- int docs = settings.cp_DefaultSession.cp_Content.cp_Documents.getSize();
- int xsl = 0;
- try
- {
- xsl = settings.cp_DefaultSession.getLayout().getTemplates(xmsf).size();
- }
- catch (Exception ex)
- {
- }
- int publish = countPublish();
- return
- TASKS_IN_PREPARE +
- TASKS_IN_EXPORT + docs * TASKS_PER_DOC +
- TASKS_IN_GENERATE + xsl * TASKS_PER_XSL +
- TASKS_IN_PUBLISH + publish * TASKS_PER_PUBLISH +
- TASKS_IN_FINISHUP;
- }
-
- /**
- * does the job
- */
- public void runProcess()
- {
- myTask.start();
- try
- {
- try
- {
- /*
- * I use here '&&' so if one of the
- * methods returns false, the next
- * will not be called.
- */
- result = createTempDir(myTask) && export(myTask) && generate(tempDir, myTask) && publish(tempDir, myTask);
-
- }
- finally
- {
- //cleanup must be called.
- result = result & cleanup(myTask);
- }
- }
- catch (Exception ex)
- {
- result = false;
- }
-
- if (!result)
- {
- myTask.fail(); //this is a bug protection.
- }
- while (myTask.getStatus() < myTask.getMax())
- {
- myTask.advance(true);
- }
- }
-
- /**
- * creates a temporary directory.
- * @param task
- * @return true should continue
- */
- private boolean createTempDir(Task task)
- {
-
- tempDir = fileAccess.createNewDir(getSOTempDir(xmsf), "wwiztemp");
- if (tempDir == null)
- {
- error(null, null, ERROR_MKDIR, ErrorHandler.ERROR_PROCESS_FATAL);
- return false;
- }
- else
- {
- task.advance(true);
- return true;
- }
- }
-
- /**
- * @param xmsf
- * @return the staroffice /openoffice temporary directory
- */
- static String getSOTempDir(XMultiServiceFactory xmsf)
- {
- try
- {
- return FileAccess.getOfficePath(xmsf, "Temp", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
- }
- catch (Exception e)
- {
- }
- return null;
- }
-
- // CLEANUP
- /**
- * delete the temporary directory
- * @return true should continue
- */
- private boolean cleanup(Task task)
- {
-
- task.setSubtaskName(TASK_FINISH);
- boolean b = fileAccess.delete(tempDir);
- if (!b)
- {
- error(null, null, ERROR_CLEANUP, ErrorHandler.ERROR_WARNING);
- }
- task.advance(b);
- return b;
- }
-
- /**
- * This method is used to copy style files to a target
- * Directory: css and background.
- * Note that this method is static since it is
- * also used when displaying a "preview"
- */
- public static void copyMedia(UCB copy, CGSettings settings, String targetDir, Task task) throws Exception
- {
-
- //1. .css
- String sourceDir = FileAccess.connectURLs(settings.workPath, "styles");
- String filename = settings.cp_DefaultSession.getStyle().cp_CssHref;
- copy.copy(sourceDir, filename, targetDir, "style.css");
-
- task.advance(true);
-
- //2. background image
- String background = settings.cp_DefaultSession.cp_Design.cp_BackgroundImage;
- if (background != null && !background.equals(PropertyNames.EMPTY_STRING))
- {
- sourceDir = FileAccess.getParentDir(background);
- filename = background.substring(sourceDir.length());
- copy.copy(sourceDir, filename, targetDir + "/images", "background.gif");
- }
-
- task.advance(true);
- }
-
- /**
- * Copy "static" files (which are always the same,
- * thus not user-input-dependant) to a target directory.
- * Note that this method is static since it is
- * also used when displaying a "preview"
- * @param copy
- * @param settings
- * @param targetDir
- * @throws Exception
- */
- public static void copyStaticImages(UCB copy, CGSettings settings, String targetDir)
- throws Exception
- {
- copy.copy(FileAccess.connectURLs(settings.workPath, "images"), targetDir + "/images");
- }
-
- /**
- * publish the given directory.
- * @param dir the source directory to publish from
- * @param task task tracking.
- * @return true if should continue
- */
- private boolean publish(String dir, Task task)
- {
- task.setSubtaskName(TASK_PUBLISH_PREPARE);
- ConfigSet set = settings.cp_DefaultSession.cp_Publishing;
- try
- {
-
- copyMedia(ucb, settings, dir, task);
- copyStaticImages(ucb, settings, dir);
- task.advance(true);
- }
- catch (Exception ex)
- {
- //error in copying media
- error(ex, PropertyNames.EMPTY_STRING, ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL);
- return false;
- }
-
- boolean result = true;
-
- for (int i = 0; i < set.getSize(); i++)
- {
-
- CGPublish p = (CGPublish) set.getElementAt(i);
-
- if (p.cp_Publish)
- {
-
- String key = (String) set.getKey(p);
- task.setSubtaskName(key);
-
- if (key.equals(ZIP_PUBLISHER))
- {
- fileAccess.delete(p.cp_URL);
- }
- if (!publish(dir, p, ucb, task))
- {
- return false;
- }
-
- }
- }
-
- return result;
- }
-
- /**
- * publish the given directory to the
- * given target CGPublish.
- * @param dir the dir to copy from
- * @param publish the object that specifies the target
- * @param copy ucb encapsulation
- * @param task task tracking
- * @return true if should continue
- */
- private boolean publish(String dir, CGPublish publish, UCB copy, Task task)
- {
- try
- {
- task.advance(true);
- copy.copy(dir, publish.url);
- task.advance(true);
- return true;
- }
- catch (Exception e)
- {
- task.advance(false);
- return error(e, publish, ERROR_PUBLISH, ErrorHandler.ERROR_NORMAL_IGNORE);
- }
- }
- /**
- * Generates the TOC pages for the current session.
- * @param targetDir generating to this directory.
- */
- public boolean generate(String targetDir, Task task)
- {
- boolean result = false;
- task.setSubtaskName(TASK_GENERATE_PREPARE);
-
-
- CGLayout layout = settings.cp_DefaultSession.getLayout();
-
- try
- {
- /*
- * here I create the DOM of the TOC to pass to the XSL
- */
- Document doc = (Document) settings.cp_DefaultSession.createDOM();
- generate(xmsf, layout, doc, fileAccess, targetDir, task);
-
- }
- catch (Exception ex)
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list