Browse Source

REPORT-14835 调整代码

research/10.0
XiaXiang 6 years ago
parent
commit
dd073e9255
  1. 15
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java
  2. 5
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java
  3. 6
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java
  4. 6
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java
  5. 20
      designer-realize/src/main/java/com/fr/start/Designer.java

15
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java

@ -35,24 +35,17 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
String fileOfVersion = null;
String fileOfVersion;
Component editor = row == 0 ? firstRowPanel : renderAndEditor;
if (isSelected) {
return editor;
} else if (row == 0) {
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
try {
fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", ""));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", ""));
} else {
renderAndEditor.update((VcsEntity) value);
try {
fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion());
}
editor.setBackground(VcsHelper.TABLE_SELECT_BACKGROUND);

5
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java

@ -7,8 +7,9 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.report.ReportContext;
import com.fr.report.entity.VcsEntity;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
import javax.swing.AbstractAction;
import javax.swing.Box;
@ -59,7 +60,7 @@ public class FileVersionDialog extends UIDialog {
public void actionPerformed(ActionEvent e) {
FileVersionDialog.this.setVisible(false);
Date date = dateEditor.getValue();
List<VcsEntity> vcsEntities = ReportContext.getInstance().getVcsController().queryFilterFileVersions(date, new Date(date.getTime() + DELAY), textField.getText());
List<VcsEntity> vcsEntities = WorkContext.getCurrent().get(VcsOperator.class).getFilterVersions(date, new Date(date.getTime() + DELAY), textField.getText());
FileVersionTable.getInstance().updateModel(1, vcsEntities);
}

6
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java

@ -63,11 +63,7 @@ public class FileVersionRowPanel extends JPanel {
public void actionPerformed(ActionEvent evt) {
if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
try {
WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity);
FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename());
}
}

6
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java

@ -134,11 +134,7 @@ public class FileVersionsPanel extends BasicPane {
}
titleLabel.setText(filename);
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
try {
FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", "")));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", "")));
}
public void showFileVersionsPane() {

20
designer-realize/src/main/java/com/fr/start/Designer.java

@ -292,18 +292,14 @@ public class Designer extends BaseDesigner {
* @param jt
*/
private void dealWithVcs(JTemplate jt) {
try {
String fileName = VcsHelper.getEditingFilename();
int latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName);
if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) {
WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1);
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", "")));
} else {
WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error("vcs error: {}", e.getMessage());
String fileName = VcsHelper.getEditingFilename();
int latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName);
if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) {
WorkContext.getCurrent().get(VcsOperator.class).saveVersionFromCache(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1);
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", "")));
} else {
WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1);
}
}

Loading…
Cancel
Save