Author: tchemit Date: 2008-03-31 20:41:08 +0000 (Mon, 31 Mar 2008) New Revision: 249 Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFileStateImpl.java trunk/lutinvcs/lutinvcs-ui/src/main/uimodel/org/codelutin/vcs/ui/VCSUpdateDialog.jaxx trunk/lutinvcs/lutinvcs-ui/src/main/uimodel/org/codelutin/vcs/ui/common.css trunk/lutinvcs/lutinvcs-ui/src/test/java/org/codelutin/vcs/ui/UITest.java Log: begin of synch ui Modified: trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFileStateImpl.java =================================================================== --- trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFileStateImpl.java 2008-03-31 20:40:35 UTC (rev 248) +++ trunk/lutinvcs/lutinvcs-core/src/main/java/org/codelutin/vcs/VCSFileStateImpl.java 2008-03-31 20:41:08 UTC (rev 249) @@ -73,7 +73,7 @@ * @param handler the vcs handler used with this working copy * @param file file to be handled */ - protected VCSFileStateImpl(VCSHandler handler, File file) { + public VCSFileStateImpl(VCSHandler handler, File file) { this.file = file; this.key = file.getAbsolutePath().hashCode(); String path = file.getAbsolutePath(); @@ -85,7 +85,12 @@ "vcsHandler, but was : [" + file + " ::" + handler.getLocalDatabasePath() + " ]"); } - this.localPath = path.substring(rootPath.length() + 1); + if (file.equals(handler.getConfig().getLocalDatabasePath())) { + this.localPath = ""; + } else { + + this.localPath = path.substring(rootPath.length() + 1); + } // by default moduleName is the first dir of localpath (if any) int index = this.localPath.indexOf(File.separator); if (index == -1) { @@ -254,5 +259,9 @@ public void setAction(VCSAction action) { this.action = action; } + + public void setState(VCSState state) { + this.state = state; + } } Modified: trunk/lutinvcs/lutinvcs-ui/src/main/uimodel/org/codelutin/vcs/ui/VCSUpdateDialog.jaxx =================================================================== --- trunk/lutinvcs/lutinvcs-ui/src/main/uimodel/org/codelutin/vcs/ui/VCSUpdateDialog.jaxx 2008-03-31 20:40:35 UTC (rev 248) +++ trunk/lutinvcs/lutinvcs-ui/src/main/uimodel/org/codelutin/vcs/ui/VCSUpdateDialog.jaxx 2008-03-31 20:41:08 UTC (rev 249) @@ -1,8 +1,11 @@ -<JDialog title='lutinutil.config.title' modal='true' - defaultCloseOperation='DISPOSE_ON_CLOSE' width='500' height='300'> +<JDialog title='lutinvcs.synch.title' + defaultCloseOperation='DISPOSE_ON_CLOSE'> <style source="common.css"/> <script> + protected void selectTab(String tabname) { + cardLayout.show(preview, tabname); + } Action quitAction ; JRootPane rootPane = getRootPane(); @@ -15,49 +18,67 @@ }; rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),"quit"); rootPane.getActionMap().put("quit", quitAction); + allTable.setModel(model.getModel("model.synch.all")); + localTable.setModel(model.getModel("model.synch.local")); + remoteTable.setModel(model.getModel("model.synch.remote")); + refresh.setText(""); + diffAll.setText(""); + updateAll.setText(""); + commitAll.setText(""); + revertAll.setText(""); </script> <DefaultListModel id='listModel'/> - <org.codelutin.vcs.ui.VCSFileStateTableModel id="allModel"/> - <org.codelutin.vcs.ui.VCSFileStateTableModel id="localModel"/> - <org.codelutin.vcs.ui.VCSFileStateTableModel id="remoteModel"/> + <org.codelutin.vcs.ui.model.SynchUIModel id="model"/> <java.awt.CardLayout id='cardLayout'/> <JPopupMenu id="tablePopupMenu" invoker='{allTable}' enabled='false'> - <JMenuItem id='diff'/> - <JMenuItem id='update'/> - <JMenuItem id='commit'/> - <JMenuItem id='revert'/> + <JMenuItem id='diff' text="lutinvcs.action.diff" toolTipText="lutinvcs.action.tooltip.diff"/> + <JMenuItem id='update' text="lutinvcs.action.update" toolTipText="lutinvcs.action.tooltip.update"/> + <JMenuItem id='commit' text="lutinvcs.action.commit" toolTipText="lutinvcs.action.tooltip.commit"/> + <JMenuItem id='revert' text="lutinvcs.action.revert" toolTipText="lutinvcs.action.tooltip.revert"/> </JPopupMenu> <Table> <row fill='both'> <cell fill='both' weightx='1'> <JToolBar> - <JButton id='refresh' text="lutinvcs.action.refresh"/> - <JButton id='diffAll' text="lutinvcs.action.diffAll"/> - <JButton id='updateAll' text="lutinvcs.action.updateAll"/> - <JButton id='commitAll' text="lutinvcs.action.commitAll"/> - <JButton id='revertAll' text="lutinvcs.action.revertAll"/> + <JToggleButton id='allTab' selected='true' buttonGroup='tabs' text='lutinvcs.tabs.all' + toolTipText="lutinvcs.tabs.tooltip.all" onActionPerformed='selectTab("all")'/> + <JToggleButton id='localTab' selected='false' buttonGroup='tabs' text='lutinvcs.tabs.local' + toolTipText="lutinvcs.tabs.tooltip.local" onActionPerformed='selectTab("local")'/> + <JToggleButton id='remoteTab' selected='false' buttonGroup='tabs' text='lutinvcs.tabs.remote' + toolTipText="lutinvcs.tabs.tooltip.remote" onActionPerformed='selectTab("remote")'/> + + <JButton id='refresh' text="lutinvcs.action.refresh" toolTipText="lutinvcs.action.tooltip.refresh" + icon='{createImageIcon("autoRefresh.png")}'/> + <JButton id='diffAll' text="lutinvcs.action.diffAll" toolTipText="lutinvcs.action.tooltip.diffAll" + icon='{createImageIcon("diff.png")}'/> + <JButton id='updateAll' text="lutinvcs.action.updateAll" + toolTipText="lutinvcs.action.tooltip.updateAll" icon='{createImageIcon("update.png")}'/> + <JButton id='commitAll' text="lutinvcs.action.commitAll" + toolTipText="lutinvcs.action.tooltip.commitAll" icon='{createImageIcon("commit.png")}'/> + <JButton id='revertAll' text="lutinvcs.action.revertAll" + toolTipText="lutinvcs.action.tooltip.revertAll" icon='{createImageIcon("rollback.png")}'/> </JToolBar> </cell> </row> - <row fill='both'> + <row fill='both'> <cell fill='both' weighty='1' weightx='2'> <JPanel id='preview' layout='{cardLayout}'> <JScrollPane id='allContent' styleClass='updateScroll' constraints='"all"'> - <JTable id="allTable" model="{allModel}" styleClass='updateTable'/> + <JTable id="allTable" styleClass='updateTable'/> </JScrollPane> <JScrollPane id='localContent' styleClass='updateScroll' visible='false' constraints='"local"'> - <JTable id="localTable" model="{localModel}" styleClass='updateTable'/> + <JTable id="localTable" styleClass='updateTable'/> </JScrollPane> <JScrollPane id='remoteContent' styleClass='updateScroll' visible='false' constraints='"remote"'> - <JTable id="remoteTable" model="{remoteModel}" styleClass='updateTable'/> + <JTable id="remoteTable" styleClass='updateTable'/> </JScrollPane> </JPanel> </cell> </row> <row> <cell columns='2' fill='both'> - <JButton id='quit' text='lutinutil.common.quit' action='{quitAction}'/> + <JButton id='quit' text='lutinvcs.quit' action='{quitAction}'/> </cell> </row> </Table> Modified: trunk/lutinvcs/lutinvcs-ui/src/main/uimodel/org/codelutin/vcs/ui/common.css =================================================================== --- trunk/lutinvcs/lutinvcs-ui/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-03-31 20:40:35 UTC (rev 248) +++ trunk/lutinvcs/lutinvcs-ui/src/main/uimodel/org/codelutin/vcs/ui/common.css 2008-03-31 20:41:08 UTC (rev 249) @@ -1,36 +1,49 @@ JToolBar { - floatable:false; - focusable:false; - opaque:false; - margin:0; - borderPainted:false; + floatable: false; + focusable: false; + opaque: false; + margin: 0; + borderPainted: false; } JButton { - opaque:false; - borderPainted:false; - /*enabled:false;*/ - margin:0; + opaque: false; + borderPainted: false; + enabled: false; + margin: 0; } +JToggleButton { + opaque: false; + borderPainted: false; + margin: 0; +} + JMenuItem { - enabled:true; + enabled: true; } JMenu { - enabled:true; + enabled: true; } .smallSize { - font-size:9; + font-size: 9; } .updateTable { - rowSelectionAllowed:false; - autoResizeMode:auto_resize_last_column; + rowSelectionAllowed: true; + autoResizeMode: auto_resize_last_column; + showVerticalLines: false; + cellSelectionEnabled: false; + rowMargin: 0; + selectionMode: { ListSelectionModel . MULTIPLE_INTERVAL_SELECTION } +; +} + .updateScroll { - verticalScrollBarPolicy:20; - horizontalScrollBarPolicy:31; + verticalScrollBarPolicy: 20; + horizontalScrollBarPolicy: 31; } \ No newline at end of file Modified: trunk/lutinvcs/lutinvcs-ui/src/test/java/org/codelutin/vcs/ui/UITest.java =================================================================== --- trunk/lutinvcs/lutinvcs-ui/src/test/java/org/codelutin/vcs/ui/UITest.java 2008-03-31 20:40:35 UTC (rev 248) +++ trunk/lutinvcs/lutinvcs-ui/src/test/java/org/codelutin/vcs/ui/UITest.java 2008-03-31 20:41:08 UTC (rev 249) @@ -14,11 +14,70 @@ */ package org.codelutin.vcs.ui; +import org.codelutin.vcs.VCSFileState; +import org.codelutin.vcs.VCSFileStateImpl; +import org.codelutin.vcs.VCSHandler; +import org.codelutin.vcs.VCSHandlerFactory; +import org.codelutin.vcs.VCSState; +import org.codelutin.vcs.mock.MockVCSConfig; +import org.codelutin.vcs.ui.model.SynchUIModel; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + /** @author chemit */ public class UITest { public static void main(String[] args) { - VCSUpdateDialog dialog =new VCSUpdateDialog(); + org.codelutin.i18n.I18n.init(); + + VCSUpdateDialog dialog = new VCSUpdateDialog(); + SynchUIModel model = dialog.getModel(); + MockVCSConfig config = new MockVCSConfig(); + File root = new File(new File("").getAbsolutePath()); + config.setLocalRoot(root); + config.setInit(true); + VCSHandlerFactory.setConfig(config); + + VCSHandler handler = VCSHandlerFactory.getHandler(); + + List<VCSFileState> datas = generateLocalFileStates(handler, new File(root, "trunk")); + datas.addAll(generateRemoteFileStates(handler, new File(root, "trunk"))); + + model.setData(datas); dialog.setVisible(true); } + + protected static List<VCSFileState> generateLocalFileStates(VCSHandler handler, File root) { + List<VCSFileState> datas = new ArrayList<VCSFileState>(); + VCSFileStateImpl state; + state = new VCSFileStateImpl(handler, new File(root, "local/file0")); + state.setState(VCSState.MODIFIED); + datas.add(state); + + state = new VCSFileStateImpl(handler, new File(root, "local/file1")); + state.setState(VCSState.UNVERSIONNED); + datas.add(state); + state = new VCSFileStateImpl(handler, new File(root, "local/file2")); + state.setState(VCSState.MODIFIED); + datas.add(state); + return datas; + } + + protected static List<VCSFileState> generateRemoteFileStates(VCSHandler handler, File root) { + List<VCSFileState> datas = new ArrayList<VCSFileState>(); + VCSFileStateImpl state; + state = new VCSFileStateImpl(handler, new File(root, "remote/file0")); + state.setState(VCSState.MISSING); + datas.add(state); + + state = new VCSFileStateImpl(handler, new File(root, "remote/file1")); + state.setState(VCSState.OUT_OF_DATE); + datas.add(state); + state = new VCSFileStateImpl(handler, new File(root, "remote/file2")); + state.setState(VCSState.MISSING); + datas.add(state); + return datas; + } }
participants (1)
-
tchemit@users.labs.libre-entreprise.org