From 43cc8ad33e815522e2b23ac87a4a9c4526cd85c9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 19 Dec 2014 16:03:41 +0200 Subject: java: remove dead code found by UCDetector Change-Id: I6b0f49529379072da566e927b86815f173e7a90b --- wizards/Jar_commonwizards.mk | 3 - .../com/sun/star/wizards/common/Properties.java | 22 - .../com/sun/star/wizards/common/SystemDialog.java | 3 - .../wizards/common/TerminateWizardException.java | 32 -- .../com/sun/star/wizards/db/CommandMetaData.java | 38 +- wizards/com/sun/star/wizards/db/DBMetaData.java | 5 - wizards/com/sun/star/wizards/db/FieldColumn.java | 10 - .../com/sun/star/wizards/document/FormHandler.java | 20 - .../sun/star/wizards/document/OfficeDocument.java | 19 - .../sun/star/wizards/form/FormControlArranger.java | 5 - .../com/sun/star/wizards/form/FormDocument.java | 7 - .../com/sun/star/wizards/query/QueryWizard.java | 6 - .../sun/star/wizards/report/ReportFinalizer.java | 11 - .../star/wizards/report/ReportTextDocument.java | 7 - .../com/sun/star/wizards/report/ReportWizard.java | 11 - .../reportbuilder/ReportBuilderImplementation.java | 1 + .../reportbuilder/layout/DesignTemplate.java | 4 - wizards/com/sun/star/wizards/table/Finalizer.java | 5 - .../sun/star/wizards/table/PrimaryKeyHandler.java | 5 - .../sun/star/wizards/table/ScenarioSelector.java | 6 - .../sun/star/wizards/ui/AggregateComponent.java | 7 - wizards/com/sun/star/wizards/ui/ButtonList.java | 81 ---- .../sun/star/wizards/ui/CommandFieldSelection.java | 2 +- .../com/sun/star/wizards/ui/FieldSelection.java | 5 - wizards/com/sun/star/wizards/ui/UnoDialog.java | 11 - wizards/com/sun/star/wizards/ui/WizardDialog.java | 37 -- .../com/sun/star/wizards/ui/event/DataAware.java | 170 ------- .../sun/star/wizards/ui/event/DataAwareFields.java | 488 --------------------- 28 files changed, 3 insertions(+), 1018 deletions(-) delete mode 100644 wizards/com/sun/star/wizards/common/TerminateWizardException.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/DataAware.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/DataAwareFields.java (limited to 'wizards') diff --git a/wizards/Jar_commonwizards.mk b/wizards/Jar_commonwizards.mk index 098a96d1172d..07d8dd45135d 100644 --- a/wizards/Jar_commonwizards.mk +++ b/wizards/Jar_commonwizards.mk @@ -46,7 +46,6 @@ $(eval $(call gb_Jar_add_sourcefiles,commonwizards,\ wizards/com/sun/star/wizards/common/SystemDialog \ wizards/com/sun/star/wizards/common/Configuration \ wizards/com/sun/star/wizards/common/IRenderer \ - wizards/com/sun/star/wizards/common/TerminateWizardException \ wizards/com/sun/star/wizards/common/DebugHelper \ wizards/com/sun/star/wizards/common/PropertySetHelper \ wizards/com/sun/star/wizards/common/NumericalHelper \ @@ -67,8 +66,6 @@ $(eval $(call gb_Jar_add_sourcefiles,commonwizards,\ wizards/com/sun/star/wizards/db/TableDescriptor \ wizards/com/sun/star/wizards/db/SQLQueryComposer \ wizards/com/sun/star/wizards/db/DatabaseObjectWizard \ - wizards/com/sun/star/wizards/ui/event/DataAware \ - wizards/com/sun/star/wizards/ui/event/DataAwareFields \ wizards/com/sun/star/wizards/ui/event/XActionListenerAdapter \ wizards/com/sun/star/wizards/ui/event/XItemListenerAdapter \ wizards/com/sun/star/wizards/ui/event/XTextListenerAdapter \ diff --git a/wizards/com/sun/star/wizards/common/Properties.java b/wizards/com/sun/star/wizards/common/Properties.java index 372c7c4a3b76..764703c74ac2 100644 --- a/wizards/com/sun/star/wizards/common/Properties.java +++ b/wizards/com/sun/star/wizards/common/Properties.java @@ -54,28 +54,6 @@ public class Properties extends HashMap return false; } - public PropertyValue[] getProperties() - { - return getProperties(this); - } - - private static PropertyValue[] getProperties(Map map) - { - PropertyValue[] pv = new PropertyValue[map.size()]; - - Iterator it = map.keySet().iterator(); - for (int i = 0; i < pv.length; i++) - { - pv[i] = createProperty(it.next(), map); - } - return pv; - } - - private static PropertyValue createProperty(String name, Map map) - { - return createProperty(name, map.get(name)); - } - public static PropertyValue createProperty(String name, Object value) { PropertyValue pv = new PropertyValue(); diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java index ac9168482212..a9800bc867c9 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.java +++ b/wizards/com/sun/star/wizards/common/SystemDialog.java @@ -18,7 +18,6 @@ package com.sun.star.wizards.common; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.ui.dialogs.*; import com.sun.star.uno.XInterface; import com.sun.star.uno.UnoRuntime; import com.sun.star.lang.XComponent; @@ -30,8 +29,6 @@ import com.sun.star.awt.XMessageBox; public class SystemDialog { - XFilterManager xFilterManager; - public static int showErrorBox(XMultiServiceFactory xMSF, String ResPrefix, int ResID, String AddTag, String AddString) { Resource oResource; diff --git a/wizards/com/sun/star/wizards/common/TerminateWizardException.java b/wizards/com/sun/star/wizards/common/TerminateWizardException.java deleted file mode 100644 index ba8e5717f2d1..000000000000 --- a/wizards/com/sun/star/wizards/common/TerminateWizardException.java +++ /dev/null @@ -1,32 +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.common; - -import com.sun.star.lang.XMultiServiceFactory; - -public class TerminateWizardException extends Exception -{ - - public TerminateWizardException(XMultiServiceFactory xMSF) - { - Resource oResource = new Resource(xMSF, "dbw"); - String sErrorMessage = oResource.getResText(1006); - SystemDialog.showMessageBox(xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, sErrorMessage); - printStackTrace(System.out); - } -} diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index da5a7bf00c3b..5b2b09ca31a1 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -60,8 +60,6 @@ public class CommandMetaData extends DBMetaData public String[] NonAggregateFieldNames; private int CommandType; private String Command; - private boolean bCatalogAtStart = true; - private String sCatalogSep = PropertyNames.EMPTY_STRING; private String sIdentifierQuote = PropertyNames.EMPTY_STRING; private boolean bCommandComposerAttributesalreadyRetrieved = false; @@ -468,16 +466,6 @@ public class CommandMetaData extends DBMetaData } } - public String[] getFieldTitles() - { - String[] sFieldTitles = new String[FieldColumns.length]; - for (int i = 0; i < FieldColumns.length; i++) - { - sFieldTitles[i] = FieldColumns[i].getFieldTitle(); - } - return sFieldTitles; - } - public void setGroupFieldNames(String[] GroupFieldNames) { this.GroupFieldNames = GroupFieldNames; @@ -527,7 +515,7 @@ public class CommandMetaData extends DBMetaData { try { - sCatalogSep = xDBMetaData.getCatalogSeparator(); + xDBMetaData.getCatalogSeparator(); sIdentifierQuote = xDBMetaData.getIdentifierQuoteString(); bCommandComposerAttributesalreadyRetrieved = true; } @@ -537,30 +525,6 @@ public class CommandMetaData extends DBMetaData } } - /** - * @return Returns the bCatalogAtStart. - */ - public boolean isCatalogAtStart() - { - if (!bCommandComposerAttributesalreadyRetrieved) - { - setCommandComposingAttributes(); - } - return bCatalogAtStart; - } - - /** - * @return Returns the sCatalogSep. - */ - public String getCatalogSeparator() - { - if (!bCommandComposerAttributesalreadyRetrieved) - { - setCommandComposingAttributes(); - } - return sCatalogSep; - } - /** * @return Returns the sIdentifierQuote. */ diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index f870e96b685b..2187d174db54 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -410,11 +410,6 @@ public class DBMetaData return iMaxColumnsInSelect; } - public int getMaxColumnsInGroupBy() - { - return iMaxColumnsInGroupBy; - } - private void setMaxColumnsInSelect() throws SQLException { iMaxColumnsInSelect = xDBMetaData.getMaxColumnsInSelect(); diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java index 808c75933739..1978a4d0cfb3 100644 --- a/wizards/com/sun/star/wizards/db/FieldColumn.java +++ b/wizards/com/sun/star/wizards/db/FieldColumn.java @@ -123,11 +123,6 @@ public class FieldColumn return m_nDBFormatKey; } - public int getStandardFormatKey() - { - getFieldType(); // will collect meta data 'bout the column, if not already done so - return StandardFormatKey; - } public boolean isNumberFormat() { getFieldType(); // will collect meta data 'bout the column, if not already done so @@ -184,11 +179,6 @@ public class FieldColumn return m_xColPropertySet; } - public void setCommandName(String _CommandName) - { - m_sCommandName = _CommandName; - } - public String getDisplayFieldName() { return m_sDisplayFieldName; diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index 8a34ec8d4238..0c4c976395ed 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -76,7 +76,6 @@ public class FormHandler public final static int SOGRIDCONTROL = 6; public final static int SOIMAGECONTROL = 7; public final static int SODATETIMECONTROL = 8; - private int iImageControlHeight = 2000; public static String SOSIZETEXT = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog."; private int iXPixelFactor = -1; private int iYPixelFactor = -1; @@ -361,25 +360,6 @@ public class FormHandler return iYPixelFactor; } - public void setXPixelFactor(int i) - { - iXPixelFactor = i; - } - - public void setYPixelFactor(int i) - { - iYPixelFactor = i; - } - - public int getImageControlHeight() - { - return iImageControlHeight; - } - - public void setImageControlHeight(int i) - { - iImageControlHeight = i; - } // Note: as Shapes cannot be removed from the DrawPage without destroying // the object we have to park them somewhere beyond the visible area of the page public void moveShapesToNirwana(Control[] ControlList) diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java index 7e0202d095c5..a4f166c54def 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.java +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java @@ -50,8 +50,6 @@ import com.sun.star.util.XModifiable; public class OfficeDocument { - private XWindowPeer xWindowPeer; - public static void dispose(XMultiServiceFactory xMSF, XComponent xComponent) { try @@ -248,21 +246,4 @@ public class OfficeDocument } } - /** - * @return Returns the xWindowPeer. - */ - public XWindowPeer getWindowPeer() - { - return xWindowPeer; - } - - /** - * @param windowPeer The xWindowPeer to set. - * Should be called as soon as a Windowpeer of a wizard dialog is available - * The windowpeer is needed to call a Messagebox - */ - public void setWindowPeer(XWindowPeer windowPeer) - { - xWindowPeer = windowPeer; - } } diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index 293d4b3f8b41..afeedd433e10 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -103,11 +103,6 @@ public class FormControlArranger return oFormHandler.getBasicLabelDiffHeight(); } - public void setBorderType(short _nBorderType) - { - NBorderType = Short.valueOf(_nBorderType); - } - public Control[] getLabelControlList() { return LabelControlList; diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index 3aed54d71904..4f2489fa2b86 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -277,13 +277,6 @@ public class FormDocument extends TextDocument return null; } - public ControlForm[] getControlForms() - { - ControlForm[] aResult = new ControlForm[oControlForms.size()]; - oControlForms.toArray( aResult ); - return aResult; - } - public boolean finalizeForms(DataEntrySetter _curDataEntrySetter, FieldLinker _curFieldLinker, FormConfiguration _curFormConfiguration) { try diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index 098513eb8a2e..a067ffbcb3eb 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -21,7 +21,6 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; -import com.sun.star.frame.XFrame; import com.sun.star.sdb.CommandType; import com.sun.star.sdbc.SQLException; import com.sun.star.uno.AnyConverter; @@ -86,11 +85,6 @@ public class QueryWizard extends DatabaseObjectWizard }); } - public final XFrame getFrame() - { - return m_frame; - } - public String start() { try diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java index 1d3e3aa72c7d..a068c7082709 100644 --- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java +++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java @@ -23,7 +23,6 @@ import com.sun.star.awt.XTextComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.Exception; import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.FileAccess; import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.db.RecordParser; @@ -43,11 +42,8 @@ public class ReportFinalizer public static final int SOCREATEDOCUMENT = 1; public static final int SOCREATETEMPLATE = 2; public static final int SOUSETEMPLATE = 3; - private final XMultiServiceFactory m_xMSF; public ReportFinalizer(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, WizardDialog _CurUnoDialog) { - m_xMSF = _xMSF; - this.CurUnoDialog = _CurUnoDialog; this.CurReportDocument = _CurReportDocument; short curtabindex = (short) (ReportWizard.SOSTOREPAGE * 100); @@ -209,13 +205,6 @@ public class ReportFinalizer return (StoreName); } - public String getStorePath() - { - StoreName = getStoreName(); - String StorePath = FileAccess.getOfficePath(m_xMSF, "Temp") + "/" + StoreName; - return StorePath; - } - private void changeReportTitle() { final String TitleName = xTitleTextBox.getText(); diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index c2d47b7dc263..9fb9ef678bf5 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -110,13 +110,6 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen getReportPageStyles(); } - public NumberFormatter getNumberFormatter() - { - return oNumberFormatter; - } - - - public void swapContentTemplate(String ContentTemplatePath) { this.ContentTemplatePath = ContentTemplatePath; diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index cb6fcf71b8b9..c8353932e161 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -613,17 +613,6 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener { } - public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue) - { - switch (_ndialogpage) - { - case SOMAINPAGE: - break; - default: - break; - } - } - private void toggleSortingPage() { int nlCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType(); diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index a090b36b00fc..ef07f83daa1d 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -60,6 +60,7 @@ import com.sun.star.wizards.ui.UIConsts; * This class use the IReportDocument Interface to communicate between the UI * and the ReportBuilderLayouter which communicates to the new Sun Report Builder. */ +@SuppressWarnings("ucd") public class ReportBuilderImplementation extends ReportImplementationHelper implements IReportDocument, IReportDefinitionReadAccess { diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java index 974464a43de3..6d332705664e 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java @@ -299,8 +299,4 @@ public class DesignTemplate analyseReportDefinition(); } - public XReportDefinition getReportDefinition() - { - return m_xReportDefinition; - } } diff --git a/wizards/com/sun/star/wizards/table/Finalizer.java b/wizards/com/sun/star/wizards/table/Finalizer.java index 13414695d702..b824d515e9cd 100644 --- a/wizards/com/sun/star/wizards/table/Finalizer.java +++ b/wizards/com/sun/star/wizards/table/Finalizer.java @@ -305,11 +305,6 @@ public class Finalizer } } - public String getTableName() - { - return txtTableName.getText(); - } - public String getTableName(String _firsttablename) { if (txtTableName.getText().equals(PropertyNames.EMPTY_STRING)) diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index 050e5046a549..e715a7732b45 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -449,11 +449,6 @@ public class PrimaryKeyHandler implements XFieldSelectionListener return null; } - public int getID() - { - return 0; - } - public void moveItemDown(String Selitem) { } diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 99958fa72587..ac650759931f 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -293,12 +293,6 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X public void disposing(EventObject arg0) { } - private int ID; - - public int getID() - { - return ID; - } public void setID(String sIncSuffix) { diff --git a/wizards/com/sun/star/wizards/ui/AggregateComponent.java b/wizards/com/sun/star/wizards/ui/AggregateComponent.java index 4e2102f9ba2d..6957bdb2d62a 100644 --- a/wizards/com/sun/star/wizards/ui/AggregateComponent.java +++ b/wizards/com/sun/star/wizards/ui/AggregateComponent.java @@ -48,7 +48,6 @@ public class AggregateComponent extends ControlScroller private String slblAggregate; private String slblFieldNames; private String sDuplicateAggregateFunction; - private int Count; private static final int SOADDROW = 1; private static final int SOREMOVEROW = 2; private ArrayList ControlRowVector; @@ -61,7 +60,6 @@ public class AggregateComponent extends ControlScroller try { this.CurDBMetaData = _CurDBMetaData; - Count = 1; CurUnoDialog.insertRadioButton("optDetailQuery", 0, new ActionListenerImpl(), new String[] { @@ -177,11 +175,6 @@ public class AggregateComponent extends ControlScroller } } - public int getCount() - { - return Count; - } - protected void insertControlGroup(int i, int ypos) { if (i == 0) diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java index 6fab9de4a712..51a7c84a2481 100644 --- a/wizards/com/sun/star/wizards/ui/ButtonList.java +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -52,7 +52,6 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener private int rows = 3; private Size m_aButtonSize = new Size(20, 20); private Size pos; - private Size selectionGap = new Size(2, 2); private boolean showButtons = true; private Short step; private static final boolean refreshOverNull = true; @@ -68,14 +67,6 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener private IRenderer counterRenderer = new SimpleCounterRenderer(); private final static int LINE_HEIGHT = 8; - /** Getter for property m_aButtonSize. - * @return Value of property m_aButtonSize. - * - */ - public Size getButtonSize() - { - return this.m_aButtonSize; - } public void setName(String _sName) { m_aControlName = _sName; @@ -410,61 +401,16 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener } } - public int getCols() - { - return cols; - } - - public Size getGap() - { - return gap; - } - private ListModel getListModel() { return listModel; } - public Short getStep() - { - return step; - } - - public int getPageStart() - { - return pageStart; - } - - public Size getPos() - { - return pos; - } - - public IImageRenderer getRenderer() - { - return renderer; - } - - public int getRows() - { - return rows; - } - public int getSelected() { return m_nCurrentSelection; } - public Size getSelectionGap() - { - return selectionGap; - } - - public boolean isShowButtons() - { - return showButtons; - } - public void setCols(int i) { cols = i; @@ -540,7 +486,6 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener public void setSelectionGap(Size size) { - selectionGap = size; } public void setShowButtons(boolean b) @@ -586,15 +531,6 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener return UnoRuntime.queryInterface(XControl.class, control).getModel(); } - public Object[] getSelectedObjects() - { - return new Object[] - { - getListModel().getElementAt(m_nCurrentSelection) - }; - } - - public interface IImageRenderer extends IRenderer { @@ -627,23 +563,6 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener } } - public Object getSelectedObject() - { - return m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null; - } - - - public void setRowSelect(boolean b) - { - rowSelect = b; - } - - public boolean isRowSelect() - { - return rowSelect; - } - - public boolean isenabled() { return benabled; diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java index 59bd1c770644..5638da4f5fbf 100644 --- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java @@ -245,7 +245,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator< * @return * @throws com.sun.star.wizards.common.TerminateWizardException */ - private short fillupCommandListBox() throws com.sun.star.wizards.common.TerminateWizardException + private short fillupCommandListBox() { short[] iSelArray = new short[0]; boolean bgetFields = false; diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java index f20007434f60..88dea0fe9f14 100644 --- a/wizards/com/sun/star/wizards/ui/FieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java @@ -139,11 +139,6 @@ public class FieldSelection AppendMode = _AppendMode; } - public boolean getAppendMode() - { - return AppendMode; - } - public FieldSelection(UnoDialog CurUnoDialog, int _iStep, int CompPosX, int CompPosY, int CompWidth, int CompHeight, String slblFields, String slblSelFields, int _FirstHelpIndex, boolean bshowFourButtons) { try diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java index 0587e0cc32e5..07560e0a12cd 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -541,17 +541,6 @@ public class UnoDialog return xDialog.execute(); } - public void setVisible(UnoDialog parent) throws com.sun.star.uno.Exception - { - calculateDialogPosition(parent.xWindow.getPosSize()); - if (xWindowPeer == null) - { - createWindowPeer(); - } - xDialog = UnoRuntime.queryInterface(XDialog.class, xUnoDialog); - this.xWindow.setVisible(true); - } - /** * @return 0 for cancel, 1 for ok. */ diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index 523673ab5a5b..615429872884 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -102,26 +102,6 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL nMaxStep = i; } - public int getMaxStep() - { - return nMaxStep; - } - - public void setOldStep(int i) - { - nOldStep = i; - } - - public int getOldStep() - { - return nOldStep; - } - - public void setNewStep(int i) - { - nNewStep = i; - } - public int getNewStep() { return nNewStep; @@ -252,18 +232,6 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL sRMItemLabels = _oResource.getResArray(StartResID, nMaxStep); } - public String[] getRMItemLabels() - { - return sRMItemLabels; - } - - /* public void insertRoadmapItems(int StartIndex, int RMCount) - { - Object oRoadmapItem; - boolean bEnabled; - for (int i = StartIndex; i < (StartIndex + RMCount); i++) - insertSingleRoadmapItem(i, true, sRMItemLabels[i], i); - }*/ public int insertRoadmapItem(int _Index, boolean _bEnabled, int _LabelID, int _CurItemID) { return insertRoadmapItem(_Index, _bEnabled, sRMItemLabels[_LabelID], _CurItemID); @@ -614,11 +582,6 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL removeTerminateListener(); } - public int getMaximalStep() - { - return this.nMaxStep; - } - public int getCurrentStep() { try diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java deleted file mode 100644 index 61e5e3f8b478..000000000000 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ /dev/null @@ -1,170 +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.ui.event; - -import java.util.Arrays; - -/** - * DataAware objects are used to live-synchronize UI and DataModel/DataObject. - * It is used as listener on UI events, to keep the DataObject up to date. - * This class, as a base abstract class, sets a frame of functionality, - * delegating the data Object get/set methods to a Value object, - * and leaving the UI get/set methods abstract. - * Note that event listenning is *not* a part of this model. - * the updateData() or updateUI() methods should be porogramatically called. - * in child classes, the updateData() will be binded to UI event calls. - *

- * This class holds references to a Data Object and a Value object. - * The Value object "knows" how to get and set a value from the - * Data Object. - */ -public abstract class DataAware { - - /** - * this is the data object. - */ - private Object dataObject; - /** - * A Value Object knows how to get/set a value - * from/to the data object. - */ - private Value value; - - /** - * creates a DataAware object for the given data object and Value object. - * @param dataObject_ - * @param value_ - */ - protected DataAware(Object dataObject_, Value value_) { - dataObject = dataObject_; - value = value_; - } - - /** - * returns the data object. - */ - private Object getDataObject() { - return dataObject; - } - - /** - * Sets the given value to the data object. - * this method delegates the job to the - * Value object, but can be overwritten if - * another kind of Data is needed. - * @param newValue the new value to set to the DataObject. - */ - private void setToData(Object newValue) { - value.set(newValue,getDataObject()); - } - - /** - * gets the current value from the data object. - * this method delegates the job to - * the value object. - * @return the current value of the data object. - */ - private Object getFromData() { - return value.get(getDataObject()); - } - - /** - * sets the given value to the UI control - * @param newValue the value to set to the ui control. - */ - protected abstract void setToUI(Object newValue); - - /** - * gets the current value from the UI control. - * @return the current value from the UI control. - */ - protected abstract Object getFromUI(); - - /** - * enables - * @param currentValue - */ - private void enableControls(Object currentValue) { - } - - /** - * updates the DataObject according to - * the current state of the UI control. - */ - public void updateData() { - Object data = getFromData(); - Object ui = getFromUI(); - if (!equals(data, ui)) - setToData(ui); - enableControls(ui); - } - - /** - * compares the two given objects. - * This method is null safe and returns true also if both are null... - * If both are arrays, treats them as array of short and compares them. - * @param a first object to compare - * @param b second object to compare. - * @return true if both are null or both are equal. - */ - private boolean equals(Object a, Object b) { - if (a == null && b == null) - return true; - if (a == null || b == null) - return false; - if (a.getClass().isArray()) { - if (b.getClass().isArray()) - return Arrays.equals((short[]) a, (short[]) b); - else - return false; - } - return a.equals(b); - } - - - - - - - - /** - * Value objects read and write a value from and - * to an object. Typically using reflection and JavaBeans properties - * or directly using member reflection API. - * DataAware delegates the handling of the DataObject - * to a Value object. - * 2 implementations currently exist: PropertyValue, - * using JavaBeans properties reflection, and DataAwareFields classes - * which implement different member types. - */ - interface Value { - /** - * gets a value from the given object. - * @param target the object to get the value from. - * @return the value from the given object. - */ - Object get(Object target); - /** - * sets a value to the given object. - * @param value the value to set to the object. - * @param target the object to set the value to. - */ - void set(Object value, Object target); - } - -} diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java deleted file mode 100644 index ee5ba4df539c..000000000000 --- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java +++ /dev/null @@ -1,488 +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.ui.event; - -import java.lang.reflect.Field; - -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.uno.Any; - -/** - * This class is a factory for Value objects for different types of - * members. - * Other than some Value implementations classes this class contains static - * type conversion methods and factory methods. - * - * @see com.sun.star.wizards.ui.event.DataAware.Value - */ -public class DataAwareFields -{ - - private static final String TRUE = "true"; - - /** - * returns a Value Object which sets and gets values - * and converting them to other types, according to the "value" argument. - */ - public static DataAware.Value getFieldValueFor(Object owner, String fieldname, Object value) - { - try - { - Field f = owner.getClass().getField(fieldname); - - Class c = f.getType(); - Class c2 = value.getClass(); - if (c.equals(Boolean.TYPE)) - { - return new BooleanFieldValue(f, c2); - } - else if (c.equals(Integer.TYPE)) - { - return new IntFieldValue(f, c2); - } - else if (c.equals(Double.TYPE)) - { - return new DoubleFieldValue(f, c2); - } - else if (c.equals(String.class) && c2.equals(Integer.class)) - { - return new ConvertedStringValue(f, c2); - } - else - { - return new SimpleFieldValue(f); - } - } - catch (NoSuchFieldException ex) - { - ex.printStackTrace(); - return null; - } - } - - /** - * an abstract implementation of DataAware.Value to access - * object members (fields) using reflection. - */ - private static abstract class FieldValue implements DataAware.Value - { - - Field field; - - public FieldValue(Field field_) - { - field = field_; - } - - } - - private static class BooleanFieldValue extends FieldValue - { - - private final Class convertTo; - - public BooleanFieldValue(Field f, Class convertTo_) - { - super(f); - convertTo = convertTo_; - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object) - */ - public Object get(Object target) - { - try - { - boolean b = field.getBoolean(target); - if (convertTo.equals(Boolean.class)) - { - return b ? Boolean.TRUE : Boolean.FALSE; - } - else if (Number.class.isAssignableFrom(convertTo)) - { - return toNumber(b ? 1 : 0, convertTo); - } - else if (convertTo.equals(String.class)) - { - return String.valueOf(b); - } - else if (convertTo.isArray()) - { - return toShortArray(toInt(b)); - } - else - { - throw new IllegalArgumentException("Cannot convert boolean value to given type (" + convertTo.getName() + ")."); - } - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - return null; - } - } - - public void set(Object value, Object target) - { - try - { - field.setBoolean(target, toBoolean(value)); - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - } - } - } - - private static class IntFieldValue extends FieldValue - { - - private final Class convertTo; - - public IntFieldValue(Field f, Class convertTo_) - { - super(f); - convertTo = convertTo_; - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object) - */ - public Object get(Object target) - { - try - { - int i = field.getInt(target); - if (convertTo.equals(Boolean.class)) - { - return i != 0 ? Boolean.TRUE : Boolean.FALSE; - } - else if (Number.class.isAssignableFrom(convertTo)) - { - return toNumber(i, convertTo); - } - else if (convertTo.equals(String.class)) - { - return String.valueOf(i); - } - else if (convertTo.isArray()) - { - return toShortArray(i); - } - else - { - throw new IllegalArgumentException("Cannot convert int value to given type (" + convertTo.getName() + ")."); - } - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - return null; - } - } - - public void set(Object value, Object target) - { - try - { - field.setInt(target, (int) toDouble(value)); - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - } - } - } - - private static class DoubleFieldValue extends FieldValue - { - - private final Class convertTo; - - public DoubleFieldValue(Field f, Class convertTo_) - { - super(f); - convertTo = convertTo_; - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object) - */ - public Object get(Object target) - { - try - { - double d = field.getDouble(target); - if (convertTo.equals(Boolean.class)) - { - return d != 0 ? Boolean.TRUE : Boolean.FALSE; - } - else if (Number.class.isAssignableFrom(convertTo)) - { - return toNumber(d, convertTo); - } - else if (convertTo.equals(String.class)) - { - return String.valueOf(d); - } - else if (convertTo.isArray()) - { - return toShortArray(d); - } - else - { - throw new IllegalArgumentException("Cannot convert int value to given type (" + convertTo.getName() + ")."); - } - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - return null; - } - } - - public void set(Object value, Object target) - { - try - { - field.setDouble(target, toDouble(value)); - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - } - } - } - - private static class ConvertedStringValue extends FieldValue - { - - private final Class convertTo; - - public ConvertedStringValue(Field f, Class convertTo_) - { - super(f); - convertTo = convertTo_; - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object) - */ - public Object get(Object target) - { - try - { - String s = (String) field.get(target); - - if (convertTo.equals(Boolean.class)) - { - return (s != null && !s.equals(PropertyNames.EMPTY_STRING) && s.equals("true")) ? Boolean.TRUE : Boolean.FALSE; - } - else if (convertTo.equals(Integer.class)) - { - if (s == null || s.equals(PropertyNames.EMPTY_STRING)) - { - return Any.VOID; - } - else - { - return Integer.valueOf(s); - } - } - else if (convertTo.equals(Double.class)) - { - if (s == null || s.equals(PropertyNames.EMPTY_STRING)) - { - return Any.VOID; - } - else - { - return new Double(s); - } - } - else - { - throw new IllegalArgumentException("Cannot convert int value to given type (" + convertTo.getName() + ")."); - } - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - return null; - } - } - - public void set(Object value, Object target) - { - try - { - field.set(target, value == null || (value.equals(Any.VOID)) ? PropertyNames.EMPTY_STRING : value.toString()); - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - } - } - } - - private static class SimpleFieldValue extends FieldValue - { - - public SimpleFieldValue(Field f) - { - super(f); - } - /* (non-Javadoc) - * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object) - */ - - public Object get(Object target) - { - try - { - if (target == null) - { - if (field.getType().equals(String.class)) - { - return PropertyNames.EMPTY_STRING; - } - if (field.getType().equals(Short.class)) - { - return Short.valueOf((short) 0); - } - if (field.getType().equals(Integer.class)) - { - return 0; - } - if (field.getType().equals(short[].class)) - { - return new short[0]; - } - else - { - return null; - } - } - else - { - return field.get(target); - } - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - return null; - } - } - - public void set(Object value, Object target) - { - try - { - field.set(target, value); - } - catch (IllegalAccessException ex) - { - ex.printStackTrace(); - } - } - } - - private static double toDouble(Object value) - { - if (value instanceof Boolean) - { - return ((Boolean) value).booleanValue() ? 1 : 0; - } - else if (value instanceof Number) - { - return ((Number) value).doubleValue(); - } - else if (value instanceof String) - { - return Double.parseDouble((String) value); - } - else if (value instanceof short[]) - { - return ((short[]) value).length == 0 ? 0 : ((short[]) value)[0]; - } - else - { - throw new IllegalArgumentException("Can't convert value to double." + value.getClass().getName()); - } - } - - private static boolean toBoolean(Object value) - { - if (value instanceof Boolean) - { - return ((Boolean) value).booleanValue(); - } - else if (value instanceof Number) - { - return ((Number) value).intValue() != 0; - } - else if (value instanceof String) - { - return value.equals(TRUE); - } - else if (value instanceof short[]) - { - return ((short[]) value).length != 0 && ((short[]) value)[0] != 0; - } - else - { - throw new IllegalArgumentException("Can't convert value to boolean." + value.getClass().getName()); - } - } - - private static int toInt(boolean b) - { - return b ? 1 : 0; - } - - private static short[] toShortArray(double i) - { - return new short[] - { - (short) i - }; - } - - private static Number toNumber(double i, Class c) - { - if (c.equals(Integer.class)) - { - return Integer.valueOf((int) i); - } - else if (c.equals(Short.class)) - { - return Short.valueOf((short) i); - } - else if (c.equals(Double.class)) - { - return new Double(i); - } - else - { - throw new IllegalArgumentException("Cannot convert to the given Number type."); - } - } -} -- cgit