|
|
|
/*
|
|
|
|
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
|
|
|
|
*/
|
|
|
|
package com.fr.design.actions.server;
|
|
|
|
|
|
|
|
import com.fr.config.Configuration;
|
|
|
|
import com.fr.config.ServerPreferenceConfig;
|
|
|
|
import com.fr.design.actions.UpdateAction;
|
|
|
|
import com.fr.design.dialog.BasicDialog;
|
|
|
|
import com.fr.design.dialog.DialogActionAdapter;
|
|
|
|
import com.fr.design.mainframe.DesignerContext;
|
|
|
|
import com.fr.design.menu.MenuKeySet;
|
|
|
|
import com.fr.design.webattr.EditReportServerParameterPane;
|
|
|
|
|
|
|
|
import com.fr.transaction.Configurations;
|
|
|
|
import com.fr.transaction.Worker;
|
|
|
|
import com.fr.web.attr.ReportWebAttr;
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
import java.awt.*;
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
import java.awt.event.WindowAdapter;
|
|
|
|
import java.awt.event.WindowEvent;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Server Config Manager
|
|
|
|
*/
|
|
|
|
public class ServerConfigManagerAction extends UpdateAction {
|
|
|
|
public static final Dimension DEFAULT = new Dimension(700, 630);
|
|
|
|
|
|
|
|
public ServerConfigManagerAction() {
|
|
|
|
this.setMenuKeySet(SERVER_CONFIG_MANAGER);
|
|
|
|
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
|
|
|
|
this.setMnemonic(getMenuKeySet().getMnemonic());
|
|
|
|
this.setSmallIcon("/com/fr/design/images/m_web/edit");
|
|
|
|
this.generateAndSetSearchText(EditReportServerParameterPane.class.getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 动作
|
|
|
|
*
|
|
|
|
* @param e 事件
|
|
|
|
*/
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
DesignerContext.getDesignerFrame().setServerConfig(true);
|
|
|
|
final ServerPreferenceConfig config = ServerPreferenceConfig.getInstance();
|
|
|
|
final EditReportServerParameterPane editReportServerParameterPane = new EditReportServerParameterPane() {
|
|
|
|
@Override
|
|
|
|
public void complete() {
|
|
|
|
|
|
|
|
ServerPreferenceConfig mirror = config.mirror();
|
|
|
|
populate(mirror);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
final BasicDialog editReportServerParameterDialog = editReportServerParameterPane.showWindowWithCustomSize(
|
|
|
|
DesignerContext.getDesignerFrame(), null, DEFAULT
|
|
|
|
);
|
|
|
|
|
|
|
|
editReportServerParameterDialog.addDialogActionListener(new DialogActionAdapter() {
|
|
|
|
@Override
|
|
|
|
public void doOk() {
|
|
|
|
Configurations.update(new Worker() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
editReportServerParameterPane.update(config);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Class<? extends Configuration>[] targets() {
|
|
|
|
return new Class[]{ReportWebAttr.class, ServerPreferenceConfig.class};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
editReportServerParameterDialog.addWindowListener(new WindowAdapter() {
|
|
|
|
@Override
|
|
|
|
public void windowClosed(WindowEvent e) {
|
|
|
|
super.windowClosed(e);
|
|
|
|
DesignerContext.getDesignerFrame().setServerConfig(false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
editReportServerParameterDialog.setVisible(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void update() {
|
|
|
|
this.setEnabled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final MenuKeySet SERVER_CONFIG_MANAGER = new MenuKeySet() {
|
|
|
|
@Override
|
|
|
|
public char getMnemonic() {
|
|
|
|
return 'M';
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getMenuName() {
|
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Server_Server_Config_Manager");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public KeyStroke getKeyStroke() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|