renaming classes for clarity

This commit is contained in:
Ben Fry
2015-09-22 12:49:14 -04:00
parent eb40984055
commit ca3f9657ef
7 changed files with 40 additions and 41 deletions

View File

@@ -656,8 +656,8 @@ public class ContributionManager {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
static ContributionManagerDialog managerDialog =
new ContributionManagerDialog();
static ManagerFrame managerDialog =
new ManagerFrame();
/**

View File

@@ -43,7 +43,7 @@ public class ContributionTab extends JPanel {
static final int FILTER_WIDTH = 180;
ContributionType contribType;
ContributionManagerDialog contribDialog;
ManagerFrame contribDialog;
Contribution.Filter filter;
JComboBox<String> categoryChooser;
@@ -72,7 +72,7 @@ public class ContributionTab extends JPanel {
public ContributionTab(ContributionType type,
ContributionManagerDialog dialog) {
ManagerFrame dialog) {
this.contribType = type;
this.contribDialog = dialog;
@@ -144,16 +144,16 @@ public class ContributionTab extends JPanel {
.createParallelGroup(GroupLayout.Alignment.CENTER)
.addGroup(layout
.createSequentialGroup()
.addGap(ContributionManagerDialog.STATUS_WIDTH)
.addGap(ManagerFrame.STATUS_WIDTH)
.addComponent(filterField,
FILTER_WIDTH, FILTER_WIDTH, FILTER_WIDTH)
// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
.addComponent(categoryChooser,
ContributionManagerDialog.AUTHOR_WIDTH,
ContributionManagerDialog.AUTHOR_WIDTH,
ContributionManagerDialog.AUTHOR_WIDTH)
ManagerFrame.AUTHOR_WIDTH,
ManagerFrame.AUTHOR_WIDTH,
ManagerFrame.AUTHOR_WIDTH)
.addGap(scrollBarWidth)).addComponent(loaderLabel)
.addComponent(contributionListPanel).addComponent(errorPanel)
.addComponent(statusPanel));
@@ -194,7 +194,7 @@ public class ContributionTab extends JPanel {
categoryChooser.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
category = (String) categoryChooser.getSelectedItem();
if (ContributionManagerDialog.ANY_CATEGORY.equals(category)) {
if (ManagerFrame.ANY_CATEGORY.equals(category)) {
category = null;
}
filterLibraries(category, filterField.filters);
@@ -268,7 +268,7 @@ public class ContributionTab extends JPanel {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(new Color(0xe0fffd));
g.fillRect(getX(), getY() - ContributionManagerDialog.TAB_HEIGHT - 2 , getWidth(), 2);
g.fillRect(getX(), getY() - ManagerFrame.TAB_HEIGHT - 2 , getWidth(), 2);
}
@@ -283,7 +283,7 @@ public class ContributionTab extends JPanel {
Collections.sort(categories);
// categories.add(0, ContributionManagerDialog.ANY_CATEGORY);
boolean categoriesFound = false;
categoryChooser.addItem(ContributionManagerDialog.ANY_CATEGORY);
categoryChooser.addItem(ManagerFrame.ANY_CATEGORY);
for (String s : categories) {
categoryChooser.addItem(s);
if (!s.equals(Contribution.UNKNOWN_CATEGORY)) {

View File

@@ -114,9 +114,9 @@ implements Scrollable, ContributionListing.ChangeListener {
table.setRowHeight(28);
table.setRowMargin(6);
table.getColumnModel().setColumnMargin(0);
table.getColumnModel().getColumn(0).setMaxWidth(ContributionManagerDialog.STATUS_WIDTH);
table.getColumnModel().getColumn(2).setMinWidth(ContributionManagerDialog.AUTHOR_WIDTH);
table.getColumnModel().getColumn(2).setMaxWidth(ContributionManagerDialog.AUTHOR_WIDTH);
table.getColumnModel().getColumn(0).setMaxWidth(ManagerFrame.STATUS_WIDTH);
table.getColumnModel().getColumn(2).setMinWidth(ManagerFrame.AUTHOR_WIDTH);
table.getColumnModel().getColumn(2).setMaxWidth(ManagerFrame.AUTHOR_WIDTH);
table.setShowGrid(false);
table.setColumnSelectionAllowed(false);
table.setCellSelectionEnabled(false);

View File

@@ -39,20 +39,19 @@ import processing.app.ui.Toolkit;
* This class is the main Contribution Manager Dialog.
* It contains all the contributions tab and the update tab.
*/
public class ContributionManagerDialog {
public class ManagerFrame {
static final String ANY_CATEGORY = Language.text("contrib.all");
static final int TAB_WIDTH = 100;
static final int TAB_HEIGHT = 34;
static final int AUTHOR_WIDTH = 240;
static final int STATUS_WIDTH = 66;
// static final int ICON_WIDTH = 50;
static final int BORDER = 8;
static final String title = "Manager";
JFrame dialog;
JFrame frame;
JTabbedPane tabbedPane;
// JButton restartButton;
// the calling editor, so updates can be applied
Editor editor;
@@ -69,7 +68,7 @@ public class ContributionManagerDialog {
private JLabel updateTabLabel;
public ContributionManagerDialog() {
public ManagerFrame() {
numberLabel = new JLabel(Toolkit.getLibIconX("manager/notification"));
librariesTab = new ContributionTab(ContributionType.LIBRARY, this);
modesTab = new ContributionTab(ContributionType.MODE, this);
@@ -84,7 +83,7 @@ public class ContributionManagerDialog {
// Calculating index to switch to the required tab
int index = ContributionManager.getTypeIndex(contributionType);
if (dialog == null) {
if (frame == null) {
makeFrame(editor);
// done before as downloadAndUpdateContributionListing()
// requires the current selected tab
@@ -101,7 +100,7 @@ public class ContributionManagerDialog {
}
}
tabbedPane.setSelectedIndex(index);
dialog.setVisible(true);
frame.setVisible(true);
}
@@ -120,8 +119,8 @@ public class ContributionManagerDialog {
private void makeFrame(final Editor editor) {
dialog = new JFrame(title);
dialog.setMinimumSize(new Dimension(750, 500));
frame = new JFrame(title);
frame.setMinimumSize(new Dimension(750, 500));
tabbedPane = new JTabbedPane();
makeAndShowTab(false, true);
@@ -181,23 +180,23 @@ public class ContributionManagerDialog {
// GroupLayout layout = new GroupLayout(dialog.getContentPane());
// dialog.getContentPane().setLayout(layout);
dialog.setResizable(true);
frame.setResizable(true);
// layout.setAutoCreateContainerGaps(true);
// layout.setHorizontalGroup(layout.createParallelGroup().addComponent(tabbedPane));
// layout.setVerticalGroup(layout.createParallelGroup().addComponent(tabbedPane));
// layout.setHonorsVisibility(tabbedPane, true);
tabbedPane.setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER));
dialog.getContentPane().add(tabbedPane);
frame.getContentPane().add(tabbedPane);
//TODO set color here
dialog.getContentPane().setBackground(new Color(0x132638));
dialog.validate();
dialog.repaint();
frame.getContentPane().setBackground(new Color(0x132638));
frame.validate();
frame.repaint();
Toolkit.setIcon(dialog);
Toolkit.setIcon(frame);
registerDisposeListeners();
dialog.pack();
dialog.setLocationRelativeTo(null);
frame.pack();
frame.setLocationRelativeTo(null);
}
@@ -340,25 +339,25 @@ public class ContributionManagerDialog {
* Close the window after an OK or Cancel.
*/
protected void disposeFrame() {
dialog.dispose();
frame.dispose();
editor = null;
}
private void registerDisposeListeners() {
dialog.addWindowListener(new WindowAdapter() {
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
disposeFrame();
}
});
// handle window closing commands for ctrl/cmd-W or hitting ESC.
Toolkit.registerWindowCloseKeys(dialog.getRootPane(), new ActionListener() {
Toolkit.registerWindowCloseKeys(frame.getRootPane(), new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
disposeFrame();
}
});
dialog.getContentPane().addKeyListener(new KeyAdapter() {
frame.getContentPane().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
//System.out.println(e);
KeyStroke wc = Toolkit.WINDOW_CLOSE_KEYSTROKE;

View File

@@ -46,7 +46,7 @@ import processing.app.ui.Toolkit;
/**
* Console/error/whatever tabs at the bottom of the editor window.
*/
public class ManagerHeader extends Box {
public class ManagerTabs extends Box {
// height of this tab bar
static final int HIGH = 32;
@@ -88,7 +88,7 @@ public class ManagerHeader extends Box {
Controller controller;
public ManagerHeader(Editor eddie) {
public ManagerTabs(Editor eddie) {
super(BoxLayout.Y_AXIS);
this.editor = eddie;

View File

@@ -166,9 +166,9 @@ class StatusPanel extends JPanel {
.createSequentialGroup()
.addGap(0)
.addComponent(iconLabel,
ContributionManagerDialog.STATUS_WIDTH,
ContributionManagerDialog.STATUS_WIDTH,
ContributionManagerDialog.STATUS_WIDTH)
ManagerFrame.STATUS_WIDTH,
ManagerFrame.STATUS_WIDTH,
ManagerFrame.STATUS_WIDTH)
.addGap(0)
.addComponent(label, labelWidth, labelWidth, labelWidth)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,

View File

@@ -13,7 +13,7 @@ import processing.app.ui.Toolkit;
public class UpdateContributionTab extends ContributionTab {
public UpdateContributionTab(ContributionType type,
ContributionManagerDialog dialog) {
ManagerFrame dialog) {
super();
this.contribType = type;
this.contribDialog = dialog;