public HDMColdAccountForm(final WalletListPanel walletListPanel) {
    this.walletListPanel = walletListPanel;

    inactiveBackGroundColor = Color.WHITE;
    selected = false;
    panelMain.setOpaque(true);
    panelMain.setFocusable(true);
    panelMain.setBackground(inactiveBackGroundColor);

    if (ColorAndFontConstants.isInverse()) {
      inactiveBackGroundColor =
          new Color(
              Math.min(255, Themes.currentTheme.detailPanelBackground().getRed() + 2 * COLOR_DELTA),
              Math.min(
                  255, Themes.currentTheme.detailPanelBackground().getBlue() + 2 * COLOR_DELTA),
              Math.min(
                  255, Themes.currentTheme.detailPanelBackground().getGreen() + 2 * COLOR_DELTA));
    } else {
      inactiveBackGroundColor =
          new Color(
              Math.max(0, Themes.currentTheme.detailPanelBackground().getRed() - COLOR_DELTA),
              Math.max(0, Themes.currentTheme.detailPanelBackground().getBlue() - COLOR_DELTA),
              Math.max(0, Themes.currentTheme.detailPanelBackground().getGreen() - COLOR_DELTA));
    }
    panelMain.applyComponentOrientation(
        ComponentOrientation.getOrientation(LocaliserUtils.getLocale()));

    updateFromModel();
    panelMain.addMouseListener(
        new WalletMouseListener(this.walletListPanel, HDMColdAccountForm.this));

    setSelected(false);
    setContent();
  }
  /** Creates new form SwitchboardView */
  public SwitchboardView() {
    initComponents();

    btnSalesReport.addActionListener(this);
    btnBackOffice.addActionListener(this);
    btnClockOut.addActionListener(this);
    btnEditTicket.addActionListener(this);

    if (!"false".equals(AppConfig.getFeatureGroupTicketFlag())) {
      btnGroupSettle.addActionListener(this);
    }

    btnLogout.addActionListener(this);

    if (!"false".equals(AppConfig.getManagerMenuFlag())) {
      btnManager.addActionListener(this);
    }

    btnNewTicket.addActionListener(this);

    if (!"false".equals(AppConfig.getFeaturePenarikanFlag())) {
      btnPayout.addActionListener(this);
    }

    btnOrderInfo.addActionListener(this);
    btnReopenTicket.addActionListener(this);
    btnSettleTicket.addActionListener(this);
    btnShutdown.addActionListener(this);

    if (!"false".equals(AppConfig.getFeatureSplitTicketFlag())) {
      btnSplitTicket.addActionListener(this);
    }

    btnTakeout.addActionListener(this);
    btnVoidTicket.addActionListener(this);

    orderServiceExtension = Application.getPluginManager().getPlugin(OrderServiceExtension.class);

    if (orderServiceExtension == null) {
      //            btnHomeDelivery.setEnabled(false);
      //            btnPickup.setEnabled(false);
      //            btnDriveThrough.setEnabled(false);
      //            btnAssignDriver.setEnabled(false);
      //            btnCloseOrder.setEnabled(false);

      orderServiceExtension = new DefaultOrderServiceExtension();
    }
    //		ticketListUpdater = new Timer(30 * 1000, new TicketListUpdaterTask());

    applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));

    instance = this;
  }
示例#3
0
  /** Creates a new {@link IssueAssetDialog}. */
  public IssueAssetDialog(
      BitcoinController bitcoinController, MultiBitFrame mainFrame, TradeingPanel tradePanel) {
    super(mainFrame, bitcoinController.getLocaliser().getString("IssueAssetDialog.title"));
    this.bitcoinController = bitcoinController;
    this.controller = this.bitcoinController;
    this.tradePanel = tradePanel;

    initUI();

    issueAssetPanel.getCancelButton().requestFocusInWindow();
    applyComponentOrientation(
        ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()));
  }
示例#4
0
 TranscodingTab(PmsConfiguration configuration) {
   this.configuration = configuration;
   // Apply the orientation for the locale
   Locale locale = new Locale(configuration.getLanguage());
   orientation = ComponentOrientation.getOrientation(locale);
 }
示例#5
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;
  }
示例#6
0
  @Override
  protected JPanel createFormPanel(JPanel formPanel, GridBagConstraints constraints) {
    formPanel.setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR);

    JPanel buttonPanel = new JPanel();
    FlowLayout flowLayout = new FlowLayout();
    flowLayout.setAlignment(FlowLayout.LEADING);
    buttonPanel.setLayout(flowLayout);

    formPanel.setLayout(new GridBagLayout());

    // create stents and forcers
    createFormPanelStentsAndForcers(formPanel, constraints);

    MultiBitLabel addressLabel =
        new MultiBitLabel(controller.getLocaliser().getString("sendBitcoinPanel.addressLabel"));
    addressLabel.setToolTipText(
        HelpContentsPanel.createTooltipText(
            controller.getLocaliser().getString("sendBitcoinPanel.addressLabel.tooltip")));
    addressLabel.setHorizontalAlignment(JLabel.TRAILING);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.weightx = 4.0;
    constraints.weighty = 0.2;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    formPanel.add(addressLabel, constraints);
    String receiveAddressText =
        controller.getLocaliser().getString("receiveBitcoinPanel.addressLabel");
    MultiBitLabel notUsedReceiveAddressLabel = new MultiBitLabel(receiveAddressText);
    formPanel.add(
        MultiBitTitledPanel.createStent(
            (int) notUsedReceiveAddressLabel.getPreferredSize().getWidth()),
        constraints);

    int longFieldWidth = fontMetrics.stringWidth(MultiBitFrame.EXAMPLE_LONG_FIELD_TEXT);
    addressTextField = new MultiBitTextField("", 24, controller);
    addressTextField.setHorizontalAlignment(JTextField.LEADING);
    addressTextField.setMinimumSize(
        new Dimension(
            longFieldWidth,
            getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont()).getHeight()
                + TEXTFIELD_VERTICAL_DELTA));
    addressTextField.setPreferredSize(
        new Dimension(
            longFieldWidth,
            getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont()).getHeight()
                + TEXTFIELD_VERTICAL_DELTA));
    addressTextField.setMaximumSize(
        new Dimension(
            longFieldWidth,
            getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont()).getHeight()
                + TEXTFIELD_VERTICAL_DELTA));

    addressTextField.addKeyListener(new QRCodeKeyListener());
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 2;
    constraints.gridy = 1;
    constraints.weightx = 1.0;
    constraints.weighty = 0.2;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    formPanel.add(addressTextField, constraints);

    ImageIcon copyIcon = ImageLoader.createImageIcon(ImageLoader.COPY_ICON_FILE);
    CopySendAddressAction copyAddressAction = new CopySendAddressAction(controller, this, copyIcon);
    MultiBitButton copyAddressButton = new MultiBitButton(copyAddressAction, controller);
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 6;
    constraints.gridy = 1;
    constraints.weightx = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    formPanel.add(copyAddressButton, constraints);

    ImageIcon pasteIcon = ImageLoader.createImageIcon(ImageLoader.PASTE_ICON_FILE);
    PasteAddressAction pasteAddressAction =
        new PasteAddressAction(super.bitcoinController, this, pasteIcon);
    pasteAddressButton = new MultiBitButton(pasteAddressAction, controller);
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 8;
    constraints.gridy = 1;
    constraints.weightx = 10.0;
    constraints.weighty = 0.2;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    formPanel.add(pasteAddressButton, constraints);

    MultiBitLabel labelLabel =
        new MultiBitLabel(controller.getLocaliser().getString("sendBitcoinPanel.labelLabel"));
    labelLabel.setToolTipText(
        HelpContentsPanel.createTooltipText(
            controller.getLocaliser().getString("sendBitcoinPanel.labelLabel.tooltip")));
    labelLabel.setHorizontalAlignment(JLabel.TRAILING);
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.weightx = 0.1;
    constraints.weighty = 1.0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    formPanel.add(labelLabel, constraints);

    JTextField aTextField = new JTextField();
    labelTextArea =
        new MultiBitTextArea("", AbstractTradePanel.PREFERRED_NUMBER_OF_LABEL_ROWS, 20, controller);
    labelTextArea.setBorder(aTextField.getBorder());
    labelTextArea.addKeyListener(new QRCodeKeyListener());

    final JScrollPane labelScrollPane =
        new JScrollPane(
            labelTextArea,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    labelScrollPane.setOpaque(true);
    labelScrollPane.setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR);
    labelScrollPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    labelScrollPane
        .getViewport()
        .addChangeListener(
            new ChangeListener() {
              @Override
              public void stateChanged(ChangeEvent e) {
                if (labelScrollPane.getVerticalScrollBar().isVisible()) {
                  labelScrollPane.setBorder(
                      BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY));
                } else {
                  labelScrollPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
                }
              }
            });
    labelScrollPane.setMinimumSize(
        new Dimension(
            longFieldWidth,
            getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont()).getHeight()
                    * AbstractTradePanel.PREFERRED_NUMBER_OF_LABEL_ROWS
                + TEXTFIELD_VERTICAL_DELTA
                + 6));
    labelScrollPane.setPreferredSize(
        new Dimension(
            longFieldWidth,
            getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont()).getHeight()
                    * AbstractTradePanel.PREFERRED_NUMBER_OF_LABEL_ROWS
                + TEXTFIELD_VERTICAL_DELTA
                + 6));
    labelScrollPane.getHorizontalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT);
    labelScrollPane.getVerticalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 2;
    constraints.gridy = 3;
    constraints.weightx = 0.6;
    constraints.weighty = 1.0;
    constraints.gridwidth = 3;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    formPanel.add(labelScrollPane, constraints);

    MultiBitLabel amountLabel =
        new MultiBitLabel(controller.getLocaliser().getString("sendBitcoinPanel.amountLabel"));
    amountLabel.setToolTipText(
        HelpContentsPanel.createTooltipText(
            controller.getLocaliser().getString("sendBitcoinPanel.amountLabel.tooltip")));
    amountLabel.setHorizontalAlignment(JLabel.TRAILING);
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 0;
    constraints.gridy = 5;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.1;
    constraints.weighty = 0.20;
    constraints.anchor = GridBagConstraints.LINE_END;
    formPanel.add(amountLabel, constraints);

    JPanel amountPanel = createAmountPanel();
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 2;
    constraints.gridy = 5;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0.1;
    constraints.weighty = 0.20;
    constraints.anchor = GridBagConstraints.LINE_START;
    formPanel.add(amountPanel, constraints);

    notificationLabel = new MultiBitLabel("");
    notificationLabel.setForeground(Color.RED);
    // notificationLabel.setBorder(BorderFactory.createLineBorder(Color.GREEN));
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 2;
    constraints.gridy = 6;
    constraints.gridwidth = 8;
    constraints.gridheight = 3;
    constraints.weightx = 0.1;
    constraints.weighty = 0.1;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    formPanel.add(notificationLabel, constraints);

    Action helpAction;
    if (ComponentOrientation.LEFT_TO_RIGHT
        == ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())) {
      helpAction =
          new HelpContextAction(
              controller,
              ImageLoader.HELP_CONTENTS_BIG_ICON_FILE,
              "multiBitFrame.helpMenuText",
              "multiBitFrame.helpMenuTooltip",
              "multiBitFrame.helpMenuText",
              HelpContentsPanel.HELP_SENDING_URL);
    } else {
      helpAction =
          new HelpContextAction(
              controller,
              ImageLoader.HELP_CONTENTS_BIG_RTL_ICON_FILE,
              "multiBitFrame.helpMenuText",
              "multiBitFrame.helpMenuTooltip",
              "multiBitFrame.helpMenuText",
              HelpContentsPanel.HELP_SENDING_URL);
    }
    HelpButton helpButton = new HelpButton(helpAction, controller);
    helpButton.setText("");

    String tooltipText =
        HelpContentsPanel.createMultilineTooltipText(
            new String[] {
              controller.getLocaliser().getString("sendBitcoinPanel.helpLabel1.message"),
              controller.getLocaliser().getString("sendBitcoinPanel.helpLabel2.message"),
              controller.getLocaliser().getString("sendBitcoinPanel.helpLabel3.message"),
              "\n",
              controller.getLocaliser().getString("multiBitFrame.helpMenuTooltip")
            });
    helpButton.setToolTipText(tooltipText);
    helpButton.setHorizontalAlignment(SwingConstants.LEADING);
    helpButton.setBorder(
        BorderFactory.createEmptyBorder(
            0, HELP_BUTTON_INDENT, HELP_BUTTON_INDENT, HELP_BUTTON_INDENT));
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 8;
    constraints.weightx = 1;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.BELOW_BASELINE_LEADING;
    formPanel.add(helpButton, constraints);

    sendBitcoinConfirmAction =
        new SendBitcoinConfirmAction(super.bitcoinController, mainFrame, this);
    sendBitcoinConfirmAction.setEnabled(enableSendButton);
    sendButton = new MultiBitButton(sendBitcoinConfirmAction, controller);
    if (enableSendButton) {
      sendButton.setEnabled(true);
      sendButton.setToolTipText(
          HelpContentsPanel.createTooltipText(
              controller.getLocaliser().getString("sendBitcoinAction.tooltip")));
    } else {
      sendButton.setEnabled(false);
      sendButton.setToolTipText(
          HelpContentsPanel.createTooltipText(
              controller.getLocaliser().getString("sendBitcoinAction.pleaseWait.tooltip")));
    }

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 6;
    constraints.gridy = 5;
    constraints.weightx = 0.1;
    constraints.weighty = 0.1;
    constraints.gridwidth = 3;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    formPanel.add(sendButton, constraints);

    Action sidePanelAction = new MoreOrLessAction(controller, this);
    sidePanelButton = new MultiBitButton(sidePanelAction, controller);
    sidePanelButton.setBorder(BorderFactory.createEmptyBorder());
    sidePanelButton.setBorderPainted(false);
    sidePanelButton.setFocusPainted(false);
    sidePanelButton.setContentAreaFilled(false);

    displaySidePanel();

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 4;
    constraints.gridy = 3;
    constraints.weightx = 0.1;
    constraints.weighty = 0.3;
    constraints.gridwidth = 7;
    constraints.gridheight = 3;
    constraints.anchor = GridBagConstraints.BASELINE_TRAILING;
    formPanel.add(sidePanelButton, constraints);

    return formPanel;
  }