Browse Source

REPORT-14835 调整代码

research/10.0
XiaXiang 6 years ago
parent
commit
dd073e9255
  1. 11
      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. 4
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java
  4. 4
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java
  5. 4
      designer-realize/src/main/java/com/fr/start/Designer.java

11
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 @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
String fileOfVersion = null; String fileOfVersion;
Component editor = row == 0 ? firstRowPanel : renderAndEditor; Component editor = row == 0 ? firstRowPanel : renderAndEditor;
if (isSelected) { if (isSelected) {
return editor; return editor;
} else if (row == 0) { } else if (row == 0) {
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
try {
fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", "")); fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfCurrent(path.replaceFirst("/", ""));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
} else { } else {
renderAndEditor.update((VcsEntity) value); renderAndEditor.update((VcsEntity) value);
try {
fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion()); fileOfVersion = WorkContext.getCurrent().get(VcsOperator.class).getFileOfFileVersion(((VcsEntity) value).getFilename(), ((VcsEntity) value).getVersion());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
} }
editor.setBackground(VcsHelper.TABLE_SELECT_BACKGROUND); 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.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.report.ReportContext;
import com.fr.report.entity.VcsEntity; 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.AbstractAction;
import javax.swing.Box; import javax.swing.Box;
@ -59,7 +60,7 @@ public class FileVersionDialog extends UIDialog {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
FileVersionDialog.this.setVisible(false); FileVersionDialog.this.setVisible(false);
Date date = dateEditor.getValue(); 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); FileVersionTable.getInstance().updateModel(1, vcsEntities);
} }

4
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) { 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"), 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) { JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
try {
WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename()); FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename());
} }
} }

4
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); titleLabel.setText(filename);
String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); String path = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath();
try {
FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", ""))); FileVersionTable.getInstance().updateModel(1, WorkContext.getCurrent().get(VcsOperator.class).getVersions(path.replaceFirst("/", "")));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
} }
public void showFileVersionsPane() { public void showFileVersionsPane() {

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

@ -292,7 +292,6 @@ public class Designer extends BaseDesigner {
* @param jt * @param jt
*/ */
private void dealWithVcs(JTemplate jt) { private void dealWithVcs(JTemplate jt) {
try {
String fileName = VcsHelper.getEditingFilename(); String fileName = VcsHelper.getEditingFilename();
int latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName); int latestFileVersion = WorkContext.getCurrent().get(VcsOperator.class).getLatestFileVersion(fileName);
if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) { if (jt.getEditingFILE() instanceof VcsCacheFileNodeFile) {
@ -302,9 +301,6 @@ public class Designer extends BaseDesigner {
} else { } else {
WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1); WorkContext.getCurrent().get(VcsOperator.class).saveVersion(VcsHelper.CURRENT_USERNAME, fileName, StringUtils.EMPTY, latestFileVersion + 1);
} }
} catch (Exception e) {
FineLoggerFactory.getLogger().error("vcs error: {}", e.getMessage());
}
} }
private UIButton createUndoButton() { private UIButton createUndoButton() {

Loading…
Cancel
Save