[virtualcommons-svn] commit/irrigation: alllee: refactoring user interface usage, removing redundan
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2011-12-01 00:11:51
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/d18a78a711e3/ changeset: d18a78a711e3 user: alllee date: 2011-12-01 01:11:41 summary: refactoring user interface usage, removing redundant IrrigationInterface affected #: 4 files diff -r dbc24ef0382eabd350f6bb8005034d83b4874d58 -r d18a78a711e32ba2717276c77f347008054b3060 .hgignore --- a/.hgignore +++ b/.hgignore @@ -1,8 +1,13 @@ syntax:glob +src/main/resources/configuration/*.xml +tags *~ +manifest.mf +.settings/* target *.jar +data/* experiment-data/* build.properties *.log diff -r dbc24ef0382eabd350f6bb8005034d83b4874d58 -r d18a78a711e32ba2717276c77f347008054b3060 src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java --- a/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ExperimentGameWindow.java @@ -4,7 +4,6 @@ import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; -import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -27,7 +26,6 @@ import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.Timer; -import javax.swing.text.html.HTMLEditorKit; import edu.asu.commons.irrigation.conf.RoundConfiguration; import edu.asu.commons.irrigation.conf.ServerConfiguration; @@ -35,9 +33,9 @@ import edu.asu.commons.irrigation.events.QuizResponseEvent; import edu.asu.commons.irrigation.server.ClientData; import edu.asu.commons.irrigation.server.GroupDataModel; -import edu.asu.commons.irrigation.ui.IrrigationInterface; -import edu.asu.commons.util.HtmlEditorPane; -import edu.asu.commons.util.HtmlEditorPane.FormActionEvent; +import edu.asu.commons.ui.HtmlEditorPane; +import edu.asu.commons.ui.HtmlEditorPane.FormActionEvent; +import edu.asu.commons.ui.UserInterfaceUtils; /** * $Id$ @@ -125,7 +123,7 @@ tokenInvestmentPanel = new JPanel(); tokenInvestmentPanel.setName("Token investment panel"); tokenInvestmentPanel.setLayout(new BorderLayout()); - tokenInstructionsEditorPane = IrrigationInterface.createInstructionsEditorPane(); + tokenInstructionsEditorPane = UserInterfaceUtils.createInstructionsEditorPane(); JScrollPane tokenInstructionsScrollPane = new JScrollPane(tokenInstructionsEditorPane); tokenInvestmentPanel.add(tokenInstructionsScrollPane, BorderLayout.CENTER); tokenInvestmentPanel.add(getSubmitTokenPanel(), BorderLayout.SOUTH); @@ -289,7 +287,7 @@ private HtmlEditorPane getInstructionsEditorPane() { if (instructionsEditorPane == null) { - instructionsEditorPane = IrrigationInterface.createInstructionsEditorPane(); + instructionsEditorPane = UserInterfaceUtils.createInstructionsEditorPane(); instructionsEditorPane.setName("Instructions editor pane"); // create a quiz listener and then initialize the instructions. instructionsEditorPane.setActionListener(createQuizListener(getServerConfiguration())); @@ -506,7 +504,7 @@ contributionInformationPanel.setLayout(new BoxLayout(contributionInformationPanel, BoxLayout.Y_AXIS)); contributionInformationPanel.add(createPieChartPanel()); contributionInformationPanel.add(Box.createVerticalStrut(15)); - contributionInformationEditorPane = IrrigationInterface.createInstructionsEditorPane(); + contributionInformationEditorPane = UserInterfaceUtils.createInstructionsEditorPane(); contributionInformationPanel.add(contributionInformationEditorPane); } return contributionInformationPanel; diff -r dbc24ef0382eabd350f6bb8005034d83b4874d58 -r d18a78a711e32ba2717276c77f347008054b3060 src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java --- a/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java +++ b/src/main/java/edu/asu/commons/irrigation/facilitator/FacilitatorWindow.java @@ -21,9 +21,9 @@ import edu.asu.commons.irrigation.server.ClientData; import edu.asu.commons.irrigation.server.GroupDataModel; import edu.asu.commons.irrigation.server.ServerDataModel; -import edu.asu.commons.irrigation.ui.IrrigationInterface; import edu.asu.commons.net.Identifier; -import edu.asu.commons.util.HtmlEditorPane; +import edu.asu.commons.ui.HtmlEditorPane; +import edu.asu.commons.ui.UserInterfaceUtils; /** * $Id$ @@ -78,7 +78,7 @@ buttonPanel.add(getShowQuizButton()); buttonPanel.add(getStartRoundOverrideButton()); add(buttonPanel, BorderLayout.NORTH); - editorPane = IrrigationInterface.createInstructionsEditorPane(); + editorPane = UserInterfaceUtils.createInstructionsEditorPane(); scrollPane = new JScrollPane(editorPane); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); diff -r dbc24ef0382eabd350f6bb8005034d83b4874d58 -r d18a78a711e32ba2717276c77f347008054b3060 src/main/java/edu/asu/commons/irrigation/ui/IrrigationInterface.java --- a/src/main/java/edu/asu/commons/irrigation/ui/IrrigationInterface.java +++ /dev/null @@ -1,52 +0,0 @@ -package edu.asu.commons.irrigation.ui; - -import java.awt.Color; -import java.awt.Font; - -import javax.swing.JEditorPane; -import javax.swing.UIManager; -import javax.swing.text.html.HTMLDocument; - -import edu.asu.commons.util.HtmlEditorPane; - -/** - * $Id$ - * - * static utility class for common UI methods to set up a consistent look & feel. - * - * FIXME: push up to csidex - * - * - * @author <a href='mailto:all...@as...'>Allen Lee</a> - * @version $Rev$ - */ -public final class IrrigationInterface { - - public static final Font DEFAULT_PLAIN_FONT = new Font(getDefaultFont().getFamily(), Font.PLAIN, 16); - public static final Font DEFAULT_BOLD_FONT = new Font(getDefaultFont().getFamily(), Font.BOLD, 16); - - - public static Font getDefaultFont() { - return UIManager.getFont("Label.font"); - } - - public static void addStyles(JEditorPane editorPane, int fontSize) { - editorPane.setContentType("text/html"); - Font font = getDefaultFont(); - String bodyRule = String.format("body { font-family: %s; font-size: %s pt; }", font.getFamily(), fontSize); - ((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule); - } - - public static HtmlEditorPane createInstructionsEditorPane() { - return createInstructionsEditorPane(false); - } - - public static HtmlEditorPane createInstructionsEditorPane(boolean editable) { - final HtmlEditorPane htmlPane = new HtmlEditorPane(); - htmlPane.setEditable(editable); - htmlPane.setDoubleBuffered(true); - htmlPane.setBackground(Color.WHITE); - IrrigationInterface.addStyles(htmlPane, 16); - return htmlPane; - } -} Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |