|
|
@ -4,7 +4,6 @@ import com.fr.base.GraphHelper; |
|
|
|
import com.fr.design.base.mode.DesignModeContext; |
|
|
|
import com.fr.design.base.mode.DesignModeContext; |
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
|
|
|
|
import com.fr.design.file.MutilTempalteTabPane; |
|
|
|
import com.fr.design.file.MutilTempalteTabPane; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
@ -15,12 +14,15 @@ import com.fr.design.mainframe.DesignerFrameFileDealerPane; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.ToolBarNewTemplatePane; |
|
|
|
import com.fr.design.mainframe.ToolBarNewTemplatePane; |
|
|
|
import com.fr.design.mainframe.WestRegionContainerPane; |
|
|
|
import com.fr.design.mainframe.WestRegionContainerPane; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.vcs.common.Constants; |
|
|
|
import com.fr.design.menu.ToolBarDef; |
|
|
|
import com.fr.design.menu.ToolBarDef; |
|
|
|
import com.fr.file.FileNodeFILE; |
|
|
|
import com.fr.file.FileNodeFILE; |
|
|
|
import com.fr.file.filetree.FileNode; |
|
|
|
import com.fr.file.filetree.FileNode; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
import com.fr.workspace.server.vcs.common.Constants; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
|
|
|
import com.fr.workspace.server.vcs.VcsOperator; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.Box; |
|
|
|
import javax.swing.Box; |
|
|
@ -33,19 +35,28 @@ import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
|
|
|
|
public class FileVersionsPanel extends BasicPane { |
|
|
|
public class FileVersionsPanel extends BasicPane { |
|
|
|
private static final String ELLIPSIS = "..."; |
|
|
|
private static final String ELLIPSIS = "..."; |
|
|
|
|
|
|
|
private static volatile FileVersionsPanel instance; |
|
|
|
|
|
|
|
|
|
|
|
private final FileVersionTablePanel fileVersionsTablePane; |
|
|
|
|
|
|
|
private UILabel titleLabel; |
|
|
|
private UILabel titleLabel; |
|
|
|
private String templatePath; |
|
|
|
private String templatePath; |
|
|
|
private UIButton filterBtn; |
|
|
|
private UIButton filterBtn; |
|
|
|
private FileVersionDialog versionDialog; |
|
|
|
private FileVersionDialog versionDialog; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FileVersionsPanel(FileVersionTablePanel fileVersionTablePanel) { |
|
|
|
private FileVersionsPanel() { |
|
|
|
this.fileVersionsTablePane = fileVersionTablePanel; |
|
|
|
|
|
|
|
initComponents(); |
|
|
|
initComponents(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static FileVersionsPanel getInstance() { |
|
|
|
|
|
|
|
if (instance == null) { |
|
|
|
|
|
|
|
synchronized (FileVersionsPanel.class) { |
|
|
|
|
|
|
|
instance = new FileVersionsPanel(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return instance; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initComponents() { |
|
|
|
private void initComponents() { |
|
|
|
setLayout(new BorderLayout()); |
|
|
|
setLayout(new BorderLayout()); |
|
|
|
UIToolbar toolbar = ToolBarDef.createJToolBar(); |
|
|
|
UIToolbar toolbar = ToolBarDef.createJToolBar(); |
|
|
@ -83,7 +94,7 @@ public class FileVersionsPanel extends BasicPane { |
|
|
|
toolbar.add(upPane); |
|
|
|
toolbar.add(upPane); |
|
|
|
add(toolbar, BorderLayout.NORTH); |
|
|
|
add(toolbar, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
UIScrollPane jScrollPane = new UIScrollPane(fileVersionsTablePane); |
|
|
|
UIScrollPane jScrollPane = new UIScrollPane(FileVersionTable.getInstance()); |
|
|
|
add(jScrollPane, BorderLayout.CENTER); |
|
|
|
add(jScrollPane, BorderLayout.CENTER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -106,7 +117,7 @@ public class FileVersionsPanel extends BasicPane { |
|
|
|
MutilTempalteTabPane.getInstance().closeFormat(jt); |
|
|
|
MutilTempalteTabPane.getInstance().closeFormat(jt); |
|
|
|
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt); |
|
|
|
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt); |
|
|
|
|
|
|
|
|
|
|
|
udpateDesignerFrame(true); |
|
|
|
updateDesignerFrame(true); |
|
|
|
|
|
|
|
|
|
|
|
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, path); |
|
|
|
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, path); |
|
|
|
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); |
|
|
|
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); |
|
|
@ -116,16 +127,21 @@ public class FileVersionsPanel extends BasicPane { |
|
|
|
templatePath = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); |
|
|
|
templatePath = DesignerFrameFileDealerPane.getInstance().getSelectedOperation().getFilePath(); |
|
|
|
String[] paths = StableUtils.pathSplit(templatePath); |
|
|
|
String[] paths = StableUtils.pathSplit(templatePath); |
|
|
|
String filename = paths[paths.length - 1]; |
|
|
|
String filename = paths[paths.length - 1]; |
|
|
|
int width = fileVersionsTablePane.getWidth() - 40; |
|
|
|
int width = FileVersionTable.getInstance().getWidth() - 40; |
|
|
|
if (getStringWidth(filename) > width) { |
|
|
|
if (getStringWidth(filename) > width) { |
|
|
|
filename = getEllipsisName(filename, width); |
|
|
|
filename = getEllipsisName(filename, width); |
|
|
|
} |
|
|
|
} |
|
|
|
titleLabel.setText(filename); |
|
|
|
titleLabel.setText(filename); |
|
|
|
fileVersionsTablePane.updateModel(1); |
|
|
|
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()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void showFileVersionsPane() { |
|
|
|
public void showFileVersionsPane() { |
|
|
|
udpateDesignerFrame(false); |
|
|
|
updateDesignerFrame(false); |
|
|
|
refreshVersionTablePane(); |
|
|
|
refreshVersionTablePane(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -135,7 +151,7 @@ public class FileVersionsPanel extends BasicPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void udpateDesignerFrame(boolean isExit) { |
|
|
|
private void updateDesignerFrame(boolean isExit) { |
|
|
|
// 左上侧面板
|
|
|
|
// 左上侧面板
|
|
|
|
WestRegionContainerPane.getInstance().replaceUpPane( |
|
|
|
WestRegionContainerPane.getInstance().replaceUpPane( |
|
|
|
isExit ? DesignerFrameFileDealerPane.getInstance() : this); |
|
|
|
isExit ? DesignerFrameFileDealerPane.getInstance() : this); |
|
|
@ -144,7 +160,7 @@ public class FileVersionsPanel extends BasicPane { |
|
|
|
// MutilTempalteTabPane & NewTemplatePane 是否可点
|
|
|
|
// MutilTempalteTabPane & NewTemplatePane 是否可点
|
|
|
|
ToolBarNewTemplatePane.getInstance().setButtonGray(!isExit); |
|
|
|
ToolBarNewTemplatePane.getInstance().setButtonGray(!isExit); |
|
|
|
|
|
|
|
|
|
|
|
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); |
|
|
|
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
|
|
|
if (currentEditingTemplate.isJWorkBook()) { |
|
|
|
if (currentEditingTemplate.isJWorkBook()) { |
|
|
|
DesignerContext.getDesignerFrame().resetToolkitByPlus(currentEditingTemplate); |
|
|
|
DesignerContext.getDesignerFrame().resetToolkitByPlus(currentEditingTemplate); |
|
|
|
} |
|
|
|
} |
|
|
|