simplify code

This commit is contained in:
Branislav Stojkovic
2016-10-30 12:30:30 +01:00
parent 98087d8889
commit a74f00a5fd
3 changed files with 5 additions and 17 deletions
@@ -68,8 +68,7 @@ public class CommentDialog extends JDialog {
if (listPanel == null) { if (listPanel == null) {
listPanel = new JPanel(new GridBagLayout()); listPanel = new JPanel(new GridBagLayout());
listPanel.setBackground(Color.white); listPanel.setBackground(Color.white);
for (int i = 0; i < comments.size(); i++) { for (CommentEntity c : comments) {
CommentEntity c = comments.get(i);
addComment(c); addComment(c);
GridBagConstraints gbc = new GridBagConstraints(); GridBagConstraints gbc = new GridBagConstraints();
@@ -81,8 +81,8 @@ public class ResultsScrollPanel extends JScrollPane {
private Icon spinnerIcon = IconLoader.Spinning.getIcon(); private Icon spinnerIcon = IconLoader.Spinning.getIcon();
public ResultsScrollPanel(ISwingUI mainUI, ISimpleView cloudUI, IPlugInPort plugInPort, public ResultsScrollPanel(ISwingUI mainUI, ISimpleView cloudUI, IPlugInPort plugInPort, PagingProvider provider,
PagingProvider provider, CloudPresenter cloudPresenter) { CloudPresenter cloudPresenter) {
super(); super();
this.mainUI = mainUI; this.mainUI = mainUI;
this.cloudUI = cloudUI; this.cloudUI = cloudUI;
@@ -146,8 +146,8 @@ public class ResultsScrollPanel extends JScrollPane {
} else { } else {
final Point old = getViewport().getViewPosition(); final Point old = getViewport().getViewPosition();
LOG.info("Adding " + projects.size() + " projects to display."); LOG.info("Adding " + projects.size() + " projects to display.");
for (int i = 0; i < projects.size(); i++) { for (ProjectEntity project : projects) {
addProjectToDisplay(projects.get(i)); addProjectToDisplay(project);
this.currentLocation++; this.currentLocation++;
} }
armed = true; armed = true;
@@ -173,8 +173,6 @@ public class ResultsScrollPanel extends JScrollPane {
JLabel nameLabel = new JLabel("<html><b>" + project.getName() + "</b></html>"); JLabel nameLabel = new JLabel("<html><b>" + project.getName() + "</b></html>");
nameLabel.setFont(nameLabel.getFont().deriveFont(12f)); nameLabel.setFont(nameLabel.getFont().deriveFont(12f));
// JLabel descriptionArea = new JLabel("<html><p align='justify'>" + project.getDescription() +
// "</p></html>");
JTextArea descriptionArea = new JTextArea(project.getDescription().replace("<br>", "\n")); JTextArea descriptionArea = new JTextArea(project.getDescription().replace("<br>", "\n"));
descriptionArea.setEditable(false); descriptionArea.setEditable(false);
descriptionArea.setFont(thumbnailLabel.getFont()); descriptionArea.setFont(thumbnailLabel.getFont());
@@ -185,7 +183,6 @@ public class ResultsScrollPanel extends JScrollPane {
DefaultCaret caret = (DefaultCaret) descriptionArea.getCaret(); DefaultCaret caret = (DefaultCaret) descriptionArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
descriptionArea.setEnabled(false); descriptionArea.setEnabled(false);
// descriptionArea.setDisabledTextColor(descriptionArea.getSelectionColor());
JLabel commentLabel = JLabel commentLabel =
new JLabel(Integer.toString(project.getCommentCount()), IconLoader.Messages.getIcon(), SwingConstants.LEFT); new JLabel(Integer.toString(project.getCommentCount()), IconLoader.Messages.getIcon(), SwingConstants.LEFT);
@@ -26,7 +26,6 @@ public class SimpleCloudGlassPane extends JPanel implements MouseListener, KeyLi
private static final long serialVersionUID = -5344758920442881290L; private static final long serialVersionUID = -5344758920442881290L;
public SimpleCloudGlassPane() { public SimpleCloudGlassPane() {
addKeyListener(this); addKeyListener(this);
addMouseListener(this); addMouseListener(this);
@@ -46,13 +45,6 @@ public class SimpleCloudGlassPane extends JPanel implements MouseListener, KeyLi
JLabel cloudLabel = new JLabel(IconLoader.CloudWait.getIcon()); JLabel cloudLabel = new JLabel(IconLoader.CloudWait.getIcon());
cloudLabel.setHorizontalAlignment(SwingConstants.CENTER); cloudLabel.setHorizontalAlignment(SwingConstants.CENTER);
add(cloudLabel, gbc); add(cloudLabel, gbc);
//
// gbc.gridy = 1;
// gbc.weighty = 1.5;
// gbc.anchor = GridBagConstraints.FIRST_LINE_START;
// JLabel label = new JLabel("<html><font size='5' color='#999999'>Querying the cloud...</font></html>");
// label.setHorizontalAlignment(SwingConstants.CENTER);
// add(label, gbc);
} }
@Override @Override