Skip to content

Commit

Permalink
issue 40: added direct action on icon click, added help message
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalcikr committed Oct 5, 2015
1 parent dbe10e0 commit dbb5ee7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.hp.alm.ali.idea.entity.EntityEditManager;
import com.hp.alm.ali.idea.model.Entity;
import com.hp.alm.ali.idea.ui.editor.TaskAddInvestedEditor;
import com.hp.alm.ali.idea.ui.editor.TaskEditor;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.hp.alm.ali.idea.translate.Translator;
import com.hp.alm.ali.idea.translate.ValueCallback;
import com.hp.alm.ali.idea.model.type.UserType;
import com.hp.alm.ali.idea.ui.editor.TaskAddInvestedEditor;
import com.hp.alm.ali.idea.ui.event.PopupAdapter;
import com.hp.alm.ali.idea.ui.Highlightable;
import com.hp.alm.ali.idea.ui.SimpleHighlight;
Expand Down Expand Up @@ -87,7 +88,7 @@ public class TaskPanel extends JLayeredPane implements Highlightable, DataProvid
private TranslateService translateService;
private Translator userTranslator;

public TaskPanel(Entity task, final Project project, BacklogItemPanel pBacklogItemPanel) {
public TaskPanel(final Entity task, final Project project, BacklogItemPanel pBacklogItemPanel) {
this.task = task;
this.project = project;
this.backlogItemPanel = pBacklogItemPanel;
Expand Down Expand Up @@ -163,6 +164,11 @@ public void mouseClicked(MouseEvent e) {
ActionPopupMenu popupMenu = ActionUtil.createActionPopup("hpali.task", "taskboard");
popupMenu.getComponent().show(moreLink, 0, 0);
}
point = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), timePanel.effortLabel);
if (timePanel.effortLabel.contains(point)) {
TaskAddInvestedEditor taskAddInvestedEditor = new TaskAddInvestedEditor(project, task);
taskAddInvestedEditor.execute();
}
}
}
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public class TimePanel extends JPanel {

private JLabel effortLabel;
JLabel effortLabel;
private JLabel investedLabel;
private JLabel investedEstimatedSeparator;
private JLabel remainingLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.hp.alm.ali.idea.ui.editor.field.SpinnerField;
import com.intellij.openapi.project.Project;

import javax.swing.*;
import javax.swing.text.html.HTMLEditorKit;
import java.awt.*;

public class TaskAddInvestedEditor extends BaseEditor {
Expand All @@ -21,13 +23,21 @@ public TaskAddInvestedEditor(Project project, Entity task, SaveHandler saveHandl

entityService = project.getComponent(EntityService.class);

setSize(new Dimension(230, 150));
setSize(new Dimension(290, 220));
centerOnOwner();
}

@Override
public void update() {
addField("invested", new SpinnerField("Add invested", "0", true));

JTextPane addProperty = new JTextPane();
addProperty.setBackground(gridFooter.getBackground());
addProperty.setEditorKit(new HTMLEditorKit());
addProperty.setText("<html><body><i style=\"font-size:x-small;\"><b>Info:</b><br/>Add selected amount to invested time and removes same<br> amount from remaining time.<br/>If there is not enough remaining time it will be set to 0.</i></body></html>");
addProperty.setEditable(false);
gridFooter.add(addProperty);

}

public static class Edit implements SaveHandler {
Expand Down

0 comments on commit dbb5ee7

Please sign in to comment.