mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
show recent updates, added to status bar and help menu
This commit is contained in:
@@ -62,7 +62,7 @@ public enum IconLoader {
|
||||
"pin_green.png"), CoffeebeanEdit("coffeebean_edit.png"), ApplicationEdit("application_edit.png"), ComponentAdd(
|
||||
"component_add.png"), History("history.png"), DocumentPlain("document_plain.png"), FitToSize("fit_to_size.png"), DocumentsGear(
|
||||
"documents_gear.png"), SplashResistor("splash_resistor.png"), SplashCeramic("splash_ceramic.png"), SplashElectrolytic(
|
||||
"splash_electrolytic.png"), SplashFilm("splash_film.png"), Splash("splash.png"), Help("help2.png");
|
||||
"splash_electrolytic.png"), SplashFilm("splash_film.png"), Splash("splash.png"), Help("help2.png"), ScrollInformation("scroll_information.png");
|
||||
|
||||
protected String name;
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 913 B |
@@ -23,20 +23,25 @@ package org.diylc.swing.plugins.help;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Icon;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
import org.diylc.appframework.update.UpdateChecker;
|
||||
import org.diylc.appframework.update.Version;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.images.IconLoader;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swing.gui.DialogFactory;
|
||||
import org.diylc.swingframework.AboutDialog;
|
||||
import org.diylc.swingframework.LinkLabel;
|
||||
import org.diylc.swingframework.update.UpdateDialog;
|
||||
|
||||
/**
|
||||
* Entry point class for help-related utilities.
|
||||
@@ -55,17 +60,21 @@ public class HelpMenuPlugin implements IPlugIn {
|
||||
public static String DONATE_URL = "http://diy-fever.com/donate";
|
||||
|
||||
private IPlugInPort plugInPort;
|
||||
private AboutDialog aboutDialog;
|
||||
private AboutDialog aboutDialog;
|
||||
private ISwingUI swingUI;
|
||||
|
||||
public HelpMenuPlugin(ISwingUI swingUI) {
|
||||
this.swingUI = swingUI;
|
||||
swingUI.injectMenuAction(new NavigateURLAction("User Manual", IconLoader.Manual.getIcon(), MANUAL_URL), HELP_TITLE);
|
||||
swingUI.injectMenuAction(new NavigateURLAction("FAQ", IconLoader.Faq.getIcon(), FAQ_URL), HELP_TITLE);
|
||||
swingUI.injectMenuAction(new NavigateURLAction("Component API", IconLoader.CoffeebeanEdit.getIcon(), COMPONENT_URL),
|
||||
HELP_TITLE);
|
||||
swingUI.injectMenuAction(new NavigateURLAction("Plugin API", IconLoader.ApplicationEdit.getIcon(), PLUGIN_URL), HELP_TITLE);
|
||||
swingUI.injectMenuAction(new NavigateURLAction("Submit a Bug", IconLoader.Bug.getIcon(), BUG_URL), HELP_TITLE);
|
||||
swingUI.injectMenuAction(null, HELP_TITLE);
|
||||
swingUI.injectMenuAction(new RecentUpdatesAction(), HELP_TITLE);
|
||||
swingUI.injectMenuAction(null, HELP_TITLE);
|
||||
swingUI.injectMenuAction(new NavigateURLAction("Donate", IconLoader.Donate.getIcon(), DONATE_URL), HELP_TITLE);
|
||||
swingUI.injectMenuAction(new NavigateURLAction("Donate", IconLoader.Donate.getIcon(), DONATE_URL), HELP_TITLE);
|
||||
swingUI.injectMenuAction(new AboutAction(), HELP_TITLE);
|
||||
}
|
||||
|
||||
@@ -118,6 +127,29 @@ public class HelpMenuPlugin implements IPlugIn {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getAboutDialog().setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
class RecentUpdatesAction extends AbstractAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RecentUpdatesAction() {
|
||||
super();
|
||||
putValue(AbstractAction.NAME, "Recent Updates");
|
||||
putValue(AbstractAction.SMALL_ICON, IconLoader.ScrollInformation.getIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
List<Version> updates = plugInPort.getRecentUpdates();
|
||||
if (updates == null)
|
||||
swingUI.showMessage("Version history is not available.", "Information", IView.INFORMATION_MESSAGE);
|
||||
else {
|
||||
String html = UpdateChecker.createUpdateHTML(updates);
|
||||
UpdateDialog updateDialog = new UpdateDialog(swingUI.getOwnerFrame().getRootPane(), html, (String)null);
|
||||
updateDialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class NavigateURLAction extends AbstractAction {
|
||||
|
||||
@@ -44,6 +44,7 @@ import java.util.Map;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
@@ -56,6 +57,8 @@ import net.java.balloontip.styles.EdgedBalloonStyle;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.announcements.AnnouncementProvider;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
import org.diylc.appframework.update.UpdateChecker;
|
||||
import org.diylc.appframework.update.Version;
|
||||
import org.diylc.common.BadPositionException;
|
||||
import org.diylc.common.ComponentType;
|
||||
import org.diylc.common.EventType;
|
||||
@@ -68,6 +71,7 @@ import org.diylc.images.IconLoader;
|
||||
import org.diylc.swing.ISwingUI;
|
||||
import org.diylc.swingframework.MemoryBar;
|
||||
import org.diylc.swingframework.miscutils.PercentageListCellRenderer;
|
||||
import org.diylc.swingframework.update.UpdateDialog;
|
||||
import org.diylc.swingframework.update.UpdateLabel;
|
||||
|
||||
public class StatusBar extends JPanel implements IPlugIn {
|
||||
@@ -81,7 +85,8 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
|
||||
private JComboBox zoomBox;
|
||||
private UpdateLabel updateLabel;
|
||||
private JLabel announcementLabel;
|
||||
private JLabel announcementLabel;
|
||||
private JLabel recentChangesLabel;
|
||||
private MemoryBar memoryPanel;
|
||||
private JLabel statusLabel;
|
||||
private JLabel sizeLabel;
|
||||
@@ -179,9 +184,6 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
return new Point(0, -16);
|
||||
}
|
||||
};
|
||||
// updateLabel.setBorder(BorderFactory.createCompoundBorder(
|
||||
// BorderFactory.createEtchedBorder(), BorderFactory
|
||||
// .createEmptyBorder(2, 4, 2, 4)));
|
||||
updateLabel.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));
|
||||
}
|
||||
return updateLabel;
|
||||
@@ -232,6 +234,38 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
});
|
||||
}
|
||||
return announcementLabel;
|
||||
}
|
||||
|
||||
public JLabel getRecentChangesLabel() {
|
||||
if (recentChangesLabel == null) {
|
||||
recentChangesLabel = new JLabel(IconLoader.ScrollInformation.getIcon()){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Point getToolTipLocation(MouseEvent event) {
|
||||
return new Point(0, -16);
|
||||
}
|
||||
};
|
||||
recentChangesLabel.setToolTipText("Click to show recent changes and updates");
|
||||
recentChangesLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
|
||||
recentChangesLabel.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
List<Version> updates = plugInPort.getRecentUpdates();
|
||||
if (updates == null)
|
||||
swingUI.showMessage("Version history is not available.", "Information", IView.INFORMATION_MESSAGE);
|
||||
else {
|
||||
String html = UpdateChecker.createUpdateHTML(updates);
|
||||
UpdateDialog updateDialog = new UpdateDialog(swingUI.getOwnerFrame().getRootPane(), html, (String)null);
|
||||
updateDialog.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return recentChangesLabel;
|
||||
}
|
||||
|
||||
private MemoryBar getMemoryPanel() {
|
||||
@@ -321,7 +355,11 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.insets = new Insets(0, 0, 0, 0);
|
||||
add(getUpdateLabel(), gbc);
|
||||
add(getUpdateLabel(), gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.insets = new Insets(0, 0, 0, 4);
|
||||
add(getRecentChangesLabel(), gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
|
||||
Reference in New Issue
Block a user