gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org.gvsig.vcsgis.swing / org.gvsig.vcsgis.swing.impl / src / main / java / org / gvsig / vcsgis / swing / impl / changes / VCSGisJChangesImpl.java @ 2707
History | View | Annotate | Download (5.8 KB)
1 |
/*
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2020 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18 |
*
|
19 |
* For any additional information, do not hesitate to contact us
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
21 |
*/
|
22 |
|
23 |
package org.gvsig.vcsgis.swing.impl.changes; |
24 |
|
25 |
import java.awt.Color; |
26 |
import java.awt.Dimension; |
27 |
import javax.swing.ImageIcon; |
28 |
import javax.swing.JComponent; |
29 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
30 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
31 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
32 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
33 |
import org.gvsig.vcsgis.swing.VCSGisJChanges; |
34 |
import org.gvsig.vcsgis.swing.VCSGisSwingLocator; |
35 |
import org.gvsig.vcsgis.swing.VCSGisSwingManager; |
36 |
import org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl; |
37 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.ICON_COMMON_GROUP_NAME; |
38 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.ICON_GROUP_NAME; |
39 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.ICON_PROVIDER_NAME; |
40 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.registerIcons; |
41 |
|
42 |
/**
|
43 |
*
|
44 |
* @author gvSIG Team
|
45 |
*/
|
46 |
public class VCSGisJChangesImpl |
47 |
extends VCSGisJChangesView
|
48 |
implements VCSGisJChanges
|
49 |
{ |
50 |
|
51 |
private static final Color COLOR_TABLE_NEW = Color.GREEN.darker(); |
52 |
private static final Color COLOR_TABLE_MODIFIED = Color.BLUE.darker(); |
53 |
private static final Color COLOR_TABLE_UNMODIFIED = Color.BLACK; |
54 |
private static final Color COLOR_TABLE_OUTDATED = Color.LIGHT_GRAY; |
55 |
|
56 |
|
57 |
private static final Color COLOR_ROW_NEW = Color.GREEN.darker(); |
58 |
private static final Color COLOR_ROW_MODIFIED = Color.BLUE.darker(); |
59 |
private static final Color COLOR_ROW_DELETED = Color.RED.darker(); |
60 |
private static final Color COLOR_ROW_OUTDATED = Color.LIGHT_GRAY; // when table is outdated |
61 |
|
62 |
private PickerController<VCSGisWorkspace> workspacePicker;
|
63 |
private LocalChangesController localChangesController;
|
64 |
private RemoteChangesController remoteChangesController;
|
65 |
|
66 |
public VCSGisJChangesImpl() {
|
67 |
initComponents(); |
68 |
} |
69 |
|
70 |
@Override
|
71 |
public JComponent asJComponent() { |
72 |
return this; |
73 |
} |
74 |
|
75 |
@Override
|
76 |
public ImageIcon loadImage(String imageName) { |
77 |
return VCSGisSwingManagerImpl.loadImage(imageName);
|
78 |
} |
79 |
|
80 |
private void translate() { |
81 |
ToolsSwingManager swingManager = ToolsSwingLocator.getToolsSwingManager(); |
82 |
swingManager.translate(this.lblWorkspace);
|
83 |
swingManager.translate(this.btnWorkspace);
|
84 |
|
85 |
swingManager.translate(this.tabLocalAndRemote);
|
86 |
} |
87 |
|
88 |
private void initComponents() { |
89 |
VCSGisSwingManager vcsSwingManager = VCSGisSwingLocator.getVCSGisSwingManager(); |
90 |
|
91 |
translate(); |
92 |
|
93 |
this.workspacePicker = vcsSwingManager.createWorkspacePickerController(
|
94 |
cboWorkspace, |
95 |
btnWorkspace |
96 |
); |
97 |
|
98 |
this.localChangesController = new LocalChangesController( |
99 |
workspacePicker, |
100 |
tblLocalChanges, |
101 |
btnLocalCheckAll, |
102 |
btnLocalUnCheckAll, |
103 |
btnLocalShowForm, |
104 |
btnLocalRefresh, |
105 |
btnLocalCommit, |
106 |
btnLocalRevert, |
107 |
lblLocalEffectiveDate, |
108 |
txtLocalEffectiveDate, |
109 |
txtLocalComment, |
110 |
btnLocalEffectiveDate, |
111 |
lblLocalComment |
112 |
); |
113 |
|
114 |
this.remoteChangesController = new RemoteChangesController( |
115 |
this.workspacePicker,
|
116 |
this.lblRemoteMsg,
|
117 |
|
118 |
this.lstRemoteTables,
|
119 |
this.btnRemoteTablesCheckAll,
|
120 |
this.btnRemoteTablesUncheckAll,
|
121 |
this.btnRemoteTablesReload,
|
122 |
|
123 |
this.tblRemoteChanges,
|
124 |
this.btnRemoteCheckAll,
|
125 |
this.btnRemoteUncheckAll,
|
126 |
this.btnRemoteDownloadChanges,
|
127 |
this.btnRemoteReloadChanges,
|
128 |
this.btnRemoteCleanChanges,
|
129 |
this.btnRemoteUpdate,
|
130 |
this.btnRemoteMerge,
|
131 |
this.btnRemoteShowForm
|
132 |
); |
133 |
|
134 |
this.setPreferredSize(new Dimension(600, 400)); |
135 |
} |
136 |
|
137 |
public static void selfRegister() { |
138 |
String[][] iconsInfo = new String[][]{ |
139 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "common-check-off"}, |
140 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "common-check-on"}, |
141 |
new String[]{ICON_PROVIDER_NAME, ICON_COMMON_GROUP_NAME, "common-showform"}, |
142 |
new String[]{ICON_PROVIDER_NAME, ICON_GROUP_NAME, "vcsgis-commit-all"}, |
143 |
new String[]{ICON_PROVIDER_NAME, ICON_GROUP_NAME, "vcsgis-refresh-status"}, |
144 |
new String[]{ICON_PROVIDER_NAME, ICON_GROUP_NAME, "vcsgis-revert"}, |
145 |
new String[]{ICON_PROVIDER_NAME, ICON_GROUP_NAME, "vcsgis-update-all"}, |
146 |
new String[]{ICON_PROVIDER_NAME, ICON_GROUP_NAME, "vcsgis-merge"}, |
147 |
new String[]{ICON_PROVIDER_NAME, ICON_GROUP_NAME, "vcsgis-show-local-changes"}, |
148 |
new String[]{ICON_PROVIDER_NAME, ICON_GROUP_NAME, "vcsgis-show-remote-changes"}, |
149 |
new String[]{ICON_PROVIDER_NAME, ICON_GROUP_NAME, "vcsgis-show-local-and-remote-changes"}, |
150 |
}; |
151 |
registerIcons(iconsInfo); |
152 |
|
153 |
} |
154 |
|
155 |
} |