You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
3.2 KiB
100 lines
3.2 KiB
/* |
|
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
|
*/ |
|
package com.fr.design.actions.server; |
|
|
|
import com.fr.base.svg.IconUtils; |
|
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.i18n.DesignSizeI18nManager; |
|
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; |
|
|
|
/** |
|
* Server Config Manager |
|
*/ |
|
public class ServerConfigManagerAction extends UpdateAction { |
|
public static final Dimension DEFAULT = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.actions.server.dialog"); |
|
|
|
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) { |
|
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.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; |
|
} |
|
}; |
|
}
|
|
|