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) {
listPanel = new JPanel(new GridBagLayout());
listPanel.setBackground(Color.white);
for (int i = 0; i < comments.size(); i++) {
CommentEntity c = comments.get(i);
for (CommentEntity c : comments) {
addComment(c);
GridBagConstraints gbc = new GridBagConstraints();
@@ -81,8 +81,8 @@ public class ResultsScrollPanel extends JScrollPane {
private Icon spinnerIcon = IconLoader.Spinning.getIcon();
public ResultsScrollPanel(ISwingUI mainUI, ISimpleView cloudUI, IPlugInPort plugInPort,
PagingProvider provider, CloudPresenter cloudPresenter) {
public ResultsScrollPanel(ISwingUI mainUI, ISimpleView cloudUI, IPlugInPort plugInPort, PagingProvider provider,
CloudPresenter cloudPresenter) {
super();
this.mainUI = mainUI;
this.cloudUI = cloudUI;
@@ -146,8 +146,8 @@ public class ResultsScrollPanel extends JScrollPane {
} else {
final Point old = getViewport().getViewPosition();
LOG.info("Adding " + projects.size() + " projects to display.");
for (int i = 0; i < projects.size(); i++) {
addProjectToDisplay(projects.get(i));
for (ProjectEntity project : projects) {
addProjectToDisplay(project);
this.currentLocation++;
}
armed = true;
@@ -173,8 +173,6 @@ public class ResultsScrollPanel extends JScrollPane {
JLabel nameLabel = new JLabel("<html><b>" + project.getName() + "</b></html>");
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"));
descriptionArea.setEditable(false);
descriptionArea.setFont(thumbnailLabel.getFont());
@@ -185,7 +183,6 @@ public class ResultsScrollPanel extends JScrollPane {
DefaultCaret caret = (DefaultCaret) descriptionArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
descriptionArea.setEnabled(false);
// descriptionArea.setDisabledTextColor(descriptionArea.getSelectionColor());
JLabel commentLabel =
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;
public SimpleCloudGlassPane() {
addKeyListener(this);
addMouseListener(this);
@@ -46,13 +45,6 @@ public class SimpleCloudGlassPane extends JPanel implements MouseListener, KeyLi
JLabel cloudLabel = new JLabel(IconLoader.CloudWait.getIcon());
cloudLabel.setHorizontalAlignment(SwingConstants.CENTER);
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