mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
added to the top
This commit is contained in:
+31
-3
@@ -9,6 +9,8 @@ import java.awt.Insets;
|
|||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@@ -57,6 +59,8 @@ public class ResultsScrollPanel extends JScrollPane {
|
|||||||
*/
|
*/
|
||||||
private JLabel loadMoreLabel;
|
private JLabel loadMoreLabel;
|
||||||
|
|
||||||
|
private JLabel topLabel;
|
||||||
|
|
||||||
private ISwingUI mainUI;
|
private ISwingUI mainUI;
|
||||||
private CloudBrowserFrame cloudUI;
|
private CloudBrowserFrame cloudUI;
|
||||||
|
|
||||||
@@ -95,16 +99,25 @@ public class ResultsScrollPanel extends JScrollPane {
|
|||||||
gbc.gridx = 0;
|
gbc.gridx = 0;
|
||||||
gbc.gridy = 10000;
|
gbc.gridy = 10000;
|
||||||
gbc.fill = GridBagConstraints.BOTH;
|
gbc.fill = GridBagConstraints.BOTH;
|
||||||
gbc.weightx = 1;
|
gbc.weightx = 100;
|
||||||
gbc.weighty = 100;
|
gbc.weighty = 100;
|
||||||
gbc.gridwidth = 3;
|
gbc.gridwidth = 2;
|
||||||
resultsPanel.add(getLoadMoreLabel(), gbc);
|
resultsPanel.add(getLoadMoreLabel(), gbc);
|
||||||
|
|
||||||
|
gbc.gridx = 2;
|
||||||
|
gbc.gridwidth = 1;
|
||||||
|
gbc.weightx = 0;
|
||||||
|
gbc.insets = new Insets(0, 0, 0, 2);
|
||||||
|
gbc.fill = GridBagConstraints.NONE;
|
||||||
|
gbc.anchor = GridBagConstraints.LINE_END;
|
||||||
|
resultsPanel.add(getTopLabel(), gbc);
|
||||||
|
|
||||||
addData(projects);
|
addData(projects);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showNoMatches() {
|
public void showNoMatches() {
|
||||||
JLabel label = new JLabel("<html><font size='5'>No projects match the search criteria.</font></html>");
|
JLabel label =
|
||||||
|
new JLabel("<html><font size='4' color='#999999'>No projects match the search criteria.</font></html>");
|
||||||
label.setHorizontalAlignment(SwingConstants.CENTER);
|
label.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
GridBagConstraints gbc = new GridBagConstraints();
|
GridBagConstraints gbc = new GridBagConstraints();
|
||||||
gbc.insets = new Insets(2, 2, 2, 2);
|
gbc.insets = new Insets(2, 2, 2, 2);
|
||||||
@@ -116,6 +129,7 @@ public class ResultsScrollPanel extends JScrollPane {
|
|||||||
getResultsPanel().add(label, gbc);
|
getResultsPanel().add(label, gbc);
|
||||||
getLoadMoreLabel().setText("");
|
getLoadMoreLabel().setText("");
|
||||||
getLoadMoreLabel().setIcon(null);
|
getLoadMoreLabel().setIcon(null);
|
||||||
|
remove(getTopLabel());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addData(List<ProjectEntity> projects) {
|
public void addData(List<ProjectEntity> projects) {
|
||||||
@@ -295,6 +309,20 @@ public class ResultsScrollPanel extends JScrollPane {
|
|||||||
return nameLabel;
|
return nameLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JLabel getTopLabel() {
|
||||||
|
if (topLabel == null) {
|
||||||
|
topLabel = new JLabel("<html><font color='blue'><u>To the top</u></html>");
|
||||||
|
topLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||||
|
topLabel.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
getViewport().setViewPosition(new Point(0, 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return topLabel;
|
||||||
|
}
|
||||||
|
|
||||||
private JLabel getLoadMoreLabel() {
|
private JLabel getLoadMoreLabel() {
|
||||||
if (loadMoreLabel == null) {
|
if (loadMoreLabel == null) {
|
||||||
loadMoreLabel = new JLabel("Loading more data...") {
|
loadMoreLabel = new JLabel("Loading more data...") {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import java.awt.event.ActionListener;
|
|||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.Format;
|
import java.text.Format;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -30,7 +29,6 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.announcements.Announcement;
|
|
||||||
import org.diylc.announcements.AnnouncementProvider;
|
import org.diylc.announcements.AnnouncementProvider;
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.appframework.miscutils.Utils;
|
import org.diylc.appframework.miscutils.Utils;
|
||||||
@@ -172,7 +170,7 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
swingUI.showMessage(result, "Public Announcement", IView.INFORMATION_MESSAGE);
|
swingUI.showMessage(result, "Public Announcement", IView.INFORMATION_MESSAGE);
|
||||||
announcementProvider.dismissed();
|
announcementProvider.dismissed();
|
||||||
} else
|
} else
|
||||||
swingUI.showMessage("No new public announcements available.", "Public Announcements",
|
swingUI.showMessage("No new public announcements available.", "Public Announcement",
|
||||||
IView.INFORMATION_MESSAGE);
|
IView.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +279,7 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
EventType.SELECTION_CHANGED, EventType.STATUS_MESSAGE_CHANGED);
|
EventType.SELECTION_CHANGED, EventType.STATUS_MESSAGE_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "incomplete-switch"})
|
||||||
@Override
|
@Override
|
||||||
public void processMessage(EventType eventType, Object... params) {
|
public void processMessage(EventType eventType, Object... params) {
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
|
|||||||
Reference in New Issue
Block a user