|
|
|
package com.fr.plugin.db.redis.ui;
|
|
|
|
|
|
|
|
import com.fanruan.api.design.ui.container.BasicPane;
|
|
|
|
import com.fanruan.api.design.DesignKit;
|
|
|
|
import com.fanruan.api.layout.LayoutKit;
|
|
|
|
import com.fr.design.editor.ValueEditorPane;
|
|
|
|
import com.fr.design.gui.ilable.UILabel;
|
|
|
|
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
|
|
|
|
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
|
|
|
|
import com.fr.design.i18n.Toolkit;
|
|
|
|
import com.fr.plugin.db.redis.core.order.OrderValue;
|
|
|
|
import com.fr.plugin.db.redis.ui.value.IndexValuePaneFactory;
|
|
|
|
import com.fr.plugin.db.redis.util.RedisDesignUtils;
|
|
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author richie
|
|
|
|
* @version 10.0
|
|
|
|
* Created by richie on 2019-03-18
|
|
|
|
*/
|
|
|
|
public class RedisScriptPane extends BasicPane {
|
|
|
|
|
|
|
|
private ValueEditorPane dbIndexEditor;
|
|
|
|
private RSyntaxTextArea scriptTextPane;
|
|
|
|
|
|
|
|
public RedisScriptPane() {
|
|
|
|
|
|
|
|
setLayout(new BorderLayout());
|
|
|
|
|
|
|
|
scriptTextPane = new RSyntaxTextArea();
|
|
|
|
|
|
|
|
dbIndexEditor = IndexValuePaneFactory.createValueEditorPane();
|
|
|
|
|
|
|
|
Component[][] coms = new Component[][]{
|
|
|
|
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor},
|
|
|
|
{new UILabel(Toolkit.i18nText("Plugin-Redis_Script_Query_Text") + ":"),
|
|
|
|
RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 350)},
|
|
|
|
};
|
|
|
|
|
|
|
|
double p = LayoutKit.PREFERRED;
|
|
|
|
double f = LayoutKit.FILL;
|
|
|
|
|
|
|
|
double[] rowSize = {p, p, p};
|
|
|
|
double[] columnSize = {p, f};
|
|
|
|
|
|
|
|
add(DesignKit.createTableLayoutPane(coms, rowSize, columnSize));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected String title4PopupWindow() {
|
|
|
|
return "Script";
|
|
|
|
}
|
|
|
|
|
|
|
|
public OrderValue getOrderValue() {
|
|
|
|
return (OrderValue) dbIndexEditor.update();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOrderValue(OrderValue orderValue) {
|
|
|
|
dbIndexEditor.populate(orderValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getScript() {
|
|
|
|
return scriptTextPane.getText();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setScript(String script) {
|
|
|
|
scriptTextPane.setText(script);
|
|
|
|
}
|
|
|
|
}
|