forked from fanruan/demo-tabledata-redis
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.
72 lines
2.1 KiB
72 lines
2.1 KiB
6 years ago
|
package com.fr.plugin.db.redis.ui;
|
||
|
|
||
|
import com.fr.design.dialog.BasicPane;
|
||
|
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.design.layout.TableLayout;
|
||
|
import com.fr.design.layout.TableLayoutHelper;
|
||
|
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 = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
|
||
|
double[] rowSize = {p, p, p};
|
||
|
double[] columnSize = {p, f};
|
||
|
|
||
|
add(TableLayoutHelper.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);
|
||
|
}
|
||
|
}
|