public void loadData(boolean forceReload) {
   ICFFreeSwitchSchemaObj schemaObj = swingSchema.getSchema();
   if ((containingCluster == null) || forceReload) {
     CFSecurityAuthorization auth = schemaObj.getAuthorization();
     long containingClusterId = auth.getSecClusterId();
     containingCluster = schemaObj.getClusterTableObj().readClusterByIdIdx(containingClusterId);
   }
   if ((listOfTenant == null) || forceReload) {
     arrayOfTenant = null;
     listOfTenant =
         schemaObj
             .getTenantTableObj()
             .readTenantByClusterIdx(containingCluster.getRequiredId(), swingIsInitializing);
     if (listOfTenant != null) {
       Object objArray[] = listOfTenant.toArray();
       if (objArray != null) {
         int len = objArray.length;
         arrayOfTenant = new ICFSecurityTenantObj[len];
         for (int i = 0; i < len; i++) {
           arrayOfTenant[i] = (ICFSecurityTenantObj) objArray[i];
         }
         Arrays.sort(arrayOfTenant, compareTenantByQualName);
       }
     }
   }
 }
Beispiel #2
0
 public void removeFriendFromList(String name) {
   for (int i = 0; i < list.size(); ) {
     if (list.get(i).toString().equals(name)) list.remove(i);
     else i++;
   }
   copy2view();
   list_fri.setListData(list_view.toArray());
 }
Beispiel #3
0
 public void addFriend2List(String name) {
   for (int i = 0; i < list.size(); ) {
     if (list.get(i).toString().equals(name)) return;
     else i++;
   }
   list.add(name);
   copy2view();
   list_fri.setListData(list_view.toArray());
 }
    /**
     * Removes specific rows from the list of reading lists.
     *
     * @param aRows rows to remove.
     */
    public void removeRows(int[] aRows) {
      Arrays.sort(aRows);

      java.util.List<ReadingList> newLists = new ArrayList<ReadingList>(Arrays.asList(lists));
      for (int i = aRows.length - 1; i >= 0; i--) {
        newLists.remove(aRows[i]);
      }

      setLists(newLists.toArray(new ReadingList[newLists.size()]));
    }
 public com.kingdee.bos.ctrl.swing.KDToolBar[] getUIMultiToolBar() {
   java.util.List list = new java.util.ArrayList();
   com.kingdee.bos.ctrl.swing.KDToolBar[] bars = super.getUIMultiToolBar();
   if (bars != null) {
     list.addAll(java.util.Arrays.asList(bars));
   }
   list.add(this.toolBar);
   return (com.kingdee.bos.ctrl.swing.KDToolBar[])
       list.toArray(new com.kingdee.bos.ctrl.swing.KDToolBar[list.size()]);
 }
 String[] getContactList() {
   java.util.List cl = new java.util.LinkedList();
   StringTokenizer st = new StringTokenizer(contactList.getText());
   StringBuffer sb = new StringBuffer();
   StringBuffer dbg = new StringBuffer("test applet contactlist: ");
   while (st.hasMoreTokens()) {
     String loginId = st.nextToken().trim();
     if (loginId.length() == 0) continue;
     dbg.append("'" + loginId + "' ");
     cl.add(loginId);
     sb.append(loginId).append('\n');
   }
   CAT.info(dbg.toString());
   contactList.setText(sb.toString());
   return (String[]) cl.toArray(new String[cl.size()]);
 }
 public void loadData(boolean forceReload) {
   ICFSecuritySchemaObj schemaObj = swingSchema.getSchema();
   if ((listOfISOTimezone == null) || forceReload) {
     arrayOfISOTimezone = null;
     listOfISOTimezone =
         schemaObj.getISOTimezoneTableObj().readAllISOTimezone(swingIsInitializing);
     if (listOfISOTimezone != null) {
       Object objArray[] = listOfISOTimezone.toArray();
       if (objArray != null) {
         int len = objArray.length;
         arrayOfISOTimezone = new ICFSecurityISOTimezoneObj[len];
         for (int i = 0; i < len; i++) {
           arrayOfISOTimezone[i] = (ICFSecurityISOTimezoneObj) objArray[i];
         }
         Arrays.sort(arrayOfISOTimezone, compareISOTimezoneByQualName);
       }
     }
   }
 }
 public void loadData(boolean forceReload) {
   ICFBamSchemaObj schemaObj = swingSchema.getSchema();
   if ((listOfAccessFrequency == null) || forceReload) {
     arrayOfAccessFrequency = null;
     listOfAccessFrequency =
         schemaObj.getAccessFrequencyTableObj().readAllAccessFrequency(swingIsInitializing);
     if (listOfAccessFrequency != null) {
       Object objArray[] = listOfAccessFrequency.toArray();
       if (objArray != null) {
         int len = objArray.length;
         arrayOfAccessFrequency = new ICFBamAccessFrequencyObj[len];
         for (int i = 0; i < len; i++) {
           arrayOfAccessFrequency[i] = (ICFBamAccessFrequencyObj) objArray[i];
         }
         Arrays.sort(arrayOfAccessFrequency, compareAccessFrequencyByQualName);
       }
     }
   }
 }
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    myNestedFormLoader = new MyNestedFormLoader();

    final String swingPath = PathUtil.getJarPathForClass(AbstractButton.class);

    java.util.List<URL> cp = new ArrayList<URL>();
    appendPath(cp, JBTabbedPane.class);
    appendPath(cp, TIntObjectHashMap.class);
    appendPath(cp, UIUtil.class);
    appendPath(cp, SystemInfoRt.class);
    appendPath(cp, ApplicationManager.class);
    appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/messages/UIBundle.properties"));
    appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/RuntimeBundle.properties"));
    appendPath(cp, GridLayoutManager.class); // forms_rt
    appendPath(cp, DataProvider.class);
    myClassFinder =
        new MyClassFinder(
            new URL[] {new File(swingPath).toURI().toURL()}, cp.toArray(new URL[cp.size()]));
  }
  public InstantMessageFrame(
      String clientUsername,
      java.util.List<String> friendsListArray,
      HashMap<String, InstantMessageDialog> currentConversations,
      ClientMessageGetterSender clientMessageGetterSender) {
    super(clientUsername);
    this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    this.clientUsername = clientUsername;
    this.friendsList = new JList(friendsListArray.toArray());
    this.currentConversations = currentConversations;
    this.clientMessageGetterSender = clientMessageGetterSender;

    // Setup the InstantMessageFrame
    Container instantMessageFrameContentPane = this.getContentPane();
    instantMessageFrameContentPane.setLayout(new BorderLayout());
    instantMessageFrameContentPane.add(getFriendsPane(), BorderLayout.CENTER);

    // Create handler for double-clicks on the friends list
    DisplayMessageDialogHandler displayMessageDialogHandler =
        new DisplayMessageDialogHandler(
            clientUsername, currentConversations, clientMessageGetterSender);
    friendsList.addMouseListener(displayMessageDialogHandler);
  }
 public void setSpinnerSemester(JSpinner spinnerSemester) {
   this.spinnerSemester = spinnerSemester;
   java.util.List<Semester> semesterList = svmContext.getSvmModel().getSemestersAll();
   if (semesterList.isEmpty()) {
     // keine Semester erfasst
     SpinnerModel spinnerModel = new SpinnerListModel(new String[] {""});
     spinnerSemester.setModel(spinnerModel);
     spinnerSemester.setEnabled(false);
     return;
   }
   Semester[] semesters = semesterList.toArray(new Semester[semesterList.size()]);
   SpinnerModel spinnerModelSemester = new SpinnerListModel(semesters);
   spinnerSemester.setModel(spinnerModelSemester);
   spinnerSemester.addChangeListener(
       new ChangeListener() {
         @Override
         public void stateChanged(ChangeEvent e) {
           onSemesterSelected();
         }
       });
   // Model initialisieren
   kurseSemesterwahlModel.setSemester(
       kurseSemesterwahlModel.getInitSemester(svmContext.getSvmModel()));
 }
Beispiel #12
0
  public boolean initApp(AppProperties props) {

    m_props = props;
    // setPreferredSize(new java.awt.Dimension(800, 600));

    // support for different component orientation languages.
    applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));

    // Database start
    try {
      session = AppViewConnection.createSession(m_props);
    } catch (BasicException e) {
      JMessageDialog.showMessage(this, new MessageInf(MessageInf.SGN_DANGER, e.getMessage(), e));
      return false;
    }

    m_dlSystem = (DataLogicSystem) getBean("com.openbravo.pos.forms.DataLogicSystem");

    // Create or upgrade the database if database version is not the expected
    String sDBVersion = readDataBaseVersion();
    if (!AppLocal.APP_VERSION.equals(sDBVersion)) {

      // Create or upgrade database

      String sScript =
          sDBVersion == null
              ? m_dlSystem.getInitScript() + "-create.sql"
              : m_dlSystem.getInitScript() + "-upgrade-" + sDBVersion + ".sql";

      if (JRootApp.class.getResource(sScript) == null) {
        JMessageDialog.showMessage(
            this,
            new MessageInf(
                MessageInf.SGN_DANGER,
                sDBVersion == null
                    ? AppLocal.getIntString(
                        "message.databasenotsupported",
                        session.DB
                            .getName()) // Create script does not exists. Database not supported
                    : AppLocal.getIntString(
                        "message.noupdatescript"))); // Upgrade script does not exist.
        session.close();
        return false;
      } else {
        // Create or upgrade script exists.
        if (JOptionPane.showConfirmDialog(
                this,
                AppLocal.getIntString(
                    sDBVersion == null ? "message.createdatabase" : "message.updatedatabase"),
                AppLocal.getIntString("message.title"),
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE)
            == JOptionPane.YES_OPTION) {

          try {
            BatchSentence bsentence = new BatchSentenceResource(session, sScript);
            bsentence.putParameter("APP_ID", Matcher.quoteReplacement(AppLocal.APP_ID));
            bsentence.putParameter("APP_NAME", Matcher.quoteReplacement(AppLocal.APP_NAME));
            bsentence.putParameter("APP_VERSION", Matcher.quoteReplacement(AppLocal.APP_VERSION));

            java.util.List l = bsentence.list();
            if (l.size() > 0) {
              JMessageDialog.showMessage(
                  this,
                  new MessageInf(
                      MessageInf.SGN_WARNING,
                      AppLocal.getIntString("Database.ScriptWarning"),
                      l.toArray(new Throwable[l.size()])));
            }
          } catch (BasicException e) {
            JMessageDialog.showMessage(
                this,
                new MessageInf(
                    MessageInf.SGN_DANGER, AppLocal.getIntString("Database.ScriptError"), e));
            session.close();
            return false;
          }
        } else {
          session.close();
          return false;
        }
      }
    }

    // Cargamos las propiedades de base de datos
    m_propsdb = m_dlSystem.getResourceAsProperties(m_props.getHost() + "/properties");

    // creamos la caja activa si esta no existe
    try {
      String sActiveCashIndex = m_propsdb.getProperty("activecash");
      Object[] valcash =
          sActiveCashIndex == null ? null : m_dlSystem.findActiveCash(sActiveCashIndex);
      if (valcash == null || !m_props.getHost().equals(valcash[0])) {
        // no la encuentro o no es de mi host por tanto creo una...
        setActiveCash(
            UUID.randomUUID().toString(),
            m_dlSystem.getSequenceCash(m_props.getHost()) + 1,
            new Date(),
            null);

        // creamos la caja activa
        m_dlSystem.execInsertCash(
            new Object[] {
              getActiveCashIndex(),
              m_props.getHost(),
              getActiveCashSequence(),
              getActiveCashDateStart(),
              getActiveCashDateEnd()
            });
      } else {
        setActiveCash(sActiveCashIndex, (Integer) valcash[1], (Date) valcash[2], (Date) valcash[3]);
      }
    } catch (BasicException e) {
      // Casco. Sin caja no hay pos
      MessageInf msg =
          new MessageInf(
              MessageInf.SGN_NOTICE, AppLocal.getIntString("message.cannotclosecash"), e);
      msg.show(this);
      session.close();
      return false;
    }

    // Leo la localizacion de la caja (Almacen).
    m_sInventoryLocation = m_propsdb.getProperty("location");
    if (m_sInventoryLocation == null) {
      m_sInventoryLocation = "0";
      m_propsdb.setProperty("location", m_sInventoryLocation);
      m_dlSystem.setResourceAsProperties(m_props.getHost() + "/properties", m_propsdb);
    }

    // Inicializo la impresora...
    m_TP = new DeviceTicket(this, m_props);

    // Inicializamos
    m_TTP = new TicketParser(getDeviceTicket(), m_dlSystem);
    printerStart();

    // Inicializamos la bascula
    m_Scale = new DeviceScale(this, m_props);

    // Inicializamos la scanpal
    m_Scanner = DeviceScannerFactory.createInstance(m_props);

    // Leemos los recursos basicos
    BufferedImage imgicon = m_dlSystem.getResourceAsImage("Window.Logo");
    m_jLblTitle.setIcon(imgicon == null ? null : new ImageIcon(imgicon));
    m_jLblTitle.setText(m_dlSystem.getResourceAsText("Window.Title"));

    String sWareHouse;
    try {
      sWareHouse = m_dlSystem.findLocationName(m_sInventoryLocation);
    } catch (BasicException e) {
      sWareHouse = null; // no he encontrado el almacen principal
    }

    // Show Hostname, Warehouse and URL in taskbar
    String url;
    try {
      url = session.getURL();
    } catch (SQLException e) {
      url = "";
    }
    m_jHost.setText("<html>" + m_props.getHost() + " - " + sWareHouse + "<br>" + url);

    showLogin();

    return true;
  }
Beispiel #13
0
  private void initComponents() {
    splitPaneMain = new javax.swing.JSplitPane();
    //
    // splitPanel = new javax.swing.JSplitPane();
    splitPanelLeft = new javax.swing.JSplitPane();
    graphOptionsPanel = new javax.swing.JPanel();
    graphPanel = new javax.swing.JPanel();
    rightPanel = new javax.swing.JPanel();
    generalPanel = new javax.swing.JPanel();
    nameTextField = new javax.swing.JTextField();
    labelForName = new javax.swing.JLabel();
    blocksPanel = new javax.swing.JPanel();
    addBlockButton = new javax.swing.JButton();
    removeBlockButton = new javax.swing.JButton();
    adjustBlockButton = new javax.swing.JButton();
    portsPanel = new javax.swing.JPanel();
    addPortButton = new javax.swing.JButton();
    removePortButton = new javax.swing.JButton();
    adjustPortButton = new javax.swing.JButton();
    blockRelationsPanel = new javax.swing.JPanel();
    addRelationButton = new javax.swing.JButton();
    removeRelationButton = new javax.swing.JButton();

    splitPanelLeft.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

    graphOptionsPanel.setLayout(
        new javax.swing.BoxLayout(graphOptionsPanel, javax.swing.BoxLayout.PAGE_AXIS));

    topOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Mouse Mode"));
    graphOptionsPanel.add(topOptionsPanel);

    bottomOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Layout"));
    graphOptionsPanel.add(bottomOptionsPanel);

    gm = new DefaultModalGraphMouse();
    JComboBox modeBox = gm.getModeComboBox();
    topOptionsPanel.add(modeBox);

    PortConnections pconnsInst = PortConnections.getInstance();
    vv = new VisualizationViewer(new CircleLayout(pconnsInst));
    // create the transformers
    // edge label
    final Transformer edgeLabel =
        new Transformer() {
          public String transform(Object obj) {
            if (obj instanceof InteractionArc) {
              InteractionArc arc = (InteractionArc) obj;
              return arc.getArcStateShort();
            }
            return "unknown";
          }
        };
    this.edgeLabel = edgeLabel;
    vv.getRenderContext().setEdgeLabelTransformer(edgeLabel);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    // options
    java.util.List<String> options = new ArrayList<String>();
    options.add("FRLayout");
    options.add("KKLayout");
    options.add("CircleLayout");
    options.add("SpringLayout");
    options.add("SpringLayout2");
    options.add("ISOMLayout");
    layoutBox = new JComboBox(options.toArray());
    layoutBox.setSelectedItem(options.get(0));
    layoutBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            InteractionGraphs igraphs = InteractionGraphs.getInstance();
            InteractionGraph graph = igraphs.getGraph(emidSelected);
            String selected = (String) ((JComboBox) e.getSource()).getSelectedItem();
            if (selected.equals("FRLayout")) {
              vv = new VisualizationViewer(new FRLayout(graph));
            } else if (selected.equals("KKLayout")) {
              vv = new VisualizationViewer(new KKLayout(graph));
            } else if (selected.equals("CircleLayout")) {
              vv = new VisualizationViewer(new CircleLayout(graph));
            } else if (selected.equals("SpringLayout")) {
              vv = new VisualizationViewer(new SpringLayout(graph));
            } else if (selected.equals("SpringLayout2")) {
              vv = new VisualizationViewer(new SpringLayout2(graph));
            } else if (selected.equals("ISOMLayout")) {
              vv = new VisualizationViewer(new ISOMLayout(graph));
            }
            vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
            vv.getRenderContext().setEdgeLabelTransformer(edgeLabel);
            vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
            setVisualizationViewer(vv);
          }
        });
    layoutBox.setSelectedItem("CircleLayout");

    bottomOptionsPanel.add(layoutBox);

    splitPanelLeft.setTopComponent(graphOptionsPanel);

    javax.swing.GroupLayout graphPanelLayout = new javax.swing.GroupLayout(graphPanel);
    graphPanel.setLayout(graphPanelLayout);
    graphPanelLayout.setHorizontalGroup(
        graphPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 181, Short.MAX_VALUE));
    graphPanelLayout.setVerticalGroup(
        graphPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 432, Short.MAX_VALUE));

    // splitPanelLeft.setRightComponent(graphPanel);

    splitPaneMain.setLeftComponent(splitPanelLeft);

    rightPanel.setLayout(new javax.swing.BoxLayout(rightPanel, javax.swing.BoxLayout.PAGE_AXIS));

    generalPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("General"));

    labelForName.setText("name");

    nameTextField.setText("new");

    javax.swing.GroupLayout generalPanelLayout = new javax.swing.GroupLayout(generalPanel);
    generalPanel.setLayout(generalPanelLayout);
    generalPanelLayout.setHorizontalGroup(
        generalPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                generalPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(labelForName)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(
                        nameTextField,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        265,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(140, Short.MAX_VALUE)));
    generalPanelLayout.setVerticalGroup(
        generalPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                generalPanelLayout
                    .createSequentialGroup()
                    .addGroup(
                        generalPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(labelForName)
                            .addComponent(
                                nameTextField,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(96, Short.MAX_VALUE)));

    rightPanel.add(generalPanel);

    blocksPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Blocks"));

    javax.swing.GroupLayout blocksPanelLayout = new javax.swing.GroupLayout(blocksPanel);
    blocksPanel.setLayout(blocksPanelLayout);
    blocksPanelLayout.setHorizontalGroup(
        blocksPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                blocksPanelLayout
                    .createSequentialGroup()
                    .addGap(179, 179, 179)
                    .addGroup(
                        blocksPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(
                                adjustBlockButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                removeBlockButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                addBlockButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                114,
                                Short.MAX_VALUE))
                    .addContainerGap(158, Short.MAX_VALUE)));
    blocksPanelLayout.setVerticalGroup(
        blocksPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                blocksPanelLayout
                    .createSequentialGroup()
                    .addComponent(addBlockButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(removeBlockButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(adjustBlockButton)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    rightPanel.add(blocksPanel);

    portsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Ports"));

    javax.swing.GroupLayout portsPanelLayout = new javax.swing.GroupLayout(portsPanel);
    portsPanel.setLayout(portsPanelLayout);
    portsPanelLayout.setHorizontalGroup(
        portsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                portsPanelLayout
                    .createSequentialGroup()
                    .addGap(177, 177, 177)
                    .addGroup(
                        portsPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(
                                adjustPortButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                removePortButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                addPortButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                115,
                                Short.MAX_VALUE))
                    .addContainerGap(159, Short.MAX_VALUE)));
    portsPanelLayout.setVerticalGroup(
        portsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                portsPanelLayout
                    .createSequentialGroup()
                    .addComponent(addPortButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(removePortButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(adjustPortButton)
                    .addContainerGap(32, Short.MAX_VALUE)));

    rightPanel.add(portsPanel);

    blockRelationsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Block Relations"));

    javax.swing.GroupLayout blockRelationsPanelLayout =
        new javax.swing.GroupLayout(blockRelationsPanel);
    blockRelationsPanel.setLayout(blockRelationsPanelLayout);
    blockRelationsPanelLayout.setHorizontalGroup(
        blockRelationsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                blockRelationsPanelLayout
                    .createSequentialGroup()
                    .addGap(177, 177, 177)
                    .addGroup(
                        blockRelationsPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(
                                removeRelationButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                addRelationButton,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                114,
                                Short.MAX_VALUE))
                    .addContainerGap(159, Short.MAX_VALUE)));
    blockRelationsPanelLayout.setVerticalGroup(
        blockRelationsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                blockRelationsPanelLayout
                    .createSequentialGroup()
                    .addComponent(addRelationButton)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(removeRelationButton)
                    .addContainerGap(61, Short.MAX_VALUE)));

    rightPanel.add(blockRelationsPanel);

    splitPaneMain.setRightComponent(rightPanel);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                splitPaneMain, javax.swing.GroupLayout.DEFAULT_SIZE, 653, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                splitPaneMain,
                javax.swing.GroupLayout.Alignment.TRAILING,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                541,
                Short.MAX_VALUE));
  }
Beispiel #14
0
 private void updateTodoItems() {
   todoItemsList.setListData(todoItems.toArray());
 }
Beispiel #15
0
  /** Create the panel. */
  public JListFriendPanel(String name, String path, ChatPanel chatpanel) {
    super(name, path);
    temp = chatpanel;

    setLayout(null);
    txtSearch = new JTextField();
    txtSearch.setBounds(10, 11, 151, 29);
    add(txtSearch);
    txtSearch.setColumns(10);

    JButton btnSearch = new JButton("Tìm");
    btnSearch.addMouseListener(
        new MouseAdapter() {
          @Override
          /** Tìm kiếm keyword trong danh sách bạn bè */
          public void mouseClicked(MouseEvent arg0) {
            String keyword = txtSearch.getText();
            if (keyword.isEmpty()) copy2view();
            else {
              list_view.clear();
              for (int i = 0; i < list.size(); i++)
                if (list.get(i).contains(keyword)) {
                  list_view.add(list.get(i));
                }
            }
            list_fri.setListData(list_view.toArray());
          }
        });
    btnSearch.setBounds(171, 11, 69, 29);
    add(btnSearch);
    list_fri = new JList();
    list_fri.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list_fri.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {}
        });
    list_fri.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent arg0) {
            int n = list_fri.getSelectedIndex();
            txtSearch.setText(list_view.get(n));
          }
        });
    // Khởi tạo danh sách bạn
    copy2view();
    // Cap nhat danh sach ban
    ScrollPane scrollPane = new ScrollPane();
    list_fri.setListData(list.toArray());
    list_fri.setSelectedIndex(0);
    scrollPane.setBounds(10, 76, 230, 305);
    scrollPane.add(list_fri);
    add(scrollPane);

    JLabel lblTrcTuyn = new JLabel("Danh sách bạn bè");
    lblTrcTuyn.setForeground(new Color(144, 238, 144));
    lblTrcTuyn.setBounds(10, 51, 123, 14);
    add(lblTrcTuyn);

    JButton btnSearchServer = new JButton("Tìm kiếm tất cả");
    btnSearchServer.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            change2searchserver();
          }
        });
    btnSearchServer.setBounds(127, 387, 113, 29);
    add(btnSearchServer);

    JButton btnChat = new JButton("Trò chuyện");
    btnChat.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            temp.CreateTab(list_view.get(list_fri.getSelectedIndex()));
          }
        });
    btnChat.setBounds(10, 387, 113, 29);
    add(btnChat);
  }