summaryrefslogtreecommitdiff
path: root/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper
diff options
context:
space:
mode:
Diffstat (limited to 'javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper')
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelLabel.java82
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelTitle.java116
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/TreeNodeRenderer.java89
3 files changed, 287 insertions, 0 deletions
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelLabel.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelLabel.java
new file mode 100755
index 000000000000..4fec3cfdb1c5
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelLabel.java
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.PanelHelper;
+
+import java.awt.Color;
+import java.awt.ComponentOrientation;
+import java.awt.Font;
+import javax.swing.JTextArea;
+import javax.swing.UIManager;
+import org.openoffice.setup.InstallData;
+
+public class PanelLabel extends JTextArea {
+
+ static private Color BackgroundColor;
+ static private Color TextColor;
+ static private Font TextFont;
+
+ public PanelLabel() {
+ }
+
+ public PanelLabel(String text, int rows, int columns) {
+ super(text, rows, columns);
+ init(true);
+ }
+
+ public PanelLabel(String text, boolean multiline) {
+ super(text);
+ init(multiline);
+ }
+
+ public PanelLabel(String text) {
+ super(text);
+ init(false);
+ }
+
+ private void init(boolean multiline) {
+ setEditable(false);
+ setBackground(BackgroundColor);
+ setForeground(TextColor);
+ setFont(TextFont);
+ setFocusable(false);
+
+ InstallData data = InstallData.getInstance();
+ if ( data.useRtl() ) { setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ if (multiline) {
+ setLineWrap(true);
+ setWrapStyleWord(true);
+ }
+ }
+
+ static {
+ BackgroundColor = (Color)UIManager.get("Label.background");
+ TextColor = (Color)UIManager.get("Label.foreground");
+ TextFont = ((Font)UIManager.get("Label.font")).deriveFont(Font.PLAIN);
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelTitle.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelTitle.java
new file mode 100755
index 000000000000..6b383473e541
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelTitle.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.PanelHelper;
+
+import java.awt.ComponentOrientation;
+import java.awt.FlowLayout;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSeparator;
+import org.openoffice.setup.InstallData;
+
+public class PanelTitle extends Box {
+
+ private JLabel TitleLabel;
+
+ public PanelTitle() {
+ super(BoxLayout.PAGE_AXIS);
+ }
+
+ public PanelTitle(String title, String subtitle, int rows, int columns) {
+ super(BoxLayout.PAGE_AXIS);
+ init(title, subtitle, rows, columns);
+ }
+
+ public PanelTitle(String title, String subtitle) {
+ super(BoxLayout.PAGE_AXIS);
+ init(title, subtitle, 0, 0);
+ }
+
+ public PanelTitle(String title) {
+ super (BoxLayout.PAGE_AXIS);
+ init(title, null, 0, 0);
+ }
+
+ public void addVerticalStrut(int strut) {
+ add(createVerticalStrut(strut));
+ }
+
+ public void setTitle(String title) {
+ TitleLabel.setText(title);
+ }
+
+ // public void setSubtitle(String subtitle) {
+ // SubtitleLabel.setText(subtitle);
+ // }
+
+ private void init(String title, String subtitle, int rows, int columns) {
+
+ InstallData data = InstallData.getInstance();
+
+ TitleLabel = new JLabel(title);
+ TitleLabel.setFocusable(false);
+ JPanel TitlePanel = new JPanel();
+ if ( data.useRtl() ) {
+ TitlePanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
+ TitleLabel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ } else {
+ TitlePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
+ }
+ TitlePanel.add(TitleLabel);
+
+ add(createVerticalStrut(10));
+ add(TitlePanel);
+ add(createVerticalStrut(10));
+ add(new JSeparator());
+ add(createVerticalStrut(20));
+
+ if (subtitle != null) {
+ PanelLabel SubtitleLabel = null;
+ if ( rows > 0 ) {
+ SubtitleLabel = new PanelLabel(subtitle, rows, columns );
+ } else {
+ SubtitleLabel = new PanelLabel(subtitle);
+ }
+ SubtitleLabel.setFocusable(false);
+ // PanelLabel SubtitleLabel = new PanelLabel(subtitle, true);
+ JPanel SubtitlePanel = new JPanel();
+ if ( data.useRtl() ) {
+ SubtitlePanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
+ SubtitleLabel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ } else {
+ SubtitlePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
+ }
+ SubtitlePanel.add(SubtitleLabel);
+
+ add(SubtitlePanel);
+ }
+ }
+} \ No newline at end of file
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/TreeNodeRenderer.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/TreeNodeRenderer.java
new file mode 100755
index 000000000000..7b9253d60ba8
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/TreeNodeRenderer.java
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.PanelHelper;
+
+import org.openoffice.setup.SetupData.DisplayPackageDescription;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.ResourceManager;
+import java.awt.Component;
+import javax.swing.ImageIcon;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+
+public class TreeNodeRenderer extends DefaultTreeCellRenderer {
+
+ ImageIcon InstallIcon;
+ ImageIcon InstalledIcon;
+ ImageIcon DontInstallIcon;
+ ImageIcon DontKnowIcon;
+ ImageIcon RemoveIcon;
+
+ public TreeNodeRenderer() {
+ InstallIcon = ResourceManager.getIcon("Icon_Install");
+ InstalledIcon = ResourceManager.getIcon("Icon_Installed");
+ DontInstallIcon = ResourceManager.getIcon("Icon_DontInstall");
+ DontKnowIcon = ResourceManager.getIcon("Icon_DontKnow");
+ RemoveIcon = ResourceManager.getIcon("Icon_Remove");
+ }
+
+ public Component getTreeCellRendererComponent(
+ JTree tree, Object value, boolean sel, boolean expanded,
+ boolean leaf, int row, boolean hasFocus) {
+
+ super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
+
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
+ Object nodeObject = node.getUserObject();
+
+ if (DisplayPackageDescription.is(nodeObject)) {
+ DisplayPackageDescription nodeInfo = (DisplayPackageDescription)nodeObject;
+
+ switch (nodeInfo.getState()) {
+ case PackageDescription.INSTALL: setIcon(InstallIcon); break;
+ case PackageDescription.DONT_REMOVE: setIcon(InstallIcon); break;
+ case PackageDescription.IGNORE: setIcon(InstalledIcon); break;
+ case PackageDescription.INSTALL_SOME: setIcon(DontKnowIcon); break;
+ case PackageDescription.REMOVE_SOME: setIcon(DontKnowIcon); break;
+ case PackageDescription.DONT_INSTALL: setIcon(DontInstallIcon); break;
+ case PackageDescription.REMOVE: setIcon(RemoveIcon); break;
+ default: setIcon(InstalledIcon); break;
+ }
+ }
+
+ if (sel) {
+ setBackground(super.getBackgroundSelectionColor());
+ setForeground(textSelectionColor);
+ } else {
+ setBackground(super.getBackgroundNonSelectionColor());
+ setForeground(textSelectionColor);
+ }
+
+ return this;
+ }
+}