mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Continue working on themes.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@6021 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -205,24 +205,6 @@
|
||||
</SOURCES>
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../lib/dist/windows/jdic_stub.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../lib/dist/Tidy.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntryProperties />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
|
||||
@ -341,5 +341,9 @@ public final class Spark {
|
||||
UIManager.put("Notification.foreground", new Color(51, 153, 51));
|
||||
UIManager.put("Error.foreground", Color.red);
|
||||
UIManager.put("Question.foreground", Color.red);
|
||||
|
||||
UIManager.put("SparkTabbedPane.startColor", new Color(236, 236, 236));
|
||||
UIManager.put("SparkTabbedPane.endColor", new Color(236, 236, 236));
|
||||
UIManager.put("SparkTabbedPane.borderColor", Color.lightGray);
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@ APPLICATION_NAME = Spark
|
||||
SHORT_NAME = spark
|
||||
LOGIN_DIALOG_BACKGROUND_IMAGE = images/login_dialog_background.png
|
||||
TOP_BOTTOM_BACKGROUND_IMAGE = images/top_bottom_background_image.png
|
||||
SECONDARY_BACKGROUND_IMAGE = images/secondary_background_image.png
|
||||
SECONDARY_BACKGROUND_IMAGE = images/steel.png
|
||||
|
||||
|
||||
# Branding only
|
||||
|
||||
@ -147,6 +147,8 @@ public class Workspace extends JPanel implements PacketListener {
|
||||
|
||||
// Initialize workspace pane, defaulting the tabs to the bottom.
|
||||
workspacePane = new SparkTabbedPane(JTabbedPane.BOTTOM);
|
||||
workspacePane.setBackgroundColor(new Color(180, 207, 247));
|
||||
workspacePane.setBorderColor(Color.lightGray);
|
||||
workspacePane.setActiveButtonBold(true);
|
||||
|
||||
// Add Panels.
|
||||
|
||||
@ -14,8 +14,15 @@ import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.resource.SparkRes;
|
||||
import org.jivesoftware.spark.util.ModelUtil;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
@ -32,12 +39,6 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
/**
|
||||
* Jive Software imlementation of a TabbedPane.
|
||||
*
|
||||
@ -62,6 +63,9 @@ public class SparkTabbedPane extends JPanel implements MouseListener {
|
||||
|
||||
private int tabPlacement = JTabbedPane.TOP;
|
||||
|
||||
private Color backgroundColor;
|
||||
private Color borderColor;
|
||||
|
||||
/**
|
||||
* Listeners
|
||||
*/
|
||||
@ -149,6 +153,14 @@ public class SparkTabbedPane extends JPanel implements MouseListener {
|
||||
|
||||
public SparkTab addTab(String text, Icon icon, final Component component) {
|
||||
final SparkTab tab = new SparkTab(icon, text);
|
||||
if (getBackgroundColor() != null) {
|
||||
tab.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
if (getBorderColor() != null) {
|
||||
tab.setBorderColor(borderColor);
|
||||
}
|
||||
|
||||
tab.setTabPlacement(tabPlacement);
|
||||
//tabs.add(tab, new GridBagConstraints(tabs.getComponentCount(), 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 0, 0), 0, 0));
|
||||
|
||||
@ -179,55 +191,6 @@ public class SparkTabbedPane extends JPanel implements MouseListener {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
if (isPopupAllowed()) {
|
||||
RolloverButton popButton = new RolloverButton(LaRes.getImageIcon(LaRes.SMALL_PIN_BLUE));
|
||||
tab.addPop(popButton);
|
||||
|
||||
popButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
int index = getIndex(tab);
|
||||
|
||||
// Close Tab
|
||||
|
||||
String title = tab.getActualText();
|
||||
|
||||
// Create Frame
|
||||
final JFrame frame = new JFrame();
|
||||
frame.setTitle(title);
|
||||
|
||||
frame.getContentPane().setLayout(new BorderLayout());
|
||||
frame.getContentPane().add(component, BorderLayout.CENTER);
|
||||
frame.pack();
|
||||
|
||||
GraphicUtils.centerWindowOnScreen(frame);
|
||||
frame.setVisible(true);
|
||||
|
||||
mainPanel.remove(component);
|
||||
tabs.remove(tab);
|
||||
|
||||
|
||||
tabs.invalidate();
|
||||
tabs.validate();
|
||||
tabs.repaint();
|
||||
|
||||
mainPanel.invalidate();
|
||||
mainPanel.validate();
|
||||
mainPanel.repaint();
|
||||
|
||||
fireTabRemoved(tab, component, index);
|
||||
Component[] comps = tabs.getComponents();
|
||||
if (comps.length == 0) {
|
||||
allTabsClosed();
|
||||
}
|
||||
else {
|
||||
findSelectedTab(index);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
if (getSelectedIndex() == -1) {
|
||||
setSelectedTab(tab);
|
||||
@ -235,6 +198,8 @@ public class SparkTabbedPane extends JPanel implements MouseListener {
|
||||
|
||||
|
||||
fireTabAdded(tab, component, getIndex(tab));
|
||||
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
@ -560,4 +525,21 @@ public class SparkTabbedPane extends JPanel implements MouseListener {
|
||||
public JPanel getMainPanel() {
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
|
||||
public Color getBackgroundColor() {
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
public void setBackgroundColor(Color backgroundColor) {
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
public Color getBorderColor() {
|
||||
return borderColor;
|
||||
}
|
||||
|
||||
public void setBorderColor(Color borderColor) {
|
||||
this.borderColor = borderColor;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,8 @@ package org.jivesoftware.spark.component.tabbedPane;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -44,5 +46,13 @@ public class TabPanel extends JPanel {
|
||||
protected void setTabPlacement(int placement){
|
||||
ui.setPlacement(placement);
|
||||
}
|
||||
|
||||
public void setBorderColor(Color color){
|
||||
ui.setBorder(color);
|
||||
}
|
||||
|
||||
public void setBackgroundColor(Color color){
|
||||
ui.setFillerColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,12 @@ import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.resource.Default;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.basic.BasicPanelUI;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
@ -25,25 +31,13 @@ import java.awt.Shape;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.basic.BasicPanelUI;
|
||||
|
||||
/**
|
||||
* Represents a single instance of a Tab Paint Component.
|
||||
*
|
||||
* @author Derek DeMoro
|
||||
*/
|
||||
public class TabPanelUI extends BasicPanelUI {
|
||||
private Color backgroundColor1 = new Color(0, 0, 0, 0);
|
||||
private Color backgroundColor2 = new Color(0, 0, 0, 0);
|
||||
|
||||
private Color borderColor = new Color(86, 88, 72);
|
||||
private Color borderColorAlpha1 = new Color(86, 88, 72, 100);
|
||||
private Color borderColorAlpha2 = new Color(86, 88, 72, 50);
|
||||
private Color borderHighlight = new Color(225, 224, 224);
|
||||
private Color backgroundColor = new Color(0, 0, 0, 0);
|
||||
|
||||
private boolean selected;
|
||||
private boolean hideBorder;
|
||||
@ -51,6 +45,9 @@ public class TabPanelUI extends BasicPanelUI {
|
||||
private int placement = JTabbedPane.TOP;
|
||||
|
||||
|
||||
private Color fillerColor;
|
||||
private Color border;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------
|
||||
// Custom installation methods
|
||||
// ------------------------------------------------------------------------------------------------------------------
|
||||
@ -61,12 +58,10 @@ public class TabPanelUI extends BasicPanelUI {
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
if (selected) {
|
||||
backgroundColor1 = getSelectedStartColor();
|
||||
backgroundColor2 = getSelectedEndColor();
|
||||
backgroundColor = getSelectedEndColor();
|
||||
}
|
||||
else {
|
||||
backgroundColor1 = new Color(0, 0, 0, 0);
|
||||
backgroundColor2 = new Color(0, 0, 0, 0);
|
||||
backgroundColor = new Color(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
this.selected = selected;
|
||||
@ -77,6 +72,7 @@ public class TabPanelUI extends BasicPanelUI {
|
||||
// ------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public void paint(Graphics g, JComponent c) {
|
||||
Color borderColor = getBorderColor();
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
|
||||
@ -93,45 +89,40 @@ public class TabPanelUI extends BasicPanelUI {
|
||||
Shape vButtonShape = new RoundRectangle2D.Double((double)x, (double)y, (double)w, (double)h, (double)arc, (double)arc);
|
||||
Shape vOldClip = g.getClip();
|
||||
|
||||
if(!Spark.isMac()){
|
||||
g2d.setClip(vButtonShape);
|
||||
if (!Spark.isMac()) {
|
||||
// g2d.setClip(vButtonShape);
|
||||
}
|
||||
g2d.setColor(backgroundColor2);
|
||||
g2d.setColor(backgroundColor);
|
||||
g2d.fillRect(x, y, w, h);
|
||||
|
||||
g2d.setClip(vOldClip);
|
||||
GradientPaint vPaint = new GradientPaint(x, y, borderColor, x, y + h, borderHighlight);
|
||||
GradientPaint vPaint = new GradientPaint(x, y, borderColor, x, y + h, borderColor);
|
||||
g2d.setPaint(vPaint);
|
||||
|
||||
// Handle custom actions.
|
||||
if (placement == JTabbedPane.TOP) {
|
||||
if (selected) {
|
||||
g2d.setColor(Color.lightGray);
|
||||
g2d.drawRoundRect(x, y, w, h, arc, arc);
|
||||
g2d.setColor(borderColor);
|
||||
g2d.drawRect(x, y, w, h);
|
||||
}
|
||||
|
||||
g2d.clipRect(x, y, w + 1, h - arc / 4);
|
||||
g2d.setColor(borderColorAlpha1);
|
||||
|
||||
g2d.setClip(vOldClip);
|
||||
g2d.setColor(borderColorAlpha2);
|
||||
|
||||
|
||||
g2d.setColor(backgroundColor2);
|
||||
g2d.fillRect(x, h - 5, w, h);
|
||||
}
|
||||
else {
|
||||
// Make straight line.
|
||||
g2d.setColor(backgroundColor2);
|
||||
g2d.fillRect(x, y, w, 4);
|
||||
if (selected) {
|
||||
g2d.setColor(borderColor);
|
||||
g2d.drawLine(w - 1, 0, w - 1, h);
|
||||
g2d.drawLine(x, y, x, h);
|
||||
g2d.drawLine(0, h - 1, w - 1, h - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
|
||||
// Draw border on right side.
|
||||
g2d.setColor(borderColor);
|
||||
g2d.drawLine(w - 1, 0, w - 1, h);
|
||||
}
|
||||
else if (!hideBorder) {
|
||||
// Draw border on right side.
|
||||
g2d.setColor(Color.lightGray);
|
||||
g2d.setColor(borderColor);
|
||||
g2d.drawLine(w - 1, 4, w - 1, h - 4);
|
||||
}
|
||||
}
|
||||
@ -159,6 +150,10 @@ public class TabPanelUI extends BasicPanelUI {
|
||||
|
||||
|
||||
private Color getSelectedEndColor() {
|
||||
if (fillerColor != null) {
|
||||
return fillerColor;
|
||||
}
|
||||
|
||||
Color uiEndColor = (Color)UIManager.get("SparkTabbedPane.endColor");
|
||||
if (uiEndColor != null) {
|
||||
return uiEndColor;
|
||||
@ -173,6 +168,26 @@ public class TabPanelUI extends BasicPanelUI {
|
||||
}
|
||||
}
|
||||
|
||||
private Color getBorderColor() {
|
||||
if (border != null) {
|
||||
return border;
|
||||
}
|
||||
|
||||
Color color = (Color)UIManager.get("SparkTabbedPane.borderColor");
|
||||
if (color != null) {
|
||||
return color;
|
||||
}
|
||||
|
||||
if (Spark.isCustomBuild()) {
|
||||
String end = Default.getString(Default.CONTACT_GROUP_END_COLOR);
|
||||
return getColor(end);
|
||||
}
|
||||
else {
|
||||
return Color.lightGray;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static Color getColor(String commaColorString) {
|
||||
Color color = null;
|
||||
try {
|
||||
@ -191,5 +206,22 @@ public class TabPanelUI extends BasicPanelUI {
|
||||
public void setPlacement(int placement) {
|
||||
this.placement = placement;
|
||||
}
|
||||
|
||||
|
||||
public Color getFillerColor() {
|
||||
return fillerColor;
|
||||
}
|
||||
|
||||
public void setFillerColor(Color fillerColor) {
|
||||
this.fillerColor = fillerColor;
|
||||
}
|
||||
|
||||
public Color getBorder() {
|
||||
return border;
|
||||
}
|
||||
|
||||
public void setBorder(Color border) {
|
||||
this.border = border;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,6 +47,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
|
||||
@ -15,6 +15,10 @@ import org.jdesktop.jdic.browser.IBrowserEngine;
|
||||
import org.jivesoftware.spark.util.StringUtils;
|
||||
import org.jivesoftware.spark.util.URLFileSystem;
|
||||
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
@ -23,6 +27,7 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
/**
|
||||
* Manages Themes.
|
||||
@ -84,7 +89,7 @@ public class ThemeManager {
|
||||
|
||||
// Note that the install directory is my name for temporary files and
|
||||
// not about mozilla. Me love Mozilla.
|
||||
be.setEnginePath("C:\\crapola\\mozilla\\mozilla.exe");
|
||||
be.setEnginePath("C:\\crapoloa\\mozilla\\mozilla.exe");
|
||||
|
||||
|
||||
URL url = getClass().getResource("/themes/renkoo2.3/renkoo.AdiumMessageStyle");
|
||||
@ -354,10 +359,5 @@ public class ThemeManager {
|
||||
}
|
||||
|
||||
|
||||
public static void main(String args[]) {
|
||||
|
||||
ThemeManager themeManager = ThemeManager.getInstance();
|
||||
|
||||
System.out.println(themeManager.getTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user