⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 erdviewerpanel.java

📁 eq跨平台查询工具源码 eq跨平台查询工具源码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    }        /** <p>Swaps the canvas background from the grid     *  display to the white background and vice-versa.     */    public void swapCanvasBackground() {        bgPanel.swapBackground();        layeredPane.repaint();    }        /** <p>Returns whether the grid is set to be displayed.     *     *  @return whether the grid is displayed     */    public boolean shouldDisplayGrid() {        return bgPanel.shouldDisplayGrid();    }        public void setDisplayMargin(boolean displayMargin) {        bgPanel.setDisplayMargin(displayMargin);    }        public void swapPageMargin() {        bgPanel.swapPageMargin();        layeredPane.repaint();    }        public ErdTitlePanel getTitlePanel() {        return erdTitlePanel;    }        public boolean shouldDisplayMargin() {        return bgPanel.shouldDisplayMargin();    }        /** <p>Returns a <code>ErdTableDependency</code> array of     *  all recorded/manufactured table dependencies within the     *  schema ERD displayed.     *     *  @return the <code>ErdTableDependency</code> array of     *          the open ERD     */    public ErdTableDependency[] getTableDependencies() {        return dependsPanel.getTableDependencies();    }        /** <p>Adds the outline panel of a selected table to the     *  layered pane when a drag operation occurs.     *     *  @param the dragging outline panel to be added     */    protected void addOutlinePanel(JPanel panel) {        layeredPane.add(panel, JLayeredPane.DRAG_LAYER);    }        /** <p>Removes the specified outline panel when dragging     *  has completed (mouse released).     *     *  @param the outline drag panel to remove     */    protected void removeOutlinePanel(JPanel panel) {        layeredPane.remove(panel);    }        /** <p>Resets the ERD table joins for all tables. */    protected void resetAllTableJoins() {                for (int i = 0, k = tables.size(); i < k; i++) {            ((ErdTable)tables.elementAt(i)).resetAllJoins();        }            }        /** <p>Returns the preferred size of the canvas.     *     *  @return a Dimension object representing the current     *          preferred size of the canvas     */    public Dimension getCanvasSize() {        return layeredPane.getPreferredSize();    }        /** <p>Sets the preferred size of the canvas and all     *  background components - grid panel, dependencies panel.     *     *  @param a Dimension object representing the desired     *         preferred size for the canvas     */    protected void setCanvasSize(Dimension dim) {                double scale = layeredPane.getScale();        int panelWidth = (int)(dim.width / scale);        int panelHeight = (int)(dim.height / scale);                Dimension scaleDim = new Dimension(panelWidth, panelHeight);                base.setPreferredSize(dim);                layeredPane.setPreferredSize(dim);//scale < 1.0 ? scaleDim : dim);        dependsPanel.setPreferredSize(scaleDim);        bgPanel.setPreferredSize(scaleDim);                dependsPanel.setBounds(bgPanel.getBounds());        //    dependsPanel.setBounds(0, 0, panelWidth, panelWidth);        layeredPane.setBounds(0, 0, dim.width, dim.height);                layeredPane.repaint();    }        protected void setTableBackground(Color c) {        ErdTable[] tablesArray = getAllComponentsArray();                for (int i = 0; i < tablesArray.length; i++) {            tablesArray[i].setTableBackground(c);        }                layeredPane.repaint();            }        /**     * Sets the canvas background to the specified colour.     */    public void setCanvasBackground(Color c) {        bgPanel.setBackground(c);        layeredPane.setGridDisplayed(false);        layeredPane.repaint();    }        protected Color getTableBackground() {        if (tables.size() == 0) {            return Color.WHITE;        } else {            return ((ErdTable)tables.elementAt(0)).getTableBackground();        }    }        protected Color getCanvasBackground() {        return bgPanel.getBackground();    }        /** <p>Repaints the layered pane during     *  table component movement and reapplication     *  of the relationship joins     */    protected void repaintLayeredPane() {        layeredPane.repaint();    }        /** <p>Removes the specified <code>ErdTable</code> from     *  the <code>Vector</code>.     *     *  @param the table to remove     */    public void removeTableComponent(ErdTable table) {        tables.removeElement(table);    }        public void setTableDisplayFont(String fontName, int tableNameStyle,                                    int columnNameStyle, int size) {                tableFontSize = size;        tableFontName = fontName;        tableNameFontStyle = tableNameStyle;        columnNameFontStyle = columnNameStyle;        tableNameFont = new Font(fontName, tableNameStyle, size + 1);        columnNameFont = new Font(fontName, columnNameStyle, size);        ErdTable[] tablesArray = getAllComponentsArray();        for (int i = 0; i < tablesArray.length; i++) {            tablesArray[i].tableColumnsChanged();        }                layeredPane.repaint();    }        public PageFormat getPageFormat() {        return SystemUtilities.getPageFormat();    }        public boolean canPrint() {        return true;    }        public String getPrintJobName() {        return "Execute Query - ERD";    }        public Printable getPrintable() {        return new ErdPrintable(this);    }        public void setDisplayKeysOnly(boolean display) {        ErdTable[] allTables = getAllComponentsArray();        for (int i = 0; i < allTables.length; i++) {            allTables[i].setDisplayReferencedKeysOnly(display);            allTables[i].tableColumnsChanged();        }        layeredPane.repaint();    }        /** <p>Adds a new table to the canvas. */    protected void addNewTable(ErdTable newTable) {                if (tables == null) {            tables = new Vector();        }        tables.add(newTable);                // place the new table in the center of the canvas        newTable.setBounds((layeredPane.getWidth() - newTable.getWidth()) / 2,        (layeredPane.getHeight() - newTable.getHeight()) / 2,        newTable.getWidth(), newTable.getHeight());                layeredPane.add(newTable, JLayeredPane.DEFAULT_LAYER, tables.size());        newTable.toFront();    }        protected ErdDependanciesPanel getDependenciesPanel() {        return dependsPanel;    }        protected void updateTableRelationships() {        dependsPanel.setTableDependencies(buildTableRelationships());        layeredPane.repaint();    }        protected ErdTable[] getSelectedTablesArray() {        Vector selected = new Vector();        int size = tables.size();                ErdTable erdTable = null;                for (int i = 0; i < size; i++) {            erdTable = (ErdTable)tables.elementAt(i);            if (erdTable.isSelected()) {                selected.add(erdTable);            }        }                size = selected.size();        ErdTable[] selectedTables = new ErdTable[size];                for (int i = 0; i < size; i++) {            selectedTables[i] = (ErdTable)selected.elementAt(i);        }                return selectedTables;    }        protected void removeSelectedTables() {        boolean tablesRemoved = false;        ErdTable[] allTables = getAllComponentsArray();                for (int i = 0; i < allTables.length; i++) {                        if (allTables[i].isSelected()) {                allTables[i].clean();                layeredPane.remove(allTables[i]);                tables.remove(allTables[i]);                allTables[i] = null;                tablesRemoved = true;            }                    }                if (tablesRemoved)            dependsPanel.setTableDependencies(buildTableRelationships());                if (erdTitlePanel != null) {                        if (erdTitlePanel.isSelected()) {                layeredPane.remove(erdTitlePanel);                erdTitlePanel = null;            }                    }        layeredPane.repaint();    }    public void setColumnNameFont(Font font) {        columnNameFont = font;    }    public Font getColumnNameFont() {        return columnNameFont;    }    public void setTableNameFont(Font font) {        tableNameFont = font;    }    public Font getTableNameFont() {        return tableNameFont;    }    public int getColumnNameFontStyle() {        return columnNameFontStyle;    }        public int getTableNameFontStyle() {        return tableNameFontStyle;    }        public int getTableFontSize() {        return tableFontSize;    }        public String getTableFontName() {        return tableFontName;    }        public void setTableFontSize(int tableFontSize) {        this.tableFontSize = tableFontSize;    }        public void setTableFontName(String tableFontName) {        this.tableFontName = tableFontName;    }        public JLayeredPane getCanvas() {        return layeredPane;    }        public void resizeCanvas() {        scroll.resizeCanvas();    }        public Vector getAllComponentsVector() {        return tables;    }        public Vector getTableColumnsVector(String tableName) {                if (tables == null)            tables = new Vector();                int v_size = tables.size();        ErdTable erdTable = null;        Vector columns = null;        Vector _columns = null;                for (int i = 0; i < v_size; i++) {            erdTable = (ErdTable)tables.elementAt(i);                        if (erdTable.getTableName().equalsIgnoreCase(tableName)) {                _columns = erdTable.getTableColumnsVector();                                int size = _columns.size();                columns = new Vector(size);                                for (int j = 0; j < size; j++) {                    columns.add(_columns.elementAt(j).toString());                }                                break;            }                    }                return columns;    }        public ErdTable[] getAllComponentsArray() {                if (tables == null)            tables = new Vector();                int v_size = tables.size();        ErdTable[] tablesArray = new ErdTable[v_size];                for (int i = 0; i < v_size; i++) {            tablesArray[i] = (ErdTable)tables.elementAt(i);        }                return tablesArray;    }        protected Dimension getMaxImageExtents() {        int width = 0;        int height = 0;        int tableExtentX = 0;        int tableExtentY = 0;        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -