From 8382c231e511e71dbd7453e9af0d25a828252f32 Mon Sep 17 00:00:00 2001 From: Boris Kraut Date: Sun, 24 Nov 2019 22:57:32 +0100 Subject: [PATCH 1/2] Add call number action --- .../data/resources/icons/call_number_16.gif | Bin 0 -> 323 bytes .../data/resources/xslt/gantt-resources.xsl | 2 +- .../ganttproject/GanttProject.java | 1 + .../ganttproject/GanttResourcePanel.java | 1 + .../action/resource/ResourceActionSet.java | 8 +++ .../resource/ResourceCallNumberAction.java | 64 ++++++++++++++++++ .../default/gantt-resources.xsl | 2 +- .../striped_blue/gantt-resources.xsl | 2 +- 8 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 ganttproject/data/resources/icons/call_number_16.gif create mode 100644 ganttproject/src/net/sourceforge/ganttproject/action/resource/ResourceCallNumberAction.java diff --git a/ganttproject/data/resources/icons/call_number_16.gif b/ganttproject/data/resources/icons/call_number_16.gif new file mode 100644 index 0000000000000000000000000000000000000000..c43c5d51c5164161fbbfa35391f86f03f420b4e4 GIT binary patch literal 323 zcmZ?wbhEHb6krfwxXQrr;{CVP$L{UE`1Ib(&n6|S^)hByRjf76nqiqUBVpR%?71fj z7M`qMd8TvYrJhZfXY9T?XYZ}K`)+PN^JvT2N88Uo*>~mniQBJ_-+FcD#V3Z)>3Iu| zSFbp;;K0r0NAEs;_vJqrFwhbx{$ycfU{GMt0a*g_69Zd mailto: - + tel: diff --git a/ganttproject/src/net/sourceforge/ganttproject/GanttProject.java b/ganttproject/src/net/sourceforge/ganttproject/GanttProject.java index 12dcd57225..2c38f4ccdb 100644 --- a/ganttproject/src/net/sourceforge/ganttproject/GanttProject.java +++ b/ganttproject/src/net/sourceforge/ganttproject/GanttProject.java @@ -343,6 +343,7 @@ public void changeValue(ChangeValueEvent event) { mHuman.add(a); } mHuman.add(myResourceActions.getResourceSendMailAction()); + mHuman.add(myResourceActions.getResourceCallNumberAction()); bar.add(mHuman); HelpMenu helpMenu = new HelpMenu(getProject(), getUIFacade(), getProjectUIFacade()); diff --git a/ganttproject/src/net/sourceforge/ganttproject/GanttResourcePanel.java b/ganttproject/src/net/sourceforge/ganttproject/GanttResourcePanel.java index 4935298a1e..bd54f39cb1 100644 --- a/ganttproject/src/net/sourceforge/ganttproject/GanttResourcePanel.java +++ b/ganttproject/src/net/sourceforge/ganttproject/GanttResourcePanel.java @@ -203,6 +203,7 @@ private void createPopupMenu(MouseEvent e) { menu.add(resourceActions[i]); } menu.add(myResourceActionSet.getResourceSendMailAction()); + menu.add(myResourceActionSet.getResourceCallNumberAction()); menu.addSeparator(); menu.add(myResourceActionSet.getResourceMoveUpAction()); menu.add(myResourceActionSet.getResourceMoveDownAction()); diff --git a/ganttproject/src/net/sourceforge/ganttproject/action/resource/ResourceActionSet.java b/ganttproject/src/net/sourceforge/ganttproject/action/resource/ResourceActionSet.java index 7654bae927..0a01f99b6c 100644 --- a/ganttproject/src/net/sourceforge/ganttproject/action/resource/ResourceActionSet.java +++ b/ganttproject/src/net/sourceforge/ganttproject/action/resource/ResourceActionSet.java @@ -40,6 +40,8 @@ public class ResourceActionSet { private final ResourceSendMailAction myResourceSendMailAction; + private final ResourceCallNumberAction myResourceCallNumberAction; + private final AssignmentDeleteAction myAssignmentDelete; private AbstractAction[] myActions; @@ -53,6 +55,7 @@ public ResourceActionSet(ResourceContext resourceContext, AssignmentContext assi myResourceMoveUpAction = new ResourceMoveUpAction(table); myResourceMoveDownAction = new ResourceMoveDownAction(table); myResourceSendMailAction = new ResourceSendMailAction(table); + myResourceCallNumberAction = new ResourceCallNumberAction(table); myAssignmentDelete = new AssignmentDeleteAction(assignmentContext, uiFacade); } @@ -61,6 +64,7 @@ public AbstractAction[] getActions() { myResourceNewAction.putValue(Action.SHORT_DESCRIPTION, null); myResourcePropertiesAction.putValue(Action.SHORT_DESCRIPTION, null); myResourceSendMailAction.putValue(Action.SHORT_DESCRIPTION, null); + myResourceCallNumberAction.putValue(Action.SHORT_DESCRIPTION, null); myActions = new AbstractAction[] { myResourceNewAction, myResourcePropertiesAction }; } return myActions; @@ -90,6 +94,10 @@ public ResourceSendMailAction getResourceSendMailAction() { return myResourceSendMailAction; } + public ResourceCallNumberAction getResourceCallNumberAction() { + return myResourceCallNumberAction; + } + public AssignmentDeleteAction getAssignmentDelete() { return myAssignmentDelete; } diff --git a/ganttproject/src/net/sourceforge/ganttproject/action/resource/ResourceCallNumberAction.java b/ganttproject/src/net/sourceforge/ganttproject/action/resource/ResourceCallNumberAction.java new file mode 100644 index 0000000000..b7568607bc --- /dev/null +++ b/ganttproject/src/net/sourceforge/ganttproject/action/resource/ResourceCallNumberAction.java @@ -0,0 +1,64 @@ +/* +GanttProject is an opensource project management tool. +Copyright (C) 2011 GanttProject Team + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 3 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package net.sourceforge.ganttproject.action.resource; + +import java.awt.event.ActionEvent; + +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; + +import net.sourceforge.ganttproject.ResourceTreeTable; +import net.sourceforge.ganttproject.action.GPAction; +import net.sourceforge.ganttproject.resource.HumanResource; +import net.sourceforge.ganttproject.util.BrowserControl; + +public class ResourceCallNumberAction extends GPAction implements TreeSelectionListener { + private final ResourceTreeTable myTable; + + public ResourceCallNumberAction(ResourceTreeTable table) { + super("resource.callnumber"); + myTable = table; + setEnabled(false); + table.getTree().getTreeSelectionModel().addTreeSelectionListener(this); + } + + @Override + public void valueChanged(TreeSelectionEvent e) { + setEnabled(myTable.getSelectedNodes() != null && myTable.getSelectedNodes().length > 0); + } + + @Override + protected String getIconFilePrefix() { + return "call_number_"; + } + + @Override + public void actionPerformed(ActionEvent e) { + if (myTable.getSelectedNodes() != null && myTable.getSelectedNodes().length > 0) { + HumanResource resource = (HumanResource) myTable.getSelectedNodes()[0].getUserObject(); + if (resource != null) { + try { + BrowserControl.displayURL("tel:" + resource.getPhone()); + } catch (Exception exception) { + System.err.println(exception); + } + } + } + } +} diff --git a/org.ganttproject.impex.htmlpdf/resource/html-export-themes/default/gantt-resources.xsl b/org.ganttproject.impex.htmlpdf/resource/html-export-themes/default/gantt-resources.xsl index 7c21f89997..24b7ada760 100644 --- a/org.ganttproject.impex.htmlpdf/resource/html-export-themes/default/gantt-resources.xsl +++ b/org.ganttproject.impex.htmlpdf/resource/html-export-themes/default/gantt-resources.xsl @@ -20,7 +20,7 @@ mailto: - + tel: diff --git a/org.ganttproject.impex.htmlpdf/resource/html-export-themes/striped_blue/gantt-resources.xsl b/org.ganttproject.impex.htmlpdf/resource/html-export-themes/striped_blue/gantt-resources.xsl index 8cf7b3b47f..1b958ae84e 100644 --- a/org.ganttproject.impex.htmlpdf/resource/html-export-themes/striped_blue/gantt-resources.xsl +++ b/org.ganttproject.impex.htmlpdf/resource/html-export-themes/striped_blue/gantt-resources.xsl @@ -36,7 +36,7 @@ mailto: - + tel: From 15ae8526a2bea0908ac3ff0cd8ebb07452ff2f94 Mon Sep 17 00:00:00 2001 From: Boris Kraut Date: Tue, 26 Nov 2019 23:26:41 +0100 Subject: [PATCH 2/2] Use own icon for calls --- .../data/resources/icons/call_number_16.gif | Bin 323 -> 920 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/ganttproject/data/resources/icons/call_number_16.gif b/ganttproject/data/resources/icons/call_number_16.gif index c43c5d51c5164161fbbfa35391f86f03f420b4e4..67ce71ac6a9fd223aaf0de8a7df052094908c43b 100644 GIT binary patch literal 920 zcmYk5F^kwm6vXGkK~zpT2}lB0s8|TAU>F1?AZZd~C&*%9rNa0LqL4xs)Fy{05riip zN>GGFFojqfB#jO!BwGnKDk64*g;EfJH1}6_&BGy^RnNQizeQ z0YO4U5#DBOU?ZE@ip^|c2RqrtUhHNM2RO(fj^Z#!IKfFyaTcdJ!v!vKiL1EG6$T6$ zF~ykKbZl!=kWhj*S!z(Dn$$|oYEg$e)umqQR*wcWs3DEgutqeYNlj^%rZuAlEow=t zw5$~c3Kc1(SlJM4#92_G3f_oRLp4@YwW{W7sgCNbuIg3Y)l&mCSVJ|chHIoIYO}9`uk$ zdDtVK@T8|a%hR6mf)~ByRbKXr1BZ^Ba_rn$wbwbfzo4 z(w&|RWH3V+mEnwJB9ocQtW0Mn3t7xkR%JQs=(8xdFS=d_pa?;`SR7P*Pb~3!=EQF p|8(PpgPlj-fAsl}A3of9bN{6~r+@wC!;{}$I(OmgFK!N;`4_<1zApd( literal 323 zcmZ?wbhEHb6krfwxXQrr;{CVP$L{UE`1Ib(&n6|S^)hByRjf76nqiqUBVpR%?71fj z7M`qMd8TvYrJhZfXY9T?XYZ}K`)+PN^JvT2N88Uo*>~mniQBJ_-+FcD#V3Z)>3Iu| zSFbp;;K0r0NAEs;_vJqrFwhbx{$ycfU{GMt0a*g_69Zd