Ejemplo n.º 1
5
  public SoundFontViewer() {
    this.setLayout(new BorderLayout());
    JSplitPane split = new JSplitPane();
    this.add(split, BorderLayout.CENTER);

    FileTree fTree = new FileTree();

    fTree.setMinimumSize(new Dimension(0, 0));

    String[] filters = {".sf2"};

    fTree.setFilters(filters);

    fTree.addFileTreeListener(this::getSoundFontInfo);

    fTree.addFileTreePopup(new SFFileTreePopup());

    JTabbedPane tabs = new JTabbedPane();

    JScrollPane scrollInstrument = new JScrollPane();
    scrollInstrument.setBorder(null);
    scrollInstrument.setViewportView(instrumentInfo);

    JScrollPane scrollPreset = new JScrollPane();
    scrollPreset.setBorder(null);
    scrollPreset.setViewportView(presetInfo);

    tabs.add("Instruments", scrollInstrument);
    tabs.add("Presets", scrollPreset);

    split.add(fTree, JSplitPane.LEFT);
    split.add(tabs, JSplitPane.RIGHT);

    split.setDividerLocation(200);
  }
Ejemplo n.º 2
0
  public SHCEEMain() {
    super();
    mySHCEEMain = this;

    initializeMainFrame();

    valueEditor = new ValueEditorPanel();
    deviceSelector = new DeviceSelectorPanel();

    jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    jSplitPane.add(deviceSelector);
    jSplitPane.add(valueEditor);

    add(jSplitPane);

    ComponentListener resizeListener =
        new ComponentAdapter() {
          public void componentResized(ComponentEvent e) {
            onResize();
          }
        };

    addComponentListener(resizeListener);

    jSplitPane.setDividerLocation(defaultWidth * 45 / 100);
  }
Ejemplo n.º 3
0
  private void initComponents() {
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);

    splitter.add(list);
    splitter.add(editPanel);

    this.setLayout(new BorderLayout());
    this.add(splitter, BorderLayout.CENTER);

    pack();
  }
Ejemplo n.º 4
0
  /**
   * Descripción de Método
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    this.setLayout(mainLayout);
    this.add(splitPane, BorderLayout.CENTER);
    splitPane.setOpaque(false);
    graphPanel.setLayout(graphLayout);

    //

    splitPane.add(graphPanel, JSplitPane.LEFT);
    splitPane.add(cardPanel, JSplitPane.RIGHT);
    splitPane.setBorder(null);
    splitPane.setName("gc_splitPane");

    //

    cardPanel.setLayout(cardLayout);
    cardPanel.add(srPane, "srPane"); // Sequence Important!
    cardPanel.add(mrPane, "mrPane");
    cardPanel.setBorder(null);
    cardPanel.setName("gc_cardPanel");

    // single row (w/o xPane it would be centered)

    srPane.setBorder(null);
    srPane.setName("gc_srPane");
    srPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    srPane.add(vPane, JSplitPane.TOP);
    srPane.setTopComponent(vPane);
    vPane.getViewport().add(xPanel, null);
    xPanel.add(vPanel);
    vPane.setBorder(null);
    xPanel.setLayout(xLayout);
    xPanel.setName("gc_xPanel");
    xLayout.setAlignment(FlowLayout.LEFT);
    xLayout.setHgap(0);
    xLayout.setVgap(0);

    // multi-row

    mrPane.setBorder(null);
    mrPane.getViewport().add(vTable, null);
    mrPane.setName("gc_mrPane");

    //

    graphPanel.setBorder(null);
    graphPanel.setName("gc_graphPanel");
    srPane.setDividerLocation(200);
  } // jbInit
Ejemplo n.º 5
0
 // Makes sure the log is visible.
 private static void displayLog() {
   if (!consoleDisplayed) {
     splitter.add(outputScroll);
     splitter.setDividerLocation(defaultSliderPosition);
     consoleDisplayed = true;
   }
 }
Ejemplo n.º 6
0
  /**
   * Descripción de Método
   *
   * @param gc
   * @return
   */
  public boolean includeTab(GridController gc) {
    MTab imcludedMTab = gc.getMTab();

    if (m_mTab.getIncluded_Tab_ID() != imcludedMTab.getAD_Tab_ID()) {
      return false;
    }

    //

    vIncludedGC = gc;
    vIncludedGC.switchMultiRow();
    vIncludedGC.setRowSelectionAllowed(false);
    //

    Dimension size = getPreferredSize();

    srPane.setResizeWeight(.75); // top part gets 75%
    srPane.add(vIncludedGC, JSplitPane.BOTTOM);
    srPane.setBottomComponent(vIncludedGC);
    srPane.setDividerSize(5);

    //

    int height = 150;

    vIncludedGC.setPreferredSize(new Dimension(600, height));
    setPreferredSize(new Dimension(size.width, size.height + height));
    srPane.setDividerLocation(size.height);

    //

    imcludedMTab.setIncluded(true);
    imcludedMTab.query(false, 0);

    //

    JRootPane rt = SwingUtilities.getRootPane(this);

    if (rt == null) {
      System.out.println("Root pane null");
    } else {
      // System.out.println( "Root=" + rt );
      rt.addMouseListener(vIncludedGC);

      Component gp = rt.getGlassPane();

      if (gp == null) {
        System.out.println("No Glass Pane");
      } else {
        // System.out.println( "Glass=" + gp );
        gp.addMouseListener(vIncludedGC);
      }
    }

    vIncludedGC.addMouseListener(vIncludedGC);
    vIncludedGC.enableEvents(AWTEvent.HIERARCHY_EVENT_MASK + AWTEvent.MOUSE_EVENT_MASK);

    return true;
  } // IncludeTab
Ejemplo n.º 7
0
 // Makes sure the log is visible.
 private static void displayLog() {
   println("Displayed", warning);
   if (!consoleDisplayed) {
     splitter.add(outputScroll);
     splitter.setDividerLocation(.8);
     consoleDisplayed = true;
   }
 }
Ejemplo n.º 8
0
  private void addComponents() {
    worldPanel = new WorldPanel(this);
    entityList = new EntityListPane(this);
    layerList = new LayerListPane(this);

    JSplitPane entityWorldLayer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    JSplitPane worldLayer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    worldLayer.add(worldPanel);
    worldLayer.add(layerList);
    worldLayer.setResizeWeight(1.0);
    entityWorldLayer.add(entityList);
    entityWorldLayer.add(worldLayer);
    add(entityWorldLayer, BorderLayout.CENTER);

    bar = new MyMenuBar(this);
    add(bar, BorderLayout.NORTH);
  }
Ejemplo n.º 9
0
    public void actionPerformed(ActionEvent a) {
      String command = a.getActionCommand();
      if (command.equals("e")) {
        // Log toggle.
        if (consoleDisplayed = !consoleDisplayed) {
          splitter.add(outputScroll);
          splitter.setDividerLocation(.8);
        } else {
          splitter.remove(outputScroll);
        }
      } else if (command.equals("k")) {
        if (text.getText().contains("class")) {
          // This means we should try to compile this as normal.

          // Pulls out class name
          String code = text.getText();
          int firstPos = code.indexOf("class");
          int secondPos = code.indexOf("{");
          String name = code.substring(firstPos + "class".length() + 1, secondPos).trim();

          compileAndRun(name, text.getText());
        } else {
          // This means we should compile this as a playground.
          String code = text.getText();

          // Common import statements built-in
          String importDump = new String();
          importDump +=
              ("import java.util.*;\n"
                  + "import javax.swing.*;\n"
                  + "import javax.swing.event.*;\n"
                  + "import java.awt.*;\n"
                  + "import java.awt.event.*;\n"
                  + "import java.io.*;\n");

          // Pulls out any "import" statements and appends them to the import dump.
          int i = code.indexOf("import");
          while (i >= 0) {
            String s = code.substring(i, code.indexOf(";", i) + 1);
            code = code.replaceFirst(s, "");
            importDump += s + "\n";
            i = code.indexOf("import", i + 1);
          }

          // Inject the class header and main method
          code =
              "//User and auto-imports pre-defined\n"
                  + importDump
                  + "//Autogenerated class\npublic class Main {\npublic static void main(String[] args) {\n"
                  + code
                  + "\n}\n}";

          compileAndRun("Main", code);
        }
      }
    }
Ejemplo n.º 10
0
  public LogPanel(ToolState toolState, StatusView statusView) {
    this.statusView = statusView;
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    logRecordTable = new LogRecordTable(toolState, statusView);
    logRecordPanel = new LogRecordPanel();
    splitPane.add(logRecordTable.getScrollPane());
    splitPane.add(logRecordPanel);
    setPreferredSize(new Dimension(1000, 800));
    splitPane.setDividerLocation(400);

    setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    add(splitPane, gbc);

    logRecordTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent e) {
                if (e.getValueIsAdjusting()) {
                  return;
                }

                ListSelectionModel lsm = (ListSelectionModel) e.getSource();

                if (lsm.isSelectionEmpty()) {
                  logRecordPanel.reset();
                }

                int selectionIndex = lsm.getAnchorSelectionIndex();
                LogRecord lr = logRecordTable.getLogRecordAt(selectionIndex);
                logRecordPanel.setLogRecord(lr);
              }
            });
  }
Ejemplo n.º 11
0
  public Browser(CavityNestingDB cndb) throws SQLException {
    super(new BorderLayout());
    setPreferredSize(new Dimension(300, 500));
    db = cndb;
    displayer = new NodeDisplay();

    top = new DefaultMutableTreeNode("CavityNestingDB");
    tree = new JTree(top);
    DefaultTreeSelectionModel selModel = new DefaultTreeSelectionModel();
    selModel.setSelectionMode(DefaultTreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setSelectionModel(selModel);

    tree.addTreeSelectionListener(
        new TreeSelectionListener() {
          public void valueChanged(TreeSelectionEvent e) {
            if (e.isAddedPath()) {
              TreePath path = e.getPath();
              DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
              Object value = node.getUserObject();

              // System.out.println(String.valueOf(value));
              if (value instanceof CavityDBObject) {
                displayer.display((CavityDBObject) value);
              } else {
                // System.out.println(value.getClass().getSimpleName());
              }
            }
          }
        });

    JSplitPane splitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    add(splitter, BorderLayout.CENTER);
    splitter.add(new JScrollPane(tree));
    splitter.add(displayer);

    populate();
  }
  /** method to build the menu */
  public void init() {
    /** Set the basic of the "launcher" window */
    this.setTitle("Age Of AntHill");
    this.setSize(300, 450);
    this.setResizable(false);
    this.setLocationRelativeTo(null);
    /** Set the 3 different Panel to set the 3 JButtons */
    JPanel pan1 = new JPanel();
    JPanel pan2 = new JPanel();
    JPanel pan3 = new JPanel();
    /** Add JButtons to JPanel */
    pan1.add(buttonNewGame);
    pan2.add(buttonLoadGame);
    pan3.add(buttonClose);
    /** split the different buttons */
    split1.add(pan1);
    split1.add(pan2);
    split2.add(pan3);
    split2.add(split1);

    split1.setDividerLocation(150);
    split1.setDividerSize(0);
    split1.setEnabled(true);

    split2.setDividerLocation(300);
    split2.setDividerSize(0);
    split2.setEnabled(true);

    this.setContentPane(split2);

    /** add the 3 Action Listener to the JButtons */
    buttonNewGame.addActionListener(this);
    buttonLoadGame.addActionListener(this);
    buttonClose.addActionListener(this);

    this.setVisible(true);
  }
Ejemplo n.º 13
0
  /** Create a new control center window. */
  public ControlCenterWindow(ControlCenter main) {
    this.controlcenter = main;
    this.consoleheights = new HashMap();

    getContentPane().setLayout(new BorderLayout());
    clayout = new CardLayout();
    content = new JPanel(clayout);

    this.console = new ConsolePanel();
    console.setConsoleEnabled(false);
    this.sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    sp.setOneTouchExpandable(true);
    sp.setDividerLocation(200);
    content.setMinimumSize(new Dimension(0, 0));
    console.setMinimumSize(new Dimension(0, 0));
    sp.add(content);
    sp.add(console);
    getContentPane().add("Center", sp);
    sp.setResizeWeight(1.0);

    statusbar = new StatusBar();
    getContentPane().add("South", statusbar);

    this.filechooser = new JFileChooser(".");
    filechooser.setFileFilter(
        new FileFilter() {
          public boolean accept(File f) {
            return f.isDirectory() || f.getName().toLowerCase().endsWith(".jccproject.xml");
          }

          public String getDescription() {
            return "Jadex Project Files";
          }
        });

    // BasicSplitPaneDivider.OneTouchActionHandler

    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            console.close();
            if (controlcenter.exit()) {
              dispose();
              setVisible(false);
            }
          }
        });
  }
Ejemplo n.º 14
0
  public LineEditor() {
    lineTable = getNewLineTable();
    lineCanvas = getNewLineCanvas();

    this.setLayout(new BorderLayout());

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setDividerLocation(200);

    splitPane.add(lineTable, JSplitPane.LEFT);
    splitPane.add(lineCanvas, JSplitPane.RIGHT);

    lineTable.addTableModelListener(lineCanvas);

    lineTable.addSelectionListener(
        new SelectionListener() {

          public void selectionPerformed(SelectionEvent e) {
            lineCanvas.setSelectedLine((Line) e.getSelectedItem());
          }
        });

    this.add(splitPane, BorderLayout.CENTER);
  }
  public ListSelectionDemo() {
    super(new BorderLayout());

    String[] listData = {"one", "two", "three", "four", "five", "six", "seven"};
    String[] columnNames = {"French", "Spanish", "Italian"};
    list = new JList(listData);

    listSelectionModel = list.getSelectionModel();
    listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
    JScrollPane listPane = new JScrollPane(list);

    JPanel controlPane = new JPanel();
    String[] modes = {
      "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION"
    };

    final JComboBox comboBox = new JComboBox(modes);
    comboBox.setSelectedIndex(2);
    comboBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String newMode = (String) comboBox.getSelectedItem();
            if (newMode.equals("SINGLE_SELECTION")) {
              listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) {
              listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
            } else {
              listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
            }
            output.append("----------" + "Mode: " + newMode + "----------" + newline);
          }
        });
    controlPane.add(new JLabel("Selection mode:"));
    controlPane.add(comboBox);

    // Build output area.
    output = new JTextArea(1, 10);
    output.setEditable(false);
    JScrollPane outputPane =
        new JScrollPane(
            output,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    // Do the layout.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    add(splitPane, BorderLayout.CENTER);

    JPanel topHalf = new JPanel();
    topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS));
    JPanel listContainer = new JPanel(new GridLayout(1, 1));
    listContainer.setBorder(BorderFactory.createTitledBorder("List"));
    listContainer.add(listPane);

    topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
    topHalf.add(listContainer);
    // topHalf.add(tableContainer);

    topHalf.setMinimumSize(new Dimension(100, 50));
    topHalf.setPreferredSize(new Dimension(100, 110));
    splitPane.add(topHalf);

    JPanel bottomHalf = new JPanel(new BorderLayout());
    bottomHalf.add(controlPane, BorderLayout.PAGE_START);
    bottomHalf.add(outputPane, BorderLayout.CENTER);
    // XXX: next line needed if bottomHalf is a scroll pane:
    // bottomHalf.setMinimumSize(new Dimension(400, 50));
    bottomHalf.setPreferredSize(new Dimension(450, 135));
    splitPane.add(bottomHalf);
  }
Ejemplo n.º 16
0
  public WSNGui(final Properties properties) {

    Preconditions.checkNotNull(properties);

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

    JTabbedPane tabs = new JTabbedPane();
    Dimension preferredSize = new Dimension(800, 400);

    splitPane.add(tabs);

    {
      ControllerClientView controllerClientView = new ControllerClientView();
      JScrollPane controllerClientScrollPane = new JScrollPane(controllerClientView);
      controllerClientScrollPane.setPreferredSize(preferredSize);
      new ControllerClientController(controllerClientView, properties);

      ControllerServiceView controllerServiceView = new ControllerServiceView();
      JScrollPane controllerServiceScrollPane = new JScrollPane(controllerServiceView);
      controllerClientScrollPane.setPreferredSize(preferredSize);
      new ControllerServiceController(controllerServiceView, properties);

      WSNClientView wsnClientView = new WSNClientView();
      JScrollPane wsnClientScrollPane = new JScrollPane(wsnClientView);
      wsnClientScrollPane.setPreferredSize(preferredSize);
      new WSNClientController(wsnClientView, properties);

      SessionManagementClientView sessionManagementClientView = new SessionManagementClientView();
      JScrollPane sessionManagementScrollPane = new JScrollPane(sessionManagementClientView);
      sessionManagementScrollPane.setPreferredSize(preferredSize);
      new SessionManagementClientController(sessionManagementClientView, wsnClientView, properties);

      RSClientView rsClientView = new RSClientView();
      JScrollPane rsClientScrollPane = new JScrollPane(rsClientView);
      rsClientScrollPane.setPreferredSize(preferredSize);
      new RSClientController(rsClientView, sessionManagementClientView, properties);

      SNAAClientView snaaClientView = new SNAAClientView();
      JScrollPane snaaClientScrollPane = new JScrollPane(snaaClientView);
      snaaClientScrollPane.setPreferredSize(preferredSize);
      new SNAAClientController(snaaClientView, rsClientView, properties);

      WSNServiceView wsnServiceView = new WSNServiceView();
      JScrollPane wsnServiceScrollPane = new JScrollPane(wsnServiceView);
      wsnServiceScrollPane.setPreferredSize(preferredSize);
      new WSNServiceController(wsnServiceView, properties);

      tabs.addTab("SNAA Client", snaaClientScrollPane);
      tabs.addTab("RS Client", rsClientScrollPane);
      tabs.addTab("Controller Client", controllerClientScrollPane);
      tabs.addTab("Controller Service Dummy", controllerServiceScrollPane);
      tabs.addTab("SM Client", sessionManagementScrollPane);
      tabs.addTab("WSN Client", wsnClientScrollPane);
      tabs.addTab("WSN Service Dummy", wsnServiceScrollPane);
    }

    outputTextPane = new JTextArea();
    outputTextPane.setEditable(false);
    outputTextPane.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(final MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
              outputTextPane.setText("");
            }
          }
        });

    JScrollPane outputScrollPane = new JScrollPane(outputTextPane);
    outputScrollPane.setPreferredSize(preferredSize);
    outputScrollPane.setAutoscrolls(true);

    splitPane.add(outputScrollPane);

    TextAreaAppender.setTextArea(outputTextPane);

    frame = new JFrame("WISEBED Web Service API Testing Tool");
    frame.setContentPane(splitPane);
    frame.pack();
  }
Ejemplo n.º 17
0
  private void jbInit() throws Exception {
    border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    border2 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    border3 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178));
    titledBorder1 = new TitledBorder(border3, "Subject");
    border4 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178));
    titledBorder2 = new TitledBorder(border4, "Message");
    border5 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178));
    titledBorder3 = new TitledBorder(border5, "Subject");
    border6 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    titledBorder4 = new TitledBorder(border6, "Message");
    border7 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    titledBorder5 = new TitledBorder(border7, "Messages");
    border8 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    titledBorder6 = new TitledBorder(border8, "Online Users");
    border9 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178));
    titledBorder7 = new TitledBorder(border9, "Send Message");
    this.getContentPane().setLayout(borderLayout1);
    jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
    jSplitPane1.setBorder(border1);
    jSplitPane1.setLastDividerLocation(250);
    jSplitPane1.setResizeWeight(1.0);
    jLabelServer.setRequestFocusEnabled(true);
    jLabelServer.setText("Server");
    jLabelUserId.setText("User Id");
    jTextFieldServer.setPreferredSize(new Dimension(75, 20));
    jTextFieldServer.setText("");
    jTextFieldUser.setPreferredSize(new Dimension(75, 20));
    jTextFieldUser.setText("");
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setJMenuBar(jMenuBarMain);
    this.setTitle("Message Client");
    jLabeltargetUser.setText("Target");
    jTextFieldTargetUser.setPreferredSize(new Dimension(75, 20));
    jTextFieldTargetUser.setText("");
    jPanelSendMessages.setBorder(border2);
    jPanelSendMessages.setMaximumSize(new Dimension(32767, 32767));
    jPanelSendMessages.setOpaque(false);
    jPanelSendMessages.setPreferredSize(new Dimension(96, 107));
    jPanelSendMessages.setRequestFocusEnabled(true);
    jPanelSendMessages.setToolTipText("");
    jPanelSendMessages.setLayout(verticalFlowLayout1);
    jTextFieldSendSubject.setBorder(titledBorder3);
    jTextFieldSendSubject.setText("");
    jTextFieldSendSubject.addKeyListener(new Client_jTextFieldSendSubject_keyAdapter(this));
    jSplitPane2.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    jScrollPane1.setBorder(titledBorder5);
    jScrollPane2.setBorder(titledBorder6);
    jToggleButtonRegister.setText("Register");
    jToggleButtonRegister.addActionListener(new Client_jToggleButtonRegister_actionAdapter(this));
    jButtonMultiConnect.setText("Multi-Connect");
    jButtonMultiConnect.addActionListener(new Client_jButtonMultiConnect_actionAdapter(this));
    jListOnlineUsers.addMouseListener(new Client_jListOnlineUsers_mouseAdapter(this));
    jToggleButtonConnect.setText("Connect");
    jToggleButtonConnect.addActionListener(new Client_jToggleButtonConnect_actionAdapter(this));
    jTextPaneDisplayMessages.setEditable(false);
    jTextPaneDisplayMessages.addMouseListener(
        new Client_jTextPaneDisplayMessages_mouseAdapter(this));
    jTextFieldSendMessages.setBorder(titledBorder7);
    jTextFieldSendMessages.setToolTipText("");
    jTextFieldSendMessages.addKeyListener(new Client_jTextFieldSendMessages_keyAdapter(this));
    jButtonMessageStresser.setText("Msg Stresser");
    jButtonMessageStresser.addActionListener(
        new Client_jToggleButtonMessageStresser_actionAdapter(this));
    jMenuItemClearMessages.setText("Clear Messages");
    jMenuItemClearMessages.addActionListener(new Client_jMenuItemClearMessages_actionAdapter(this));
    jMenuServer.setText("Server");
    jMenuItemServerConnect.setText("Connect");
    jMenuItemServerConnect.addActionListener(new Client_jMenuItemServerConnect_actionAdapter(this));
    jMenuItemServerDisconnect.setText("Disconnect");
    jMenuItemServerDisconnect.addActionListener(
        new Client_jMenuItemServerDisconnect_actionAdapter(this));
    jMenuOptions.setText("Options");
    jMenuTest.setText("Test");
    jMenuItemOptionsRegister.setText("Register");
    jMenuItemOptionsRegister.addActionListener(
        new Client_jMenuItemOptionsRegister_actionAdapter(this));
    jMenuItemOptionsDeregister.setText("Deregister");
    jMenuItemOptionsDeregister.addActionListener(
        new Client_jMenuItemOptionsDeregister_actionAdapter(this));
    jMenuItemOptionsEavesdrop.setText("Eavesdrop");
    jMenuItemOptionsEavesdrop.addActionListener(
        new Client_jMenuItemOptionsEavesdrop_actionAdapter(this));
    jMenuItemOptionsUneavesdrop.setText("Uneavesdrop");
    jMenuItemOptionsUneavesdrop.addActionListener(
        new Client_jMenuItemOptionsUneavesdrop_actionAdapter(this));
    jMenuItemTestMulticonnect.setText("Multiconnect");
    jMenuItemTestMulticonnect.addActionListener(
        new Client_jMenuItemTestMulticonnect_actionAdapter(this));
    jMenuItemTestMessageStresser.setText("Message Stresser");
    jMenuItemTestMessageStresser.addActionListener(
        new Client_jMenuItemTestMessageStresser_actionAdapter(this));
    jMenuItemTestMultidisconnect.setText("Multidisconnect");
    jMenuItemTestMultidisconnect.addActionListener(
        new Client_jMenuItemTestMultidisconnect_actionAdapter(this));
    jMenuItemOptionsGlobalEavesdrop.setText("Global Eavesdrop");
    jMenuItemOptionsGlobalEavesdrop.addActionListener(
        new Client_jMenuItemOptionsGlobalEavesdrop_actionAdapter(this));
    jMenuItemOptionsGlobalUneavesdrop.setEnabled(false);
    jMenuItemOptionsGlobalUneavesdrop.setText("Global Uneavesdrop");
    jMenuItemOptionsGlobalUneavesdrop.addActionListener(
        new Client_jMenuItemOptionsGlobalUneavesdrop_actionAdapter(this));
    jLabelPwd.setText("Pwd");
    jPasswordFieldPwd.setMinimumSize(new Dimension(11, 20));
    jPasswordFieldPwd.setPreferredSize(new Dimension(75, 20));
    jPasswordFieldPwd.setText("");
    jMenuItemScheduleCommand.setText("Schedule Command");
    jMenuItemScheduleCommand.addActionListener(
        new Client_jMenuItemScheduleCommand_actionAdapter(this));
    jMenuItemEditScheduledCommands.setText("Edit Scheduled Commands");
    jMenuItemEditScheduledCommands.addActionListener(
        new Client_jMenuItemEditScheduledCommands_actionAdapter(this));
    jPanelSendMessages.add(jTextFieldSendSubject, null);
    jPanelSendMessages.add(jTextFieldSendMessages, null);
    jSplitPane1.add(jSplitPane2, JSplitPane.TOP);
    jSplitPane2.add(jScrollPane1, JSplitPane.TOP);
    jScrollPane1.getViewport().add(jTextPaneDisplayMessages, null);
    jSplitPane2.add(jScrollPane2, JSplitPane.BOTTOM);
    jScrollPane2.getViewport().add(jListOnlineUsers, null);
    this.getContentPane().add(jSplitPane1, BorderLayout.CENTER);
    jSplitPane1.add(jPanelSendMessages, JSplitPane.BOTTOM);
    this.getContentPane().add(jPanel1, BorderLayout.NORTH);
    jPanel1.add(jLabelServer, null);
    jPanel1.add(jTextFieldServer, null);
    jPanel1.add(jLabelUserId, null);
    jPanel1.add(jTextFieldUser, null);
    jPanel1.add(jLabelPwd, null);
    jPanel1.add(jPasswordFieldPwd, null);
    jPanel1.add(jLabeltargetUser, null);
    jPanel1.add(jTextFieldTargetUser, null);
    jPanel1.add(jToggleButtonConnect, null);
    jPanel1.add(jToggleButtonRegister, null);
    jPanel1.add(jButtonMultiConnect, null);
    jPanel1.add(jButtonMessageStresser, null);
    jPopupMenuMessageArea.add(jMenuItemClearMessages);
    jMenuBarMain.add(jMenuServer);
    jMenuBarMain.add(jMenuOptions);
    jMenuBarMain.add(jMenuTest);
    jMenuServer.add(jMenuItemServerConnect);
    jMenuServer.add(jMenuItemServerDisconnect);
    jMenuOptions.add(jMenuItemOptionsRegister);
    jMenuOptions.add(jMenuItemOptionsDeregister);
    jMenuOptions.add(jMenuItemOptionsEavesdrop);
    jMenuOptions.add(jMenuItemOptionsUneavesdrop);
    jMenuOptions.add(jMenuItemOptionsGlobalEavesdrop);
    jMenuOptions.add(jMenuItemOptionsGlobalUneavesdrop);
    jMenuTest.add(jMenuItemTestMulticonnect);
    jMenuTest.add(jMenuItemTestMultidisconnect);
    jMenuTest.add(jMenuItemTestMessageStresser);
    jMenuTest.add(jMenuItemScheduleCommand);
    jMenuTest.add(jMenuItemEditScheduledCommands);
    jSplitPane1.setDividerLocation(200);
    jSplitPane2.setDividerLocation(600);
    jListOnlineUsers.setCellRenderer(new OnlineListCellRenderer());
    jListOnlineUsers.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    jMenuItemTestMulticonnect.setEnabled(true);
    jMenuItemTestMultidisconnect.setEnabled(false);
    jMenuItemServerConnect.setEnabled(true);
    jMenuItemServerDisconnect.setEnabled(false);
    jMenuItemOptionsRegister.setEnabled(true);
    jMenuItemOptionsDeregister.setEnabled(false);
  }
Ejemplo n.º 18
0
 /**
  * constructor
  *
  * @param controller is the parent object
  * @throws Exception
  */
 public PseudoHYDC3View(PseudoHYDC3 controller) throws Exception {
   this.controller = controller;
   {
     String sFontName = "DFKai-SB2" /*"PMingLiU"*/;
     if (System.getProperty("hydc3.fontName") != null) {
       sFontName = System.getProperty("hydc3.fontName");
     }
     UIManager.put(
         "TextPane.font",
         new Font(
             sFontName,
             UIManager.getFont("TextPane.font").getStyle(),
             UIManager.getFont("TextPane.font").getSize()));
     UIManager.put(
         "List.font",
         new Font(
             sFontName,
             UIManager.getFont("List.font").getStyle(),
             UIManager.getFont("List.font").getSize()));
     UIManager.put(
         "TextField.font",
         new Font(
             sFontName,
             UIManager.getFont("TextField.font").getStyle(),
             UIManager.getFont("TextField.font").getSize()));
   }
   frame = new JFrame("漢語大詞典もどき");
   frame.setPreferredSize(new Dimension(800, 600));
   {
     JMenuBar menuBar = new JMenuBar();
     {
       JMenu menu = new JMenu("File");
       {
         JMenuItem menuItem = new JMenuItem("Exit");
         menuItem.addActionListener(
             new ActionListener() {
               @Override
               public void actionPerformed(ActionEvent event) {
                 System.exit(0);
               }
             });
         menu.add(menuItem);
       }
       menuBar.add(menu);
     }
     {
       JMenu menu = new JMenu("Help");
       {
         JMenuItem menuItem = new JMenuItem("About...");
         menuItem.addActionListener(
             new ActionListener() {
               @Override
               public void actionPerformed(ActionEvent event) {
                 JOptionPane.showMessageDialog(
                     frame,
                     "漢語大詞典もどき  version 0.1  by Beu",
                     "about",
                     JOptionPane.INFORMATION_MESSAGE);
               }
             });
         menu.add(menuItem);
       }
       menuBar.add(menu);
     }
     frame.setJMenuBar(menuBar);
     JPanel rootPanel = new JPanel(new BorderLayout());
     {
       JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
       {
         JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
         {
           JTabbedPane tabbedPane = new JTabbedPane();
           {
             JPanel panel = new JPanel();
             BoxLayout layout = new BoxLayout(panel, BoxLayout.Y_AXIS);
             panel.setLayout(layout);
             {
               JPanel panel2 = new JPanel();
               {
                 inputTextField = new JTextField(8);
                 Font font = inputTextField.getFont();
                 font = font.deriveFont(font.getSize2D() * 3);
                 inputTextField.setFont(font);
                 panel2.add(inputTextField);
               }
               panel.add(panel2);
             }
             {
               JPanel panel2 = new JPanel();
               {
                 JButton button = new JButton("字");
                 button.setActionCommand("searchWithCharacter");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               {
                 JButton button = new JButton("詞");
                 button.setActionCommand("searchWithWord");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               {
                 JButton button = new JButton("音");
                 button.setActionCommand("searchWithReading");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               {
                 JButton button = new JButton("碼");
                 button.setActionCommand("searchWithCode");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               panel.add(panel2);
             }
             tabbedPane.addTab("輸入", panel);
           }
           {
             DefaultMutableTreeNode root = controller.getRadicalTree();
             JTree tree = new JTree(root);
             Font font = tree.getFont();
             font = font.deriveFont(font.getSize2D() * 1.5F);
             tree.setFont(font);
             tree.addTreeSelectionListener(controller);
             JScrollPane scrollPane =
                 new JScrollPane(
                     tree,
                     JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
             tabbedPane.addTab("部首", scrollPane);
           }
           {
             JPanel panel = new JPanel();
             BoxLayout layout = new BoxLayout(panel, BoxLayout.Y_AXIS);
             panel.setLayout(layout);
             {
               JPanel panel2 = new JPanel();
               panel2.add(new JLabel("從"));
               {
                 fromStrokesTextField = new JTextField("1", 2);
                 Font font = fromStrokesTextField.getFont();
                 font = font.deriveFont(font.getSize2D() * 2);
                 fromStrokesTextField.setFont(font);
                 fromStrokesTextField.setHorizontalAlignment(JTextField.RIGHT);
                 panel2.add(fromStrokesTextField);
               }
               panel2.add(new JLabel("到"));
               {
                 toStrokesTextField = new JTextField("10", 2);
                 Font font = toStrokesTextField.getFont();
                 font = font.deriveFont(font.getSize2D() * 2);
                 toStrokesTextField.setFont(font);
                 toStrokesTextField.setHorizontalAlignment(JTextField.RIGHT);
                 panel2.add(toStrokesTextField);
               }
               panel.add(panel2);
             }
             {
               JPanel panel2 = new JPanel();
               {
                 JButton button = new JButton("査");
                 button.setActionCommand("searchWithStrokes");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               panel.add(panel2);
             }
             tabbedPane.addTab("畫數", panel);
           }
           splitPane2.add(tabbedPane, JSplitPane.TOP);
         }
         {
           selectingList = new JList();
           Font font = selectingList.getFont();
           font = font.deriveFont(font.getSize2D() * 2);
           selectingList.setFont(font);
           selectingList.addMouseListener(controller);
           JScrollPane scrollPane =
               new JScrollPane(
                   selectingList,
                   JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                   JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
           scrollPane.setBorder(new TitledBorder("候補"));
           splitPane2.add(scrollPane, JSplitPane.BOTTOM);
         }
         splitPane.add(splitPane2, JSplitPane.LEFT);
       }
       {
         descriptionTextPane = new JTextPane();
         Font font = descriptionTextPane.getFont();
         font = font.deriveFont(font.getSize2D() * 1.5F);
         descriptionTextPane.setFont(font);
         descriptionTextPane.addMouseListener(controller);
         descriptionTextPane.addMouseMotionListener(controller);
         JScrollPane scrollPane =
             new JScrollPane(
                 descriptionTextPane,
                 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                 JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
         splitPane.add(scrollPane, JSplitPane.RIGHT);
       }
       rootPanel.add(splitPane, BorderLayout.CENTER);
     }
     {
       JPanel panel = new JPanel(new BorderLayout());
       {
         JLabel label = new JLabel("status");
         panel.add(label, BorderLayout.WEST);
       }
       rootPanel.add(panel, BorderLayout.SOUTH);
     }
     frame.setContentPane(rootPanel);
   }
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.pack();
   frame.setVisible(true);
 }
  private void jbInit() throws Exception {
    itemsGrid.setMaxNumberOfRowsOnInsert(50);
    impAllItemsButton.setToolTipText(
        ClientSettings.getInstance().getResources().getResource("import all items"));
    impAllItemsButton.addActionListener(
        new SupplierDetailFrame_impAllItemsButton_actionAdapter(this));

    detailPanel.setLayout(gridBagLayout4);
    itemsGrid.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    supplierPanel.setVOClassName("org.jallinone.purchases.suppliers.java.DetailSupplierVO");
    supplierPanel.addLinkedPanel(organizationPanel);
    titledBorder1 = new TitledBorder("");
    titledBorder2 = new TitledBorder("");
    subjectPanel.setLayout(gridBagLayout1);
    supplierPanel.setBorder(titledBorder1);
    supplierPanel.setLayout(gridBagLayout2);
    titledBorder1.setTitle(ClientSettings.getInstance().getResources().getResource("supplier"));
    titledBorder1.setTitleColor(Color.blue);
    labelSupplierCode.setText("supplierCodePUR01");
    labelPay.setText("payment terms");
    labelBank.setText("bank");
    controlSupplierCode.setAttributeName("supplierCodePUR01");
    controlSupplierCode.setCanCopy(false);
    controlSupplierCode.setLinkLabel(labelSupplierCode);
    controlSupplierCode.setMaxCharacters(20);
    //    controlSupplierCode.setRequired(true);
    controlSupplierCode.setTrimText(true);
    controlSupplierCode.setUpperCase(true);
    controlSupplierCode.setEnabledOnEdit(false);
    controlPayment.setAttributeName("paymentCodeReg10PUR01");
    controlPayment.setCanCopy(true);
    controlPayment.setLinkLabel(labelPay);
    controlPayment.setMaxCharacters(20);
    controlPayment.setRequired(true);
    controlPayDescr.setAttributeName("paymentDescriptionSYS10");
    controlPayDescr.setCanCopy(true);
    controlPayDescr.setEnabledOnInsert(false);
    controlPayDescr.setEnabledOnEdit(false);
    controlBank.setAttributeName("bankCodeReg12PUR01");
    controlBank.setCanCopy(true);
    controlBank.setLinkLabel(labelBank);
    controlBank.setMaxCharacters(20);
    controlBankDescr.setAttributeName("descriptionREG12");
    controlBankDescr.setCanCopy(true);
    controlBankDescr.setEnabledOnInsert(false);
    controlBankDescr.setEnabledOnEdit(false);
    refPanel.setLayout(borderLayout1);
    hierarPanel.setLayout(borderLayout4);
    treeGridItemsPanel.setLayout(borderLayout3);
    itemsSplitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    itemsSplitPane.setDividerSize(5);
    itemsPanel.setLayout(borderLayout5);
    itemButtonsPanel.setLayout(flowLayout2);
    flowLayout2.setAlignment(FlowLayout.LEFT);
    itemsGrid.setAutoLoadData(false);
    itemsGrid.setDeleteButton(deleteButton1);
    itemsGrid.setEditButton(editButton1);
    itemsGrid.setExportButton(exportButton1);
    itemsGrid.setFunctionId("PUR01");
    itemsGrid.setMaxSortedColumns(3);
    itemsGrid.setInsertButton(insertButton1);
    itemsGrid.setNavBar(navigatorBar1);
    itemsGrid.setReloadButton(reloadButton1);
    itemsGrid.setSaveButton(saveButton1);
    itemsGrid.setValueObjectClassName("org.jallinone.purchases.items.java.SupplierItemVO");
    insertButton1.setText("insertButton1");
    editButton1.setText("editButton1");
    saveButton1.setText("saveButton1");
    reloadButton1.setText("reloadButton1");
    deleteButton1.setText("deleteButton1");
    itemHierarsPanel.setLayout(gridBagLayout3);
    labelHierar.setText("item hierarchies");
    colItemCode.setColumnFilterable(true);
    colItemCode.setColumnName("itemCodeItm01PUR02");
    colItemCode.setColumnSortable(true);
    colItemCode.setEditableOnInsert(true);
    colItemCode.setHeaderColumnName("itemCodeITM01");
    colItemCode.setPreferredWidth(90);
    colItemCode.setSortVersus(org.openswing.swing.util.java.Consts.ASC_SORTED);
    colItemCode.setMaxCharacters(20);
    colItemDescr.setColumnFilterable(true);
    colItemDescr.setColumnName("descriptionSYS10");
    colItemDescr.setColumnSortable(true);
    colItemDescr.setHeaderColumnName("itemDescriptionSYS10");
    colItemDescr.setPreferredWidth(200);
    colSupplierItemCode.setMaxCharacters(20);
    colSupplierItemCode.setTrimText(true);
    colSupplierItemCode.setUpperCase(true);
    colSupplierItemCode.setColumnFilterable(true);
    colSupplierItemCode.setColumnName("supplierItemCodePUR02");
    colSupplierItemCode.setColumnSortable(true);
    colSupplierItemCode.setEditableOnEdit(true);
    colSupplierItemCode.setEditableOnInsert(true);
    colSupplierItemCode.setHeaderColumnName("supplierItemCodePUR02");
    colSupplierItemCode.setPreferredWidth(120);
    colUmCode.setColumnDuplicable(true);
    colUmCode.setColumnFilterable(true);
    colUmCode.setColumnName("umCodeReg02PUR02");
    colUmCode.setEditableOnEdit(true);
    colUmCode.setEditableOnInsert(true);
    colUmCode.setHeaderColumnName("umCodeReg02PUR02");
    colUmCode.setMaxCharacters(20);
    colMinQty.setDecimals(2);
    colMinQty.setGrouping(false);
    colMinQty.setColumnDuplicable(true);
    colMinQty.setColumnFilterable(true);
    colMinQty.setColumnSortable(true);
    colMinQty.setEditableOnEdit(true);
    colMinQty.setEditableOnInsert(true);
    colMinQty.setPreferredWidth(80);
    colMinQty.setColumnName("minPurchaseQtyPUR02");
    colMultipleQty.setGrouping(false);
    colMultipleQty.setColumnDuplicable(true);
    colMultipleQty.setColumnFilterable(true);
    colMultipleQty.setColumnSortable(true);
    colMultipleQty.setEditableOnEdit(true);
    colMultipleQty.setEditableOnInsert(true);
    colMultipleQty.setPreferredWidth(80);
    colMultipleQty.setColumnName("multipleQtyPUR02");
    subjectPanel.add(
        organizationPanel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    this.setTitle(ClientSettings.getInstance().getResources().getResource("supplier detail"));
    buttonsPanel.setLayout(flowLayout1);
    flowLayout1.setAlignment(FlowLayout.LEFT);
    insertButton.setText("insertButton1");
    editButton.setText("editButton1");
    saveButton.setEnabled(false);
    saveButton.setText("saveButton1");
    reloadButton.setText("reloadButton1");
    deleteButton.setText("deleteButton1");

    labelCompanyCode.setText("companyCodeSys01REG04");
    controlCompanyCode.setAttributeName("companyCodeSys01REG04");
    controlCompanyCode.setLinkLabel(labelCompanyCode);
    controlCompanyCode.setRequired(true);
    controlCompanyCode.setEnabledOnEdit(false);

    this.getContentPane().add(buttonsPanel, BorderLayout.NORTH);
    buttonsPanel.add(insertButton, null);
    buttonsPanel.add(editButton, null);
    buttonsPanel.add(saveButton, null);
    buttonsPanel.add(reloadButton, null);
    buttonsPanel.add(deleteButton, null);
    buttonsPanel.add(navigatorBar, null);
    //    tabbedPane.add(subjectPanel,   "generic data");
    this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
    supplierPanel.add(
        labelCompanyCode,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    supplierPanel.add(
        controlCompanyCode,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));

    //    tabbedPane.add(supplierPanel,    "supplierPanel");
    supplierPanel.add(
        labelSupplierCode,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 5, 5, 5),
            0,
            0));
    supplierPanel.add(
        controlSupplierCode,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));
    supplierPanel.add(
        labelPay,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    supplierPanel.add(
        controlPayment,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            40,
            0));
    supplierPanel.add(
        controlPayDescr,
        new GridBagConstraints(
            2,
            2,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));
    supplierPanel.add(
        labelPricelist,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    supplierPanel.add(
        labelBank,
        new GridBagConstraints(
            0,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 5),
            0,
            0));
    supplierPanel.add(
        controlBank,
        new GridBagConstraints(
            1,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            40,
            0));
    supplierPanel.add(
        controlBankDescr,
        new GridBagConstraints(
            2,
            4,
            2,
            3,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 0, 5),
            0,
            0));

    supplierPanel.add(
        labelDebit,
        new GridBagConstraints(
            0,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));
    supplierPanel.add(
        labelPurchase,
        new GridBagConstraints(
            0,
            6,
            1,
            1,
            0.0,
            1.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 15, 5),
            0,
            0));
    supplierPanel.add(
        controlDebitsCode,
        new GridBagConstraints(
            1,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            40,
            0));
    supplierPanel.add(
        controlDebitsDescr,
        new GridBagConstraints(
            2,
            5,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 0, 5),
            0,
            0));
    supplierPanel.add(
        controlCostsCode,
        new GridBagConstraints(
            1,
            6,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            40,
            0));
    supplierPanel.add(
        controlCostsDescr,
        new GridBagConstraints(
            2,
            6,
            2,
            3,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 0, 5),
            0,
            0));

    labelDebit.setText("debits account");
    labelPurchase.setText("purchase costs account");
    controlDebitsCode.setAttributeName("debitAccountCodeAcc02PUR01");
    controlDebitsDescr.setAttributeName("debitAccountDescrPUR01");
    controlCostsCode.setAttributeName("costsAccountCodeAcc02PUR01");
    controlCostsDescr.setAttributeName("costsAccountDescrPUR01");

    detailPanel.add(
        subjectPanel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.WEST,
            GridBagConstraints.BOTH,
            new Insets(5, 5, 5, 5),
            0,
            0));
    detailPanel.add(
        supplierPanel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));
    tabbedPane.add(detailPanel, "supplier data");

    tabbedPane.add(refPanel, "references");
    refPanel.add(referencesPanel, BorderLayout.CENTER);
    tabbedPane.add(hierarPanel, "hierarchies");
    hierarPanel.add(hierarchiesPanel, BorderLayout.CENTER);
    tabbedPane.add(treeGridItemsPanel, "supplierItems");
    treeGridItemsPanel.add(itemsSplitPane, BorderLayout.CENTER);
    itemsSplitPane.add(treePanel, JSplitPane.LEFT);
    itemsSplitPane.add(itemsPanel, JSplitPane.RIGHT);
    itemsPanel.add(itemButtonsPanel, BorderLayout.NORTH);
    itemsPanel.add(itemsGrid, BorderLayout.CENTER);
    itemsGrid.getColumnContainer().add(colItemCode, null);
    itemButtonsPanel.add(insertButton1, null);
    itemButtonsPanel.add(editButton1, null);
    itemButtonsPanel.add(saveButton1, null);
    itemButtonsPanel.add(reloadButton1, null);
    itemButtonsPanel.add(deleteButton1, null);
    itemButtonsPanel.add(exportButton1, null);
    itemButtonsPanel.add(navigatorBar1, null);
    itemButtonsPanel.add(impAllItemsButton, null);

    controlDebitsCode.setLinkLabel(labelDebit);
    controlDebitsCode.setMaxCharacters(20);
    controlDebitsCode.setRequired(true);
    controlDebitsDescr.setEnabledOnInsert(false);
    controlDebitsDescr.setEnabledOnEdit(false);
    controlCostsCode.setLinkLabel(labelPurchase);
    controlCostsCode.setMaxCharacters(20);
    controlCostsCode.setRequired(true);
    controlCostsDescr.setEnabledOnInsert(false);
    controlCostsDescr.setEnabledOnEdit(false);

    treeGridItemsPanel.add(itemHierarsPanel, BorderLayout.NORTH);
    itemHierarsPanel.add(
        labelHierar,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 0),
            0,
            0));
    itemHierarsPanel.add(
        controlHierarchy,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            100,
            0));
    tabbedPane.add(supplierPricelistPanel, "supplierPricelistPanel");
    itemsGrid.getColumnContainer().add(colItemDescr, null);
    itemsGrid.getColumnContainer().add(colSupplierItemCode, null);
    itemsGrid.getColumnContainer().add(colUmCode, null);
    itemsGrid.getColumnContainer().add(colMinQty, null);
    itemsGrid.getColumnContainer().add(colMultipleQty, null);

    tabbedPane.setTitleAt(
        0, ClientSettings.getInstance().getResources().getResource("supplier data"));
    tabbedPane.setTitleAt(1, ClientSettings.getInstance().getResources().getResource("references"));
    tabbedPane.setTitleAt(
        2, ClientSettings.getInstance().getResources().getResource("hierarchies"));
    tabbedPane.setTitleAt(
        3, ClientSettings.getInstance().getResources().getResource("supplierItems"));
    tabbedPane.setTitleAt(
        4, ClientSettings.getInstance().getResources().getResource("supplierPricelists"));
    itemsSplitPane.setDividerLocation(200);
  }
Ejemplo n.º 20
0
  @SuppressWarnings("unchecked")
  private static JPanel doView(
      Color scolor,
      Color tcolor,
      @SuppressWarnings("unused") String src_n,
      @SuppressWarnings("unused") String dst_n,
      Graph<Quad<Node, Object, String, Boolean>, Pair<Path, Integer>> first,
      Map<Quad<Node, Object, String, Boolean>, Map<Attribute<Node>, Object>> second) {

    // HashMap<Pair<Node, Object>,String> map = new HashMap<>();
    JPanel cards = new JPanel(new CardLayout());

    try {
      Class<?> c = Class.forName(FqlOptions.layout_prefix + GlobalOptions.debug.fql.trans_graph);
      Constructor<?> x = c.getConstructor(Graph.class);
      Layout<Quad<Node, Object, String, Boolean>, Pair<Path, Integer>> layout =
          (Layout<Quad<Node, Object, String, Boolean>, Pair<Path, Integer>>) x.newInstance(first);

      layout.setSize(new Dimension(600, 350));
      VisualizationViewer<Quad<Node, Object, String, Boolean>, Pair<Path, Integer>> vv =
          new VisualizationViewer<>(layout);

      Transformer<Quad<Node, Object, String, Boolean>, Paint> vertexPaint =
          (Quad<Node, Object, String, Boolean> i) -> i.fourth ? scolor : tcolor;

      DefaultModalGraphMouse<String, String> gm = new DefaultModalGraphMouse<>();
      gm.setMode(Mode.TRANSFORMING);
      vv.setGraphMouse(gm);
      gm.setMode(Mode.PICKING);
      // Set up a new stroke Transformer for the edges
      float dash[] = {1.0f};
      Stroke edgeStroke =
          new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 10.0f);
      // Transformer<String, Stroke> edgeStrokeTransformer = new
      // Transformer<String, Stroke>() {
      // public Stroke transform(String s) {
      // return edgeStroke;
      // }
      // };
      vv.getRenderContext().setVertexLabelRenderer(new MyVertexT(cards));
      Stroke bs = new BasicStroke();
      Transformer<Pair<Path, Integer>, Stroke> edgeStrokeTransformer =
          (Pair<Path, Integer> s) -> {
            if (s.first == null) {
              return edgeStroke;
            }
            return bs;
          };
      vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
      vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer);
      // vv.getRenderContext().setVertexLabelTransformer(
      // new ToStringLabeller<String>());
      vv.getRenderContext()
          .setEdgeLabelTransformer(
              new ToStringLabeller<Pair<Path, Integer>>() {

                @Override
                public String transform(Pair<Path, Integer> t) {
                  if (t.first == null) {
                    return "";
                  }
                  return t.first.toString();
                }
              });
      // new ToStringLabeller<String>());
      // vv.getRenderer().getVertexRenderer().
      // vv.getRenderContext().setLabelOffset(20);
      // vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);

      vv.getRenderContext()
          .setVertexLabelTransformer(
              new ToStringLabeller<Quad<Node, Object, String, Boolean>>() {

                @Override
                public String transform(Quad<Node, Object, String, Boolean> t) {
                  return t.third + "." + t.first + "." + t.second;
                }
              });
      // vv.getRenderer().setVertexRenderer(new MyRenderer());

      JPanel ret = new JPanel(new BorderLayout());
      JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

      for (Quad<Node, Object, String, Boolean> n : first.getVertices()) {
        Map<Attribute<Node>, Object> s = second.get(n);

        Object[] columnNames = new Object[s.keySet().size()];
        Object[][] rowData = new Object[1][s.keySet().size()];

        int i = 0;
        // for (Pair<Node, Object> k : map0.keySet()) {
        // Map<Attribute<Node>, Object> v = ma;
        for (Attribute<Node> a : s.keySet()) {
          columnNames[i] = a.name;
          rowData[0][i] = s.get(a);
          i++;
        }

        // }
        JPanel p = new JPanel(new GridLayout(1, 1));
        @SuppressWarnings("serial")
        JTable table =
            new JTable(rowData, columnNames) {
              @Override
              public Dimension getPreferredScrollableViewportSize() {
                Dimension d = getPreferredSize();
                return new Dimension(d.width, d.height);
              }
            };
        JScrollPane jsp = new JScrollPane(table);
        p.setBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEmptyBorder(), "Attributes for " + n.second));

        p.add(jsp);
        cards.add(p, n.second.toString());
      }
      cards.add(new JPanel(), "blank");
      CardLayout cl = (CardLayout) (cards.getLayout());
      cl.show(cards, "blank");

      pane.add(new GraphZoomScrollPane(vv));
      pane.setResizeWeight(1.0d);
      pane.add(cards);

      cards.setPreferredSize(new Dimension(400, 100));

      ret.add(pane, BorderLayout.CENTER);
      // JComponent iii = lowerComp(src_n, dst_n);
      // iii.setPreferredSize(new Dimension(1, 60));
      // ret.add(iii, BorderLayout.NORTH);
      ret.setBorder(BorderFactory.createEtchedBorder());
      return ret;
    } catch (Throwable t) {
      t.printStackTrace();
      throw new RuntimeException();
    }
  }
  private void initializeComponents() {
    // {
    // JMenuBar menuBar = new JMenuBar();
    // setJMenuBar(menuBar);
    // JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    // JMenu fileMenu = new JMenu("File");
    // menuBar.add(fileMenu);
    // }
    splitPane = new JSplitPane();
    splitPane.setUI(
        new BasicSplitPaneUI() {
          public void paint(Graphics g, JComponent jc) {}
        });
    splitPane.setDividerSize(4);
    getContentPane().add(splitPane, BorderLayout.CENTER);
    {
      JSplitPane rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
      rightSplit.setUI(
          new BasicSplitPaneUI() {
            public void paint(Graphics g, JComponent jc) {}
          });
      rightSplit.setDividerSize(4);
      splitPane.add(rightSplit, JSplitPane.RIGHT);

      {
        JPanel propertiesPanel = new JPanel(new GridBagLayout());
        rightSplit.add(propertiesPanel, JSplitPane.TOP);
        propertiesPanel.setBorder(
            new CompoundBorder(
                BorderFactory.createEmptyBorder(3, 0, 6, 6),
                BorderFactory.createTitledBorder("Editor Properties")));
        {
          JScrollPane scroll = new JScrollPane();
          propertiesPanel.add(
              scroll,
              new GridBagConstraints(
                  0,
                  0,
                  1,
                  1,
                  1,
                  1,
                  GridBagConstraints.NORTH,
                  GridBagConstraints.BOTH,
                  new Insets(0, 0, 0, 0),
                  0,
                  0));
          scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
          {
            editRowsPanel = new JPanel(new GridBagLayout());
            scroll.setViewportView(editRowsPanel);
            scroll.getVerticalScrollBar().setUnitIncrement(70);
          }
        }
      }

      {
        JPanel propertiesPanel = new JPanel(new GridBagLayout());
        rightSplit.add(propertiesPanel, JSplitPane.BOTTOM);
        propertiesPanel.setBorder(
            new CompoundBorder(
                BorderFactory.createEmptyBorder(3, 0, 6, 6),
                BorderFactory.createTitledBorder("Emitter Properties")));
        {
          JScrollPane scroll = new JScrollPane();
          propertiesPanel.add(
              scroll,
              new GridBagConstraints(
                  0,
                  0,
                  1,
                  1,
                  1,
                  1,
                  GridBagConstraints.NORTH,
                  GridBagConstraints.BOTH,
                  new Insets(0, 0, 0, 0),
                  0,
                  0));
          scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
          {
            rowsPanel = new JPanel(new GridBagLayout());
            scroll.setViewportView(rowsPanel);
            scroll.getVerticalScrollBar().setUnitIncrement(70);
          }
        }
      }
      rightSplit.setDividerLocation(200);
    }
    {
      JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
      leftSplit.setUI(
          new BasicSplitPaneUI() {
            public void paint(Graphics g, JComponent jc) {}
          });
      leftSplit.setDividerSize(4);
      splitPane.add(leftSplit, JSplitPane.LEFT);
      {
        JPanel spacer = new JPanel(new BorderLayout());
        leftSplit.add(spacer, JSplitPane.TOP);
        spacer.add(lwjglCanvas.getCanvas());
        spacer.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 4));
      }
      {
        JPanel emittersPanel = new JPanel(new BorderLayout());
        leftSplit.add(emittersPanel, JSplitPane.BOTTOM);
        emittersPanel.setBorder(
            new CompoundBorder(
                BorderFactory.createEmptyBorder(0, 6, 6, 0),
                BorderFactory.createTitledBorder("Effect Emitters")));
        {
          effectPanel = new EffectPanel(this);
          emittersPanel.add(effectPanel);
        }
      }
      leftSplit.setDividerLocation(625);
    }
    splitPane.setDividerLocation(325);
  }
Ejemplo n.º 22
0
    public void actionPerformed(ActionEvent a) {
      // Note that this only works on *nix OSes.
      // For windows, get the first character of the action command, cast it to int, and compare
      // that on a case-by-case basis.

      String command = a.getActionCommand();
      if (command.equals("e")) {
        // Log toggle.
        if (consoleDisplayed = !consoleDisplayed) {
          splitter.add(outputScroll);
          splitter.setDividerLocation(defaultSliderPosition);
        } else {
          splitter.remove(outputScroll);
        }
      } else if (command.equals("r")) {
        // Gets the code into a string.
        String code = text.getText();

        // Marks certain areas as "dirty".
        // Dirty areas are places that shouldn't be considered for any keywords,
        // including "import", "extend", and so on.
        ArrayList<Integer> dirtyBounds = getDirty(code);

        if (text.getText().contains("class")) {
          // This means we should try to compile this as normal.

          // Pulls out class name
          int firstPos = code.indexOf("public class");
          int secondPos = code.indexOf("{");
          String name = code.substring(firstPos + "public class".length() + 1, secondPos).trim();

          // Just a safety check to make sure you don't try to modify this program while it's
          // running.
          if (name.equals("Playground")) {
            System.out.println(
                "I know what you're doing and I don't approve. I won't even compile that.");
            return;
          }

          compileAndRun(name, code);
        } else {
          // This means we should compile this as a playground.

          // Common import statements built-in
          String importDump = new String();
          importDump +=
              ( // "import java.util.*;\n" +
              "import javax.swing.*;\n"
                  + "import javax.swing.event.*;\n"
                  + "import java.awt.*;\n"
                  + "import java.awt.event.*;\n"
                  + "import java.io.*;\n");

          // User-defined or auto-generated methods
          String methodDump = new String();

          // dirtyBounds.forEach(System.out::println);

          // Pulls out any "import" statements and appends them to the import dump.
          int i = code.indexOf("import");
          while (i >= 0) {
            // Ignores comments and string literals
            if (isDirty(dirtyBounds, i)) {
              i = code.indexOf("import", i + 1);
              continue;
            }

            String s = code.substring(i, code.indexOf(";", i) + 1);
            // System.out.println("Found import: " + s);
            code = code.replaceFirst(s, "");
            importDump += s + "\n";
            i = code.indexOf("import", i + 1);
          }

          // Pulls out methods- these are defined by the keyword "method" until a closing bracket.
          /*
          i = code.indexOf("method");
          while(i >= 0) {
          //Ignores comments and string literals
          if (isDirty(dirtyBounds, i)) {
          i = code.indexOf("method", i+1);
          continue;
          }

          //This scans from the first '{' until the last '}' to pull out the full method declaration.
          char temp = 0;
          int pos = code.indexOf("{", i+1), count = 1;
          if(pos != -1) {
          while(++pos < code.length()) {
          if (count == 0)
          break;

          temp = code.charAt(pos);
          if (temp == '{')
          count++;
          if (temp == '}')
          count--;
          }
          } else {
          //Missing an opening bracket, so just remove "method" and hope it compiles.
          code = code.replaceFirst("method", "");
          i = code.indexOf("method", i+1);
          continue;
          }
          String s = code.substring(i, pos);

          //System.out.println("Found method: " + s);
          code = code.replace(s, "");
          methodDump+=(s.replaceFirst("method ", "static ")) + "\n";

          i = code.indexOf("method", i+1);
          }*/

          // Pulls out all methods
          i = code.indexOf("(");
          while (i >= 0) {
            if (isDirty(dirtyBounds, i)) {
              i = code.indexOf("(", i + 1);
              continue;
            }

            // Move backwards first
            char temp = 0;
            int pos = i;
            boolean shouldSkip = false;
            while (--pos > 0) {
              temp = code.charAt(pos);
              if (temp == '.') {
                shouldSkip = true;
                break;
              } // This is a method call, ie String.charAt();
              if (temp == ';') {
                ++pos;
                break;
              } // This is most likely a method declaration, since we had no errors
              // If we hit the start of the file, that's probable a method dec. too!
            }
            if (shouldSkip || isDirty(dirtyBounds, pos)) {
              i = code.indexOf("(", i + 1);
              continue;
            } // If this def. isn't a method or it's in a comment

            int start = pos;
            temp = 0;
            pos = code.indexOf("{", i + 1);
            int count = 1;
            if (pos != -1) {
              while (++pos < code.length()) {
                if (count == 0) break;

                temp = code.charAt(pos);
                if (temp == '{') count++;
                if (temp == '}') count--;
              }
            } else {
              i = code.indexOf("(", i + 1);
              continue;
            }

            int end = pos;
            String s = code.substring(start, end);
            code = code.replace(s, "");

            // Just to make it look nicer
            s = s.trim();

            System.out.println("Found method: " + s);
            methodDump += (s + "\n");
            i = code.indexOf("(", i + 1);
          }

          // Inject the class header and main method, imports, and methods
          code =
              "//User and auto-imports pre-defined\n"
                  + importDump
                  + "//Autogenerated class\n"
                  + "public class Main {\n"
                  + "public static void main(String[] args) {\n"
                  + code
                  + "}\n"
                  + methodDump
                  + "}";

          // Run as normal
          compileAndRun("Main", code);
        }
      } else if (command.equals("k")) {
        kill();
      } else if (command.equals("o")) {
        new OptionFrame(frame);
      } else if (command.equals("/")) {
        new HelpFrame(frame);
      }
    }
  private void jbInit() throws Exception {
    hierarTreePanel.setEnabled(false);
    warehousePanel.setLayout(borderLayout1);
    warehouseForm.setVOClassName("org.jallinone.warehouse.java.WarehouseVO");
    this.setTitle(ClientSettings.getInstance().getResources().getResource("warehouse detail"));
    buttonsPanel.setLayout(flowLayout1);
    flowLayout1.setAlignment(FlowLayout.LEFT);
    insertButton.setText("insertButton1");
    reloadButton.setText("reloadButton1");
    deleteButton.setText("deleteButton1");
    warehouseForm.setInsertButton(insertButton);
    warehouseForm.setCopyButton(copyButton);
    warehouseForm.setEditButton(editButton);
    warehouseForm.setReloadButton(reloadButton);
    warehouseForm.setDeleteButton(deleteButton);
    warehouseForm.setSaveButton(saveButton);
    warehouseForm.setFunctionId("WAR01");
    warehouseForm.setLayout(gridBagLayout1);
    controlZip.setAttributeName("zipWAR01");
    controlZip.setCanCopy(true);
    controlZip.setLinkLabel(labelZip);
    controlZip.setMaxCharacters(20);
    controlProv.setAttributeName("provinceWAR01");
    controlProv.setCanCopy(true);
    controlProv.setLinkLabel(labelProv);
    controlProv.setMaxCharacters(20);
    controlProv.setTrimText(true);
    controlProv.setUpperCase(true);
    controlCity.setAttributeName("cityWAR01");
    controlCity.setCanCopy(true);
    controlCity.setLinkLabel(labelCity);
    controlAddress.setAttributeName("addressWAR01");
    controlAddress.setCanCopy(true);
    controlAddress.setLinkLabel(labelAddress);
    labelAddress.setText("address");
    controlCountry.setAttributeName("countryWAR01");
    controlCountry.setCanCopy(true);
    controlCountry.setLinkLabel(labelCountry);
    controlCountry.setMaxCharacters(20);
    controlCountry.setTrimText(true);
    controlCountry.setUpperCase(true);
    labelZip.setText("zip");
    labelCity.setText("city");
    labelCountry.setText("country");
    labelProv.setText("prov");
    controlWarCode.setAttributeName("warehouseCodeWAR01");
    controlWarCode.setLinkLabel(labelWarCode);
    controlWarCode.setMaxCharacters(20);
    controlWarCode.setRequired(true);
    controlWarCode.setRpadding(false);
    controlWarCode.setTrimText(true);
    controlWarCode.setUpperCase(true);
    controlWarCode.setEnabledOnEdit(false);
    labelWarCode.setText("warehouseCodeWAR01");
    labelDescr.setText("descriptionWAR01");
    controlDescr.setAttributeName("descriptionWAR01");
    controlDescr.setLinkLabel(labelDescr);
    controlDescr.setRequired(true);
    labelCompanyCode.setText("companyCodeSys01WAR01");
    controlCompaniesCombo.setAttributeName("companyCodeSys01WAR01");
    controlCompaniesCombo.setCanCopy(true);
    controlCompaniesCombo.setLinkLabel(labelCompanyCode);
    controlCompaniesCombo.setRequired(true);
    controlCompaniesCombo.setEnabledOnEdit(false);
    labelRoles.setText("edit/delete warehouse role");
    controlRoles.setAttributeName("progressiveSys04WAR01");
    controlRoles.setDomainId("USERROLES");
    controlRoles.setLinkLabel(labelRoles);
    locationsPanel.setLayout(borderLayout2);
    tabbedPane.add(warehousePanel, "warehousePanel");
    this.getContentPane().add(buttonsPanel, BorderLayout.NORTH);
    this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
    warehouseForm.add(
        labelZip,
        new GridBagConstraints(
            3,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        labelCity,
        new GridBagConstraints(
            0,
            4,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        labelAddress,
        new GridBagConstraints(
            0,
            3,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        controlAddress,
        new GridBagConstraints(
            2,
            3,
            3,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        controlCity,
        new GridBagConstraints(
            2,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            100,
            0));
    warehouseForm.add(
        controlZip,
        new GridBagConstraints(
            4,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        controlWarCode,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            100,
            0));
    warehousePanel.add(warehouseForm, BorderLayout.CENTER);
    buttonsPanel.add(insertButton, null);
    buttonsPanel.add(copyButton, null);
    buttonsPanel.add(editButton, null);
    buttonsPanel.add(saveButton, null);
    buttonsPanel.add(reloadButton, null);
    buttonsPanel.add(deleteButton, null);
    buttonsPanel.add(navigatorBar, null);
    warehouseForm.add(
        labelWarCode,
        new GridBagConstraints(
            0,
            1,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        labelDescr,
        new GridBagConstraints(
            0,
            2,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        controlDescr,
        new GridBagConstraints(
            2,
            2,
            3,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        controlCountry,
        new GridBagConstraints(
            4,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        labelCountry,
        new GridBagConstraints(
            3,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        labelProv,
        new GridBagConstraints(
            0,
            5,
            1,
            2,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 0),
            0,
            0));
    warehouseForm.add(
        controlProv,
        new GridBagConstraints(
            2,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        labelCompanyCode,
        new GridBagConstraints(
            0,
            0,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    tabbedPane.add(locationsPanel, "locationsPanel");
    locationsPanel.add(split, BorderLayout.CENTER);
    split.setDividerLocation(150);
    split.add(hierarTreePanel, JSplitPane.LEFT);
    split.add(availPanel, JSplitPane.RIGHT);
    tabbedPane.add(bookedItemsPanel, "bookedItemsPanel");
    tabbedPane.add(orderedItemsPanel, "orderedItemsPanel");
    hierarTreePanel.setFunctionId("WAR01");
    tabbedPane.setTitleAt(
        0, ClientSettings.getInstance().getResources().getResource("warehouse detail"));
    tabbedPane.setTitleAt(1, ClientSettings.getInstance().getResources().getResource("positions"));
    tabbedPane.setTitleAt(
        2, ClientSettings.getInstance().getResources().getResource("bookedItemsPanel"));
    tabbedPane.setTitleAt(
        3, ClientSettings.getInstance().getResources().getResource("orderedItemsPanel"));

    warehouseForm.add(
        controlCompaniesCombo,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        controlRoles,
        new GridBagConstraints(
            2,
            6,
            1,
            2,
            0.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));
    warehouseForm.add(
        labelRoles,
        new GridBagConstraints(
            0,
            7,
            2,
            1,
            0.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
  }
  public ObjectInspector(Db4oViewer viewer, Object object) {
    this.viewer = viewer;
    this.object = object;

    this.setPreferredSize(new Dimension(600, 800));
    BorderLayout thisLayout = new BorderLayout();
    getContentPane().setLayout(thisLayout);
    this.setLocation(400, 150);

    {
      jSplitPane1 = new JSplitPane();
      getContentPane().add(jSplitPane1, BorderLayout.NORTH);
      jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
      {
        jPanel1 = new JPanel();
        jSplitPane1.add(jPanel1, JSplitPane.BOTTOM);
        BorderLayout jPanel1Layout = new BorderLayout();
        jPanel1.setLayout(jPanel1Layout);
        jPanel1.setPreferredSize(new java.awt.Dimension(590, 191));
        {
          jPanel2 = new JPanel();
          FlowLayout jPanel2Layout = new FlowLayout();
          jPanel1.add(jPanel2, BorderLayout.SOUTH);
          jPanel2.setPreferredSize(new java.awt.Dimension(592, 33));
          jPanel2.setLayout(jPanel2Layout);
          {
            saveButton = new JButton();
            jPanel2.add(saveButton);
            saveButton.setText("Save");
            saveButton.setActionCommand("save");
            saveButton.addActionListener(this);
          }
          {
            deleteButton = new JButton();
            jPanel2.add(deleteButton);
            deleteButton.setText("Delete");
            deleteButton.setActionCommand("delete");
            deleteButton.addActionListener(this);
          }
          {
            refreshButton = new JButton();
            jPanel2.add(refreshButton);
            refreshButton.setText("Refresh");
            refreshButton.setActionCommand("refresh");
            refreshButton.addActionListener(this);
          }
        }
        {
          jPanel3 = new JPanel();
          jPanel1.add(jPanel3, BorderLayout.NORTH);
          FlowLayout jPanel3Layout = new FlowLayout();
          jPanel3.setLayout(jPanel3Layout);
          jPanel3.setPreferredSize(new java.awt.Dimension(592, 114));
          {
            fieldEdit = new JTextArea();
            jPanel3.add(fieldEdit);
            fieldEdit.setPreferredSize(new java.awt.Dimension(324, 92));
            fieldEdit.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
          }
          {
            editApply = new JButton();
            jPanel3.add(editApply);
            editApply.setText("Apply");
            editApply.setActionCommand("apply");
            editApply.addActionListener(this);
          }
        }
      }
      {
        jScrollPane1 = new JScrollPane();
        jSplitPane1.add(jScrollPane1, JSplitPane.TOP);
        {
          jTree1 = new AutoScrollingJTree(new DefaultMutableTreeNode());
          jScrollPane1.setViewportView(jTree1);
          jTree1.setDragEnabled(true);

          TreeDragSource ds = new TreeDragSource(jTree1, DnDConstants.ACTION_COPY_OR_MOVE);
          TreeDropTarget dt = new TreeDropTarget(jTree1);
        }
      }
    }

    if (object != null) {
      this.setTitle(object.toString());
    }

    System.out.println(object);

    buildTree();
    jTree1.addMouseListener(this);

    this.pack();
    this.setVisible(true);
  }
Ejemplo n.º 25
0
    @SuppressWarnings("unchecked") // we must be compatible with 1.6
    public VersionManagementPanel(final VisualCanvas canvas) {

      super(canvas);

      setLayout(new GridLayout());

      // TODO @Christian Poliwoda what does manual testing mean?
      // numbers tested manually
      Dimension prefScrollPaneDim = new Dimension(100, 30);
      Dimension visibleRectDim = canvas.getVisibleRect().getSize();

      final VersionController controller =
          canvas.getProjectController().getProject().getProjectFile();

      final int numVersions = controller.getNumberOfVersions() - 1;

      versionData = new Object[numVersions];

      ArrayList<RevCommit> versions = new ArrayList<RevCommit>();

      try {
        versions = controller.getVersions();
      } catch (IOException ex) {
        Logger.getLogger(VersionManagementPanel.class.getName()).log(Level.SEVERE, null, ex);
      }

      int maxTextwidth = 0;
      String longestText = null;

      // the history with timestamp and a short commit message
      for (int i = 1; i < versions.size(); i++) {
        String text =
            // + Message.generateHTMLSpace(3)
            new Date(versions.get(i).getCommitTime() * 1000L)
                + ": "
                + versions.get(i).getShortMessage();

        // truncate texts that are too long
        int maxTextLength = 100;
        String dots = "...";

        int textLength = text.length() - dots.length();

        if (textLength > maxTextLength) {
          text = text.substring(0, maxTextLength) + dots;
        }

        versionData[versions.size() - i - 1] = new Version(text, i);

        if (text.length() > maxTextwidth) {
          maxTextwidth = text.length();
          longestText = text;
        }
      }

      resultModel = new DefaultListModel();

      // first init to show all if search not started yet
      for (int i = 0; i < versionData.length; i++) {
        resultModel.addElement(versionData[i]);
      }

      versionList = new JList(resultModel);

      // set the width of version managment window
      // dependent on largest git short message length
      double maxFontWidth =
          versionList
              .getFontMetrics(versionList.getFont())
              .getStringBounds(longestText, versionList.getGraphics())
              .getWidth();

      if (maxFontWidth <= visibleRectDim.width) {

        prefScrollPaneDim.width = (int) maxFontWidth;
      } else {

        if (visibleRectDim.width < 400) {
          prefScrollPaneDim.width = visibleRectDim.width;
        } else {
          prefScrollPaneDim.width = 400;
        }
      }

      versionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

      versionList.setOpaque(false);

      versionList.setBackground(VSwingUtil.TRANSPARENT_COLOR);
      versionList.setBorder(new EmptyBorder(3, 3, 3, 3));

      Box upperTopBox = Box.createVerticalBox();

      // press the commits to top with VerticalGlue
      // contains search area at top and
      // search results at the botton
      Box upperOuterBox = Box.createVerticalBox();

      JButton searchButton = new JButton("search");
      searchButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
              searchAndAddToResultList();
            }
          });

      searchField = new JTextArea();

      // search area box
      Box upperBox1 = Box.createHorizontalBox();

      upperBox1.add(searchField);
      upperBox1.add(searchButton);

      Dimension fieldDim = new Dimension(Short.MAX_VALUE, searchField.getPreferredSize().height);
      searchField.setMaximumSize(fieldDim);

      searchField.addKeyListener(
          new KeyAdapter() {
            String tmp = "";

            @Override
            public void keyReleased(KeyEvent ke) {

              searchAndAddToResultList();
            }
          });

      //            upperOuterBox.add(upperBox1);
      upperTopBox.add(upperBox1);
      upperTopBox.add(upperOuterBox);

      // result area box
      Box upperBox2 = Box.createHorizontalBox();

      upperBox2.add(Box.createHorizontalGlue());
      upperBox2.add(versionList);
      upperBox2.add(Box.createHorizontalGlue());

      upperOuterBox.add(upperBox2);
      upperOuterBox.add(Box.createVerticalGlue());

      // added for optical reasons to force correct scrollbar position
      Box upperInnerBorderPane = Box.createHorizontalBox();
      upperInnerBorderPane.add(upperOuterBox);
      upperInnerBorderPane.setBorder(new EmptyBorder(5, 15, 5, 15));
      upperInnerBorderPane.setBackground(VSwingUtil.TRANSPARENT_COLOR);

      VScrollPane upperScrollPane = new VScrollPane(upperInnerBorderPane);
      upperScrollPane.setHorizontalScrollBarPolicy(VScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      upperScrollPane.setVerticalScrollBarPolicy(VScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
      upperScrollPane.setMinimumSize(prefScrollPaneDim);

      JSplitPane splitPane = new VSplitPane(JSplitPane.VERTICAL_SPLIT);
      splitPane.setEnabled(true); // true = transparent
      splitPane.setBackground(VSwingUtil.TRANSPARENT_COLOR);
      splitPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      splitPane.setDividerLocation(0.5);

      upperTopBox.add(upperScrollPane);
      splitPane.add(upperTopBox); // add in the upper part

      htmlCommit.setBackground(VSwingUtil.TRANSPARENT_COLOR);
      htmlCommit.setContentType("text/html");
      htmlCommit.setOpaque(false);
      htmlCommit.setEditable(false);
      htmlCommit.setBorder(new EmptyBorder(0, 15, 0, 15));

      Box lowerBox = Box.createVerticalBox();
      lowerBox.setAlignmentX(Component.LEFT_ALIGNMENT);
      lowerBox.add(htmlCommit);
      lowerBox.add(Box.createVerticalGlue());

      VScrollPane lowerScrollPane = new VScrollPane(lowerBox);

      lowerScrollPane.setHorizontalScrollBarPolicy(VScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      lowerScrollPane.setVerticalScrollBarPolicy(VScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
      lowerScrollPane.setMinimumSize(new Dimension(0, 0));

      // add in the lower part
      splitPane.setBottomComponent(lowerScrollPane);

      add(splitPane);

      versionList.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

              // show commit message in lower part if clicked on a row
              // in upper part
              if (e.getClickCount() == 1) {

                final VersionController controller =
                    canvas.getProjectController().getProject().getProjectFile();

                final int numVersions = controller.getNumberOfVersions() - 1;

                ArrayList<RevCommit> versions = new ArrayList<RevCommit>();

                try {
                  versions = controller.getVersions();
                } catch (IOException ex) {
                  Logger.getLogger(VersionManagementPanel.class.getName())
                      .log(Level.SEVERE, null, ex);
                }

                int versionIndex = ((Version) versionList.getSelectedValue()).getVersion();

                htmlCommit.setText(
                    "<html>"
                        + "<pre> <font color=white><br>"
                        + "<b>SHA-1:</b> "
                        + versions.get(versionIndex).getName()
                        + "<br><br>"
                        + "<b>Message:</b><br><br>"
                        + versions.get(versionIndex).getFullMessage()
                        + "</pre></p>"
                        + "</html>");
                htmlCommit.setCaretPosition(0);
              }

              if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e)) {

                if (((Version) versionList.getSelectedValue()).getVersion() < 2) {
                  VDialog.showMessageDialog(
                      canvas,
                      "Cannot Load Version",
                      "The first version in a project contains no"
                          + " sessions and cannot be loaded!");
                  return;
                }

                //                        if (VDialog.showConfirmDialog(canvas,
                //                                "Checkout Version:",
                //                                "<html><div align=Center>"
                //                                + "<p>Do you want to checkout the selected"
                //                                + " version?<p>"
                //                                + "<p><b>Unsaved changes will be lost!</b></p>"
                //                                + "</div></html>",
                //                                VDialog.DialogType.YES_NO) != VDialog.YES) {
                //                            return;
                //                        }

                int answer =
                    VDialog.showConfirmDialog(
                        canvas,
                        "Checkout Version:",
                        "<html><div align=Center>"
                            + "<p>Checking out selected version.<p><br>"
                            + "<p>Do you want to save the current session?</p><br>"
                            + "<p><b>Unsaved changes will be lost!</b></p>"
                            + "</div></html>",
                        new String[] {"Save", "Discard", "Cancel"});

                if (answer == 0) {
                  try {
                    canvas.getProjectController().saveProject(false);
                  } catch (IOException ex) {
                    Logger.getLogger(VersionManagement.class.getName()).log(Level.SEVERE, null, ex);

                    VDialog.showMessageDialog(
                        canvas,
                        "Cannot save Project:",
                        "<html><div align=Center>" + "Project cannot be saved!" + "</div></html>");
                  }
                } else if (answer == 1) {
                  // nothing to do
                } else if (answer == 2) {
                  return;
                }

                try {

                  int versionIndex = ((Version) versionList.getSelectedValue()).getVersion();

                  canvas.setActive(false);

                  String currentSessionName = canvas.getProjectController().getCurrentSession();

                  canvas.getProjectController().close(currentSessionName);

                  controller.checkoutVersion(versionIndex);

                  if (dialog != null) {
                    dialog.close();
                    dialog = null;
                  }

                  if (canvas
                      .getProjectController()
                      .getProject()
                      .getSessionFileByEntryName(currentSessionName)
                      .exists()) {
                    canvas.getProjectController().open(currentSessionName, false, true);
                  } else {
                    //                                VDialog.showMessageDialog(canvas,
                    //                                        "Cannot load \""
                    //                                        + currentSessionName
                    //                                        +"\":", "<html><div align=Center>"
                    //                                        + "<p>The Session "
                    //                                        + Message.EMPHASIZE_BEGIN
                    //                                        + currentSessionName
                    //                                         +  Message.EMPHASIZE_END
                    //                                        + " does not exist in the current"
                    //                                        + " version."
                    //                                        + "<p>The <b>Main</b>-Session will"
                    //                                        + "be loaded instead</div></html>");
                    canvas.getProjectController().open("Main", false, true);
                  }

                } catch (IOException ex) {
                  Logger.getLogger(VersionManagementPanel.class.getName())
                      .log(Level.SEVERE, null, ex);
                }
              }
            }
          });

      //            setMinimumSize(visibleRectDim);
      setMaximumSize(visibleRectDim);

      int width = getPreferredSize().width;
      setPreferredSize(new Dimension(width, (int) (visibleRectDim.height * 0.5)));
    } // end constructure
Ejemplo n.º 26
0
  /**
   * Descripción de Método
   *
   * @throws Exception
   */
  void jbInit() throws Exception {
    CompiereColor.setBackground(this);
    mainPanel.setLayout(mainLayout);
    mainLayout.setHgap(5);
    mainLayout.setVgap(5);
    this.getContentPane().add(mainPanel);
    northPanel.setLayout(northLayout);
    northPanel.add(toolBar, BorderLayout.CENTER);
    toolBar.add(bLoad);
    toolBar.add(bDelete);
    toolBar.add(bSave);
    toolBar.add(bOpen);
    toolBar.add(cbContent);
    mainPanel.add(northPanel, BorderLayout.NORTH);

    //

    bOpen.setEnabled(false);
    bOpen.setIcon(Env.getImageIcon("Editor24.gif"));
    bOpen.setMargin(new Insets(0, 2, 0, 2));
    bOpen.setToolTipText(Msg.getMsg(Env.getCtx(), "Open"));
    bOpen.addActionListener(this);

    //

    bSave.setEnabled(false);
    bSave.setIcon(Env.getImageIcon("Export24.gif"));
    bSave.setMargin(new Insets(0, 2, 0, 2));
    bSave.setToolTipText(Msg.getMsg(Env.getCtx(), "AttachmentSave"));
    bSave.addActionListener(this);

    //

    bLoad.setIcon(Env.getImageIcon("Import24.gif"));
    bLoad.setMargin(new Insets(0, 2, 0, 2));
    bLoad.setToolTipText(Msg.getMsg(Env.getCtx(), "Load"));
    bLoad.addActionListener(this);

    //

    bDelete.setIcon(Env.getImageIcon("Delete24.gif"));
    bDelete.setMargin(new Insets(0, 2, 0, 2));
    bDelete.setToolTipText(Msg.getMsg(Env.getCtx(), "Delete"));
    bDelete.addActionListener(this);

    //

    Dimension size = cbContent.getPreferredSize();

    size.width = 200;
    cbContent.setPreferredSize(size);

    // cbContent.setToolTipText(text);

    cbContent.addActionListener(this);
    cbContent.setLightWeightPopupEnabled(false); // Acrobat Panel is heavy

    //

    text.setBackground(CompierePLAF.getInfoBackground());
    text.setPreferredSize(new Dimension(200, 200));

    //

    mainPanel.add(confirmPanel, BorderLayout.SOUTH);
    confirmPanel.addActionListener(this);
    bDeleteAll = ConfirmPanel.createDeleteButton(true);
    confirmPanel.addButton(bDeleteAll);
    bDeleteAll.addActionListener(this);

    //

    info.setText("-");
    info.setReadWrite(false);
    graphPanel.add(info, BorderLayout.CENTER);

    //

    mainPanel.add(centerPane, BorderLayout.CENTER);
    centerPane.add(graphPanel, JSplitPane.LEFT);
    centerPane.add(text, JSplitPane.RIGHT);
    centerPane.setResizeWeight(.75); // more to graph
  } // jbInit
Ejemplo n.º 27
0
  void jbInit() throws Exception {
    titledBorder1 =
        new TitledBorder(
            BorderFactory.createLineBorder(new Color(153, 153, 153), 2), "Assembler messages");
    this.getContentPane().setLayout(borderLayout1);

    this.setIconifiable(true);
    this.setMaximizable(true);
    this.setResizable(true);

    this.setTitle("EDIT");

    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPane.setDividerLocation(470);
    sourceArea.setFont(new java.awt.Font("Monospaced", 0, 12));
    controlPanel.setLayout(gridBagLayout1);
    controlPanel.setBorder(BorderFactory.createLoweredBevelBorder());
    positionPanel.setLayout(gridBagLayout2);
    fileLabel.setText("Source file:");
    fileText.setEditable(false);
    browseButton.setSelected(false);
    browseButton.setText("Browse ...");
    assembleButton.setEnabled(false);
    assembleButton.setText("Assemble file");
    saveButton.setEnabled(false);
    saveButton.setText("Save file");
    lineLabel.setText("Line:");
    lineText.setMinimumSize(new Dimension(50, 20));
    lineText.setPreferredSize(new Dimension(50, 20));
    lineText.setEditable(false);
    columnLabel.setText("Column:");
    columnText.setMinimumSize(new Dimension(41, 20));
    columnText.setPreferredSize(new Dimension(41, 20));
    columnText.setEditable(false);
    columnText.setText("");
    messageScrollPane.setBorder(titledBorder1);
    messageScrollPane.setMinimumSize(new Dimension(33, 61));
    messageScrollPane.setPreferredSize(new Dimension(60, 90));
    optionsButton.setEnabled(false);
    optionsButton.setText("Assembler options ...");
    messageScrollPane.getViewport().add(messageList, null);
    messageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    this.getContentPane().add(splitPane, BorderLayout.CENTER);
    splitPane.add(textScrollPane, JSplitPane.TOP);
    splitPane.add(controlPanel, JSplitPane.BOTTOM);
    textScrollPane.getViewport().add(sourceArea, null);

    controlPanel.add(
        fileLabel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        fileText,
        new GridBagConstraints(
            1,
            0,
            3,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        browseButton,
        new GridBagConstraints(
            4,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 0, 5),
            0,
            0));
    controlPanel.add(
        optionsButton,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        assembleButton,
        new GridBagConstraints(
            3,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        saveButton,
        new GridBagConstraints(
            4,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 0, 5),
            0,
            0));
    controlPanel.add(
        positionPanel,
        new GridBagConstraints(
            0,
            1,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(5, 5, 0, 0),
            0,
            0));
    positionPanel.add(
        lineLabel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));
    positionPanel.add(
        lineText,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 5, 0, 0),
            0,
            0));
    positionPanel.add(
        columnLabel,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 10, 0, 0),
            0,
            0));
    positionPanel.add(
        columnText,
        new GridBagConstraints(
            3,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 5, 0, 0),
            0,
            0));
    controlPanel.add(
        messageScrollPane,
        new GridBagConstraints(
            0,
            2,
            5,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(5, 5, 5, 5),
            0,
            0));
  }
Ejemplo n.º 28
0
  public TriUMQueryGUI(String fixUserId) {
    if (fixUserId == null || fixUserId.length() == 0) this.fixUserId = null;
    else this.fixUserId = fixUserId;

    JPanel mainPane = new JPanel();
    mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS));
    //
    mainPane.add(createRowPanel(new JLabel("ENTER NECESSARY PARAMETERS:"), new JLabel("")));
    //
    protocol = new JComboBox(new String[] {"rmi", "soap", "http", "socket"});
    protocol.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            String protocol = e.getItem().toString().toLowerCase();
            if (protocol.equals("rmi")) port.setText(String.valueOf(TriUMQuery.RMI_QUERY_PORT));
            else if (protocol.equals("soap"))
              port.setText(String.valueOf(TriUMQuery.SOAP_QUERY_PORT));
            else if (protocol.equals("http"))
              port.setText(String.valueOf(TriUMQuery.HTTP_SERVICE_PORT));
            else if (protocol.equals("socket"))
              port.setText(String.valueOf(TriUMQuery.COMMUNICATE_SOCKET_SERVICE_PORT));
          }
        });
    mainPane.add(createRowPanel(new JLabel("Protocol:"), protocol));
    //
    host = new JTextField(TEXT_FIELD_COLUMNS);
    host.setText("localhost");
    mainPane.add(createRowPanel(new JLabel("Host:"), host));
    //
    port = new JTextField(TEXT_FIELD_COLUMNS);
    port.setText(String.valueOf(TriUMQuery.RMI_QUERY_PORT));
    mainPane.add(createRowPanel(new JLabel("Port:"), port));
    //
    type =
        new JComboBox(
            new QueryType[] {
              new QueryType("personalinfo", "Personal Information"),
              new QueryType("conceptinfo", "Concept Information"),
              new QueryType("studytime", "Study Time"),
              new QueryType("overlay", "Overlay Model"),
              new QueryType("bayes", "Static Bayesian Model"),
              new QueryType("dynbayes", "Dynamic Bayesian Model"),
              new QueryType("learningstyle", "Learning Style"),
              new QueryType("prerecommend", "Pre-recommended Concepts"),
              new QueryType("postrecommend", "Post-recommended Concepts"),
              new QueryType("learningpath", "Learning Path"),
              new QueryType("community", "User Community"),
              new QueryType("interest", "User Interest"),
              new QueryType("userreport", "User Report"),
              new QueryType("feedbackreport", "Feedback Report"),
              new QueryType("totalreport", "Total Report"),
              new QueryType("mlreg", "Register Mailing List"),
              new QueryType("mlunreg", "Unregister Mailing List")
            });
    type.setSelectedIndex(0);
    mainPane.add(createRowPanel(new JLabel("Query type:"), type));
    //
    userid = new JTextField(TEXT_FIELD_COLUMNS);
    if (fixUserId == null) userid.setText("guest");
    else {
      userid.setText(fixUserId);
      userid.setEditable(false);
    }
    mainPane.add(createRowPanel(new JLabel("User ID:"), userid));
    //
    JPanel coursePanel = new JPanel();
    coursePanel.setLayout(new BoxLayout(coursePanel, BoxLayout.X_AXIS));
    course = new JComboBox();
    course.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            try {
              String course = e.getItem().toString().toLowerCase();
              TriUMQuery query =
                  TriUMQueryClientUtil.getTriUMQuery(
                      TriUMQuery.RMI_DEFAULT_QUERY_HOST, TriUMQuery.RMI_QUERY_PORT);
              ArrayList<String> conceptList = query.listBriefConcepts(course);
              concept.setModel(new DefaultComboBoxModel(conceptList.toArray()));
            } catch (RemoteException ex) {
              ex.printStackTrace();
            }
          }
        });
    JButton getCourseList =
        new JButton(
            new AbstractAction("Get") {
              private static final long serialVersionUID = 1L;

              public void actionPerformed(ActionEvent e) {
                try {
                  TriUMQuery query =
                      TriUMQueryClientUtil.getTriUMQuery(
                          TriUMQuery.RMI_DEFAULT_QUERY_HOST, TriUMQuery.RMI_QUERY_PORT);
                  ArrayList<String> courseList = query.listCourses();
                  course.setModel(new DefaultComboBoxModel(courseList.toArray()));
                  if (courseList.size() > 0) {
                    course.setSelectedIndex(0);
                    ArrayList<String> conceptList = query.listBriefConcepts(courseList.get(0));
                    concept.setModel(new DefaultComboBoxModel(conceptList.toArray()));
                  }
                } catch (RemoteException ex) {
                  ex.printStackTrace();
                }
              }
            });
    coursePanel.add(course);
    coursePanel.add(getCourseList);
    mainPane.add(createRowPanel(new JLabel("Course:"), coursePanel));
    //
    concept = new JComboBox();
    mainPane.add(createRowPanel(new JLabel("Concept:"), concept));
    //
    JButton query =
        new JButton(
            new AbstractAction("QUERY") {
              private static final long serialVersionUID = 1L;

              public void actionPerformed(ActionEvent e) {
                onQueryGUI();
              }
            });
    JButton clear =
        new JButton(
            new AbstractAction("CLEAR") {
              private static final long serialVersionUID = 1L;

              public void actionPerformed(ActionEvent e) {
                clearResult();
              }
            });
    mainPane.add(createRowPanel(query, clear));
    //
    knowledge = new JTextField(TEXT_FIELD_COLUMNS);
    knowledge.setAutoscrolls(true);
    knowledge.setEditable(false);
    mainPane.add(createRowPanel(new JLabel("Knowledge:"), knowledge));
    //
    ls = new JTextField(TEXT_FIELD_COLUMNS);
    ls.setAutoscrolls(true);
    ls.setEditable(false);
    mainPane.add(createRowPanel(new JLabel("Learning Style:"), ls));
    //
    prerec = new JTextField(TEXT_FIELD_COLUMNS);
    prerec.setAutoscrolls(true);
    prerec.setEditable(false);
    mainPane.add(createRowPanel(new JLabel("Pre-recommended Concepts:"), prerec));
    //
    postrec = new JTextField(TEXT_FIELD_COLUMNS);
    postrec.setAutoscrolls(true);
    postrec.setEditable(false);
    mainPane.add(createRowPanel(new JLabel("Post-recommended Concepts:"), postrec));
    //
    lp = new JTextField(TEXT_FIELD_COLUMNS);
    lp.setAutoscrolls(true);
    lp.setEditable(false);
    mainPane.add(createRowPanel(new JLabel("Learning Path:"), lp));
    //
    community = new JTextField(TEXT_FIELD_COLUMNS);
    community.setMaximumSize(new Dimension(400, 10));
    community.setAutoscrolls(true);
    community.setEditable(false);
    mainPane.add(createRowPanel(new JLabel("Community:"), community));
    //
    studytime = new JTextField(TEXT_FIELD_COLUMNS);
    studytime.setAutoscrolls(true);
    studytime.setEditable(false);
    mainPane.add(createRowPanel(new JLabel("Study Time:"), studytime));
    //
    docclass = new JTextField(TEXT_FIELD_COLUMNS);
    docclass.setAutoscrolls(true);
    docclass.setEditable(false);
    mainPane.add(createRowPanel(new JLabel("Interest/DocClass:"), docclass));
    //
    infoTable = new JTable();
    infoTable.setAutoscrolls(true);
    mainPane.add(createRowPanel(new JLabel("Info:"), new JScrollPane(infoTable)));

    // Msg
    msg = new JTextArea(10, TEXT_FIELD_COLUMNS);
    msg.setLineWrap(true);
    msg.setAutoscrolls(true);
    msg.setEditable(false);

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setDividerLocation(500);
    splitPane.add(mainPane, JSplitPane.TOP);
    splitPane.add(new JScrollPane(msg), JSplitPane.BOTTOM);
    this.setLayout(new BorderLayout());
    this.add(splitPane, BorderLayout.CENTER);
    this.setSize(500, 650);
  }
Ejemplo n.º 29
0
  private void jbInit() throws Exception {
    borderForProjectView = BorderFactory.createLineBorder(Color.black, 2);
    titleBoderForProjectView = new TitledBorder(borderForProjectView, "Project view");
    borderForEntitiesView = BorderFactory.createLineBorder(Color.black, 2);
    titledBorderForEntitiesView = new TitledBorder(borderForEntitiesView, "Entities view");
    titledBorderForMessagesPane =
        new TitledBorder(
            BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)), "Messages");
    this.getContentPane().setLayout(borderLayout2);
    file.setText("File");
    save.setEnabled(false);
    save.setText("Save");
    save.setName("Savefilemenu");
    save.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            save_actionPerformed(e);
          }
        });
    load.setText("Load");
    load.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            load_actionPerformed(e);
          }
        });
    this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    this.setJMenuBar(mainMenuBar);
    this.setTitle("INGENIAS Development Kit");
    this.setSize(625, 470);
    this.addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosed(WindowEvent e) {
            this_windowClosed(e);
          }

          public void windowClosing(WindowEvent e) {
            this_windowClosing(e);
          }
        });
    splitPaneSeparatingProjectsAndEntitiesView.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPaneSeparatingProjectsAndEntitiesView.setBottomComponent(scrollPaneForEntitiesView);
    splitPaneSeparatingProjectsAndEntitiesView.setTopComponent(scrollPaneForProyectView);
    jPanel1.setLayout(gridLayout1);
    arbolObjetos.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            arbolObjetos_mouseClicked(e);
          }
        });
    scrollPaneForProyectView.setAutoscrolls(true);
    scrollPaneForProyectView.setBorder(titleBoderForProjectView);
    scrollPaneForEntitiesView.setBorder(titledBorderForEntitiesView);
    edit.setText("Edit");
    copyImage.setText("Copy diagram as a file");
    copyImage.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            capture_actionPerformed(e);
          }
        });
    saveas.setText("Save as");
    saveas.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveas_actionPerformed(e);
          }
        });
    help.setText("Help");
    manual.setText("Tool manual");
    manual.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            manual_actionPerformed(e);
          }
        });
    about.setText("About");
    about.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            about_actionPerformed(e);
          }
        });
    project.setText("Project");
    copy.setText("Copy");
    copy.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            copy_actionPerformed(e);
          }
        });
    paste.setText("Paste");
    paste.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            paste_actionPerformed(e);
          }
        });
    exit.setText("Exit");
    exit.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            exit_actionPerformed(e);
          }
        });
    splitPanelDiagramMessagesPaneSeparator.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPanelDiagramMessagesPaneSeparator.setLastDividerLocation(150);
    pprin.setLayout(new BorderLayout());
    pprin.setName("DiagramPane");
    pprin.setPreferredSize(new Dimension(400, 300));
    pprin.add(BorderLayout.SOUTH, pbar);
    pbar.setVisible(false);
    jSplitPane1.setOrientation(JSplitPane.HORIZONTAL_SPLIT);

    scrollLogs.setBorder(titledBorderForMessagesPane);
    scrollLogs.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            jScrollPane3_keyPressed(e);
          }
        });
    this.clearMessages.setText("Clear");
    clearMessages.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clearMessages_actionPerformed(e, (JTextPane) messagesMenu.getInvoker());
          }
        });
    forcegc.setText("Force GC");
    forcegc.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            forcegc_actionPerformed(e);
          }
        });

    menuTools.setText("Tools");
    menuCodeGenerator.setText("Code Generator");
    profiles.setText("Profiles");

    menuModules.setText("Modules");
    this.properties.setText("Properties");
    properties.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            properties_actionPerformed(e);
          }
        });
    moutput.setEditable(false);
    moutput.setSelectionStart(0);
    moutput.setText("");
    moduleOutput.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            moduleOutput_mouseClicked(e);
          }
        });
    moduleOutput.setFont(new java.awt.Font("Monospaced", 0, 11));
    logs.setContentType("text/html");
    logs.setEditable(false);
    logs.setText("");
    logs.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            logs_mouseClicked(e);
          }
        });
    logs.addComponentListener(
        new java.awt.event.ComponentAdapter() {
          public void componentResized(ComponentEvent e) {
            logs_componentResized(e);
          }
        });
    newProject.setText("New");
    newProject.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            newProject_actionPerformed(e);
          }
        });
    undo.setText("Undo");
    undo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            undo_actionPerformed(e);
          }
        });
    redo.setText("Redo");
    redo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            redo_actionPerformed(e);
          }
        });
    delete.setText("Delete");
    delete.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            delete_actionPerformed(e);
          }
        });
    selectall.setText("Select all");
    selectall.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selectall_actionPerformed(e);
          }
        });
    cpClipboard.setText("Copy diagram to clipboard");
    cpClipboard.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cpClipboard_actionPerformed(e);
          }
        });
    preferences.setText("Preferences");

    enableUMLView.setToolTipText("UML view" + "instead of its type");
    enableUMLView.setText("Enable UML view from now on");
    enableUMLView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            enableUMLView_actionPerformed(e);
          }
        });
    enableINGENIASView.setToolTipText("INGENIAS view");
    enableINGENIASView.setText("Enable INGENIAS view from now on");
    enableINGENIASView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            enableINGENIASView_actionPerformed(e);
          }
        });

    switchINGENIASView.setToolTipText("Switch to INGENIAS view");
    switchINGENIASView.setText("Switch to INGENIAS view");
    switchINGENIASView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            switchINGENIASView_actionPerformed(e);
          }
        });

    switchUMLView.setToolTipText("Switch to UML view");
    switchUMLView.setText("Switch to UML view");
    switchUMLView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            switchUMLView_actionPerformed(e);
          }
        });

    resizeAll.setToolTipText("Resize all");
    resizeAll.setText("Resize all entities within current diagram");
    resizeAll.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resizeAll_actionPerformed(e);
          }
        });

    resizeAllDiagrams.setToolTipText("Resize all diagrams");
    resizeAllDiagrams.setText("Resize all entities within all defined diagram");
    resizeAllDiagrams.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resizeAllDiagrams_actionPerformed(e);
          }
        });

    JMenuItem workspaceEntry = new JMenuItem("Switch workspace");
    workspaceEntry.setToolTipText("Change current workspace");
    workspaceEntry.setText("Switch workspace");
    workspaceEntry.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            changeWorkspace(e);
          }
        });
    preferences.add(workspaceEntry);
    preferences.add(resizeAll);
    preferences.add(resizeAllDiagrams);
    {
      elimOverlap = new JMenuItem();
      preferences.add(elimOverlap);
      elimOverlap.setText("Eliminate overlap");
      elimOverlap.setAccelerator(KeyStroke.getKeyStroke("F3"));
      elimOverlap.addMenuKeyListener(
          new MenuKeyListener() {
            public void menuKeyPressed(MenuKeyEvent evt) {
              System.out.println("elimOverlap.menuKeyPressed, event=" + evt);
              // TODO add your code for elimOverlap.menuKeyPressed
            }

            public void menuKeyReleased(MenuKeyEvent evt) {
              System.out.println("elimOverlap.menuKeyReleased, event=" + evt);
              // TODO add your code for elimOverlap.menuKeyReleased
            }

            public void menuKeyTyped(MenuKeyEvent evt) {
              elimOverlapMenuKeyTyped(evt);
            }
          });
      elimOverlap.addKeyListener(
          new KeyAdapter() {
            public void keyPressed(KeyEvent evt) {
              elimOverlapKeyPressed(evt);
            }
          });
      elimOverlap.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              elimOverlapActionPerformed(evt);
            }
          });
    }
    {
      modelingLanguageNotationSwitchMenu = new JMenu();
      preferences.add(modelingLanguageNotationSwitchMenu);
      modelingLanguageNotationSwitchMenu.setText("Modelling language");
      modelingLanguageNotationSwitchMenu.add(enableINGENIASView);

      viewSelection.add(enableINGENIASView);
      modelingLanguageNotationSwitchMenu.add(enableUMLView);
      viewSelection.add(enableUMLView);

      enableINGENIASView.setSelected(true);
      modelingLanguageNotationSwitchMenu.add(switchUMLView);
      modelingLanguageNotationSwitchMenu.add(switchINGENIASView);
    }
    {
      propertiesModeMenu = new JMenu();
      preferences.add(propertiesModeMenu);
      propertiesModeMenu.setText("Edit Properties Mode");
      {
        editPopUpProperties = new JCheckBoxMenuItem();
        propertiesModeMenu.add(editPopUpProperties);
        editPopUpProperties.setText("Edit Properties in a PopUp Window");
        editPopUpProperties.setSelected(true);
        editPopUpProperties.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                editPopUpProperties_selected();
              }
            });
        propertiesEditModeSelection.add(editPopUpProperties);
      }
      {
        editOnMessages = new JCheckBoxMenuItem();
        propertiesModeMenu.add(editOnMessages);
        editOnMessages.setText("Edit Properties in Messages Panel");
        propertiesEditModeSelection.add(editOnMessages);
        editOnMessages.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                editOnMessages_selected();
              }
            });
      }
    }

    mainMenuBar.add(file);
    mainMenuBar.add(edit);
    mainMenuBar.add(project);
    mainMenuBar.add(menuModules);
    mainMenuBar.add(profiles);
    mainMenuBar.add(preferences);
    mainMenuBar.add(help);
    file.add(newProject);
    file.add(load);
    {
      importFile = new JMenuItem();
      file.add(importFile);
      importFile.setText("Import file");
      importFile.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              importFileActionPerformed(evt);
            }
          });
    }
    file.add(save);
    file.add(saveas);
    file.addSeparator();
    file.add(exit);
    file.addSeparator();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(buttonModelPanel, BorderLayout.WEST);
    this.getContentPane().add(jSplitPane1, BorderLayout.CENTER);
    rightPanel.add(splitPanelDiagramMessagesPaneSeparator, BorderLayout.CENTER);
    jSplitPane1.add(splitPaneSeparatingProjectsAndEntitiesView, JSplitPane.LEFT);
    splitPaneSeparatingProjectsAndEntitiesView.add(scrollPaneForProyectView, JSplitPane.TOP);
    {
      jPanel2 = new JPanel();
      BorderLayout jPanel2Layout = new BorderLayout();
      jPanel2.setLayout(jPanel2Layout);
      splitPaneSeparatingProjectsAndEntitiesView.add(jPanel2, JSplitPane.BOTTOM);
      jPanel2.add(jPanel1, BorderLayout.SOUTH);
      jPanel2.add(scrollPaneForEntitiesView, BorderLayout.CENTER);
    }
    jSplitPane1.add(rightPanel, JSplitPane.RIGHT);
    splitPanelDiagramMessagesPaneSeparator.add(pprin, JSplitPane.TOP);
    splitPanelDiagramMessagesPaneSeparator.add(messagespane, JSplitPane.BOTTOM);
    JScrollPane scrollSearchDiagram = new JScrollPane();
    scrollSearchDiagram.getViewport().add(searchDiagramPanel, null);
    searchDiagramPanel.setContentType("text/html");
    searchDiagramPanel.setEditable(false);

    messagespane.addConventionalTab(scrollLogs, "Logs");
    scrollLogs.getViewport().add(logs, null);
    scrolloutput.getViewport().add(this.moduleOutput, null);
    messagespane.addConventionalTab(scrolloutput, "Module Output");
    messagespane.addConventionalTab(scrollSearchDiagram, "Search");
    scrolloutput.getViewport().add(moduleOutput, null);
    {
      searchPanel = new JPanel();
      FlowLayout searchPanelLayout = new FlowLayout();
      searchPanelLayout.setVgap(1);
      searchPanel.setLayout(searchPanelLayout);
      jPanel1.add(searchPanel, BorderLayout.SOUTH);
      searchPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
      {
        searchField = new JTextField();
        searchPanel.add(searchField);
        searchField.setColumns(15);

        searchField.addKeyListener(
            new KeyAdapter() {
              public void keyTyped(KeyEvent evt) {
                searchFieldKeyTyped(evt);
              }
            });
      }
      {
        Search = new JButton();
        scrollPaneForProyectView.setViewportView(arbolProyectos);
        scrollPaneForEntitiesView.setViewportView(arbolObjetos);
        searchPanel.add(Search);

        Search.setIcon(new ImageIcon(ImageLoader.getImage(("images/lense.png"))));
        //	Search.setPreferredSize(new java.awt.Dimension(20, 20));
        Search.setIconTextGap(0);
        Search.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent evt) {
                SearchActionPerformed(evt);
              }
            });
      }
    }
    edit.add(undo);
    edit.add(redo);
    edit.addSeparator();
    edit.add(copy);
    edit.add(paste);
    edit.add(delete);
    edit.add(selectall);
    edit.addSeparator();
    edit.add(copyImage);
    edit.add(cpClipboard);
    help.add(manual);
    help.add(about);
    help.add(forcegc);

    menuModules.add(menuTools);
    menuModules.add(menuCodeGenerator);
    messagesMenu.add(this.clearMessages);
    project.add(this.properties);

    project.addSeparator();
    jSplitPane1.setDividerLocation(250);
    splitPaneSeparatingProjectsAndEntitiesView.setDividerLocation(250);
    arbolProyectos.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            arbolProyectos_mouseClicked(e);
          }
        });
    splitPanelDiagramMessagesPaneSeparator.setDividerLocation(400);
  }
Ejemplo n.º 30
0
  /** Display the GUI */
  private void initGUI() {
    try {
      this.setTitle(PLUGIN_NAME + " - " + PLUGIN_VERSION);
      {
        jSplitPane1 = new JSplitPane();
        getContentPane().add(jSplitPane1, BorderLayout.CENTER);
        jSplitPane1.setPreferredSize(new java.awt.Dimension(500, 500));
        jSplitPane1.setDividerLocation(200);
        jSplitPane1.setResizeWeight(0.5);
        {
          jPanelRight = new JPanel();
          GridBagLayout jPanelRightLayout = new GridBagLayout();
          jPanelRightLayout.rowWeights = new double[] {0.0, 0.0, 0.5, 0.0};
          jPanelRightLayout.rowHeights = new int[] {7, 7, 7, 7};
          jPanelRightLayout.columnWeights = new double[] {0.0, 0.5, 0.0};
          jPanelRightLayout.columnWidths = new int[] {4, 7, 7};
          jSplitPane1.add(jPanelRight, JSplitPane.RIGHT);
          jPanelRight.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
          jPanelRight.setLayout(jPanelRightLayout);
          jPanelRight.setMinimumSize(new java.awt.Dimension(1, 1));
          {
            jButtonCancel = new JButton();
            jPanelRight.add(
                jButtonCancel,
                new GridBagConstraints(
                    0,
                    3,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.NONE,
                    new Insets(0, 10, 10, 0),
                    0,
                    0));
            jButtonCancel.setText("Quit");
            jButtonCancel.addActionListener(
                new ActionListener() {
                  // Close the GUI
                  @Override
                  public void actionPerformed(ActionEvent e) {
                    quitGui();
                  }
                });
          }
          {
            jButtonOK = new JButton();
            jPanelRight.add(
                jButtonOK,
                new GridBagConstraints(
                    2,
                    3,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.NONE,
                    new Insets(0, 0, 10, 10),
                    0,
                    0));
            jButtonOK.setText("Parse");
            jButtonOK.setEnabled(false);
            jButtonOK.addActionListener(
                new ActionListener() {
                  @Override
                  public void actionPerformed(ActionEvent e) {
                    boolean valid = checkValid();
                    if (valid) {
                      addCurrentExpressionToHistory();
                      launchCalculation();
                    }
                  }
                });
          }
          {
            jScrollPane1 = new JScrollPane();
            jPanelRight.add(
                jScrollPane1,
                new GridBagConstraints(
                    0,
                    2,
                    3,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH,
                    new Insets(10, 10, 10, 10),
                    0,
                    0));
            jScrollPane1.setOpaque(false);
            jScrollPane1.setBorder(null);
            jScrollPane1.getViewport().setOpaque(false);
            jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            {
              jTextAreaInfo = new JEditorPane();
              jTextAreaInfo.setBorder(null);
              jScrollPane1.setViewportView(jTextAreaInfo);
              jTextAreaInfo.setFont(new Font("Arial", Font.PLAIN, 10));
              jTextAreaInfo.setEditable(false);
              jTextAreaInfo.setOpaque(false);
              jTextAreaInfo.setContentType("text/html");
              jTextAreaInfo.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
            }
          }
        }
        {
          jPanelLeft = new JPanel();
          GridBagLayout jPanelLeftLayout = new GridBagLayout();
          jPanelLeftLayout.rowWeights = new double[] {0.0, 0.0, 1.0, 0.0};
          jPanelLeftLayout.rowHeights = new int[] {7, 7, -33, 50};
          jPanelLeftLayout.columnWeights = new double[] {0.1};
          jPanelLeftLayout.columnWidths = new int[] {7};
          jPanelLeft.setLayout(jPanelLeftLayout);
          jSplitPane1.add(jPanelLeft, JSplitPane.LEFT);
          jPanelLeft.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
          jPanelLeft.setPreferredSize(new java.awt.Dimension(198, 470));
          {
            jLabelExpression = new JLabel();
            jPanelLeft.add(
                jLabelExpression,
                new GridBagConstraints(
                    0,
                    0,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH,
                    new Insets(10, 10, 10, 0),
                    0,
                    0));
            jLabelExpression.setText("Expression:");
            jLabelExpression.setPreferredSize(new java.awt.Dimension(196, 16));
          }
          {
            expressionField = new JComboBox(expression_history);
            expressionField.setEditable(true);
            expressionField.setBorder(new LineBorder(new java.awt.Color(252, 117, 0), 1, false));
            expressionField.setSize(12, 18);
            jPanelLeft.add(
                expressionField,
                new GridBagConstraints(
                    0,
                    1,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH,
                    new Insets(10, 10, 10, 10),
                    0,
                    0));
            expressionField.addActionListener(
                new ActionListener() {
                  @Override
                  public void actionPerformed(ActionEvent e) {
                    // Two action events are fired on edit: one for editing the textfield, one for
                    // changing
                    // the combo box selection. We only catch the edition.
                    if (e.getActionCommand().equalsIgnoreCase("comboBoxEdited")) {
                      boolean valid = checkValid();
                      if (valid) {
                        addCurrentExpressionToHistory();
                        launchCalculation();
                      }
                    }
                  }
                });
          }
          {
            jScrollPaneImages = new JScrollPane();
            jPanelLeft.add(
                jScrollPaneImages,
                new GridBagConstraints(
                    0,
                    2,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH,
                    new Insets(10, 0, 10, 0),
                    0,
                    0));
            jScrollPaneImages.setPreferredSize(new java.awt.Dimension(196, 267));
            jScrollPaneImages.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            jScrollPaneImages.getVerticalScrollBar().setUnitIncrement(20);
            {
              jPanelImages = new JPanel();
              jScrollPaneImages.setViewportView(jPanelImages);
              jPanelImages.setLayout(null);
              jPanelImages.setPreferredSize(new java.awt.Dimension(190, 45));
            }
          }
          {
            jPanelLeftButtons = new JPanel();
            jPanelLeft.add(
                jPanelLeftButtons,
                new GridBagConstraints(
                    0,
                    3,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH,
                    new Insets(10, 0, 10, 0),
                    0,
                    0));
            jPanelLeftButtons.setLayout(null);
            jPanelLeftButtons.setPreferredSize(new java.awt.Dimension(196, 35));
            jPanelLeftButtons.setSize(196, 35);
            {
              jButtonPlus = new JButton();
              jPanelLeftButtons.add(jButtonPlus);
              jButtonPlus.setText("+");
              jButtonPlus.setBounds(9, -2, 35, 35);
              jButtonPlus.setFont(new java.awt.Font("Times New Roman", 0, 18));
              jButtonPlus.setOpaque(true);
              jButtonPlus.addActionListener(
                  new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                      addImageBox();
                    }
                  });
            }
            {
              jButtonMinus = new JButton();
              jPanelLeftButtons.add(jButtonMinus);
              jButtonMinus.setText("—");
              jButtonMinus.setBounds(46, -2, 35, 35);
              jButtonMinus.setFont(new java.awt.Font("Arial", 0, 12));
              jButtonMinus.setOpaque(true);
              jButtonMinus.addActionListener(
                  new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                      removeImageBox();
                    }
                  });
            }
          }
          jPanelLeft.addComponentListener(
              new ComponentListener() {
                public void componentShown(ComponentEvent e) {}

                public void componentResized(ComponentEvent e) {
                  refreshImageBoxes();
                }

                public void componentMoved(ComponentEvent e) {}

                public void componentHidden(ComponentEvent e) {}
              });
        }
      }
      pack();
      setSize(500, 500);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }