Example usage for java.lang System lineSeparator

List of usage examples for java.lang System lineSeparator

Introduction

In this page you can find the example usage for java.lang System lineSeparator.

Prototype

String lineSeparator

To view the source code for java.lang System lineSeparator.

Click Source Link

Usage

From source file:com.osparking.attendant.AttListForm.java

private String getModifiedUserInfo() {
    StringBuilder sBuild = new StringBuilder();

    sBuild.append("User Info Modification Summany=>" + System.lineSeparator());
    sBuild.append("\tModified User ID: " + userIDText.getText());
    sBuild.append(",\tIs Admin: " + (managerCheckBox.isSelected() ? "Yes" : "No"));
    sBuild.append(System.lineSeparator());

    sBuild.append("\tName: " + userNameText.getText().trim());
    sBuild.append(",\tCell: " + cellPhoneText.getText().trim() + System.lineSeparator());

    sBuild.append("\tPhone: " + phoneText.getText().trim());
    sBuild.append(",\tE-mail: " + emailAddrText.getText().trim() + System.lineSeparator());

    sBuild.append("\tPassword: " + (changePWCheckBox.isSelected() ? "changed" : "no change"));
    sBuild.append(", \tModifying User ID: " + loginID + System.lineSeparator());

    return sBuild.toString();
}

From source file:com.osparking.osparking.Settings_System.java

private void LanguageHelpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LanguageHelpButtonActionPerformed
    String helpText = LANGUAGE_HELP_1.getContent() + System.lineSeparator() + LANGUAGE_HELP_2.getContent();

    JDialog helpDialog = new PWHelpJDialog(this, false, LANGUAGE_SELECT_DIALOGTITLE.getContent(), helpText,
            false);/* ww w .  j a  v  a  2  s  . c om*/
    locateAndShowHelpDialog(this, helpDialog, LanguageHelpButton);
}

From source file:com.osparking.osparking.Settings_System.java

private void LoggingLevelHelpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LoggingLevelHelpButtonActionPerformed

    String helpText = LEVEL_LABEL.getContent() + "[" + OptnLoggingLevelComboBox.getSelectedItem().toString()
            + "]" + System.lineSeparator() + System.lineSeparator() + "* ";
    if (OptnLoggingLevelComboBox.getSelectedIndex() == OpLogLevel.LogAlways.ordinal()) {
        helpText += LOGGIND_DIALOG_1.getContent() + System.lineSeparator() + System.lineSeparator()
                + LOGGIND_DIALOG_2.getContent() + System.lineSeparator() + LOGGIND_DIALOG_3.getContent()
                + System.lineSeparator() + LOGGIND_DIALOG_4.getContent() + System.lineSeparator()
                + LOGGIND_DIALOG_5.getContent() + System.lineSeparator() + LOGGIND_DIALOG_6.getContent()
                + System.lineSeparator();
    } else if (OptnLoggingLevelComboBox.getSelectedIndex() == OpLogLevel.SettingsChange.ordinal()) {
        helpText += LOGGIND_DIALOG_A.getContent() + System.lineSeparator() + System.lineSeparator()
                + LOGGIND_DIALOG_B.getContent() + System.lineSeparator();

    } else if (OptnLoggingLevelComboBox.getSelectedIndex() == OpLogLevel.UserCarChange.ordinal()) {
        helpText += LOGGIND_DIALOG_A.getContent() + System.lineSeparator() + System.lineSeparator()
                + LOGGIND_DIALOG_C.getContent() + System.lineSeparator() + LOGGIND_DIALOG_D.getContent()
                + System.lineSeparator() + LOGGIND_DIALOG_E.getContent() + System.lineSeparator()
                + LOGGIND_DIALOG_F.getContent() + System.lineSeparator();
    }// w  w  w . j  a  v a 2 s  .  c  om

    JDialog helpDialog = new PWHelpJDialog(this, false, LOGGING_DIALOGTITLE.getContent(), helpText, false);
    locateAndShowHelpDialog(this, helpDialog, LoggingLevelHelpButton);
}

From source file:com.osparking.osparking.Settings_System.java

private void SettingsSaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SettingsSaveButtonActionPerformed
    Connection conn = null;/*  w  w w . j  a  va 2  s  . c o  m*/
    PreparedStatement updateSettings = null;
    int result = -1;
    boolean newStorePassingDelay = RecordPassingDelayChkBox.isSelected();
    Locale locale = LanguageBox.getLocale();
    boolean langNotSupported = (!locale.equals(defaultLocale) && !locale.equals(enUS_Locale));

    if (langNotSupported) {
        String message = WRONG_LANG_DIALOG_1.getContent() + System.lineSeparator();
        message += WRONG_LANG_DIALOG_2.getContent() + locale.getDisplayName() + System.lineSeparator()
                + System.lineSeparator();
        message += WRONG_LANG_DIALOG_3.getContent() + System.lineSeparator();
        message += WRONG_LANG_DIALOG_4.getContent() + defaultLocale.getDisplayName() + ", "
                + enUS_Locale.getDisplayName() + System.lineSeparator();

        JOptionPane.showConfirmDialog(this, message, LANGUAGE_ERROR_TITLE.getContent(),
                JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE);
        return;
    }

    //<editor-fold desc="--check setting input errors">
    if (!TextFieldNumericValueOK(TextFieldPicWidth, "Photo Extent Typing Errors")) {
        return;
    }

    if (!TextFieldNumericValueOK(TextFieldPicHeight, "Photo Height Typing Errors")) {
        return;
    }

    if (Integer.parseInt(removeNonNumeric(TextFieldPicHeight.getText().trim())) < 100) {
        TextFieldPicHeight.requestFocusInWindow();
        JOptionPane.showConfirmDialog(this, "Please enter a height value of 100 or more",
                "Picture Height Input Error", JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE);
        return;
    }

    if (Integer.parseInt(removeNonNumeric(TextFieldPicWidth.getText().trim())) < 100) {
        TextFieldPicWidth.requestFocusInWindow();
        JOptionPane.showConfirmDialog(this, "Please enter a width value of 100 or more",
                "Picture Width Input Error", JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE);
        return;
    }

    if (someIPaddressWrong()) {
        return;
    }

    if (someCOMportIDsame()) {
        return;
    }
    //</editor-fold>

    int newStatCount = 0;
    short pwLevel = -1;
    short optnLogLevel = -1;
    String maxLineStr = "";
    int imageKeepDuration = 0;
    int picWidth = Integer.parseInt(removeNonNumeric(TextFieldPicWidth.getText()));
    int picHeight = Integer.parseInt(removeNonNumeric(TextFieldPicHeight.getText()));
    int flowCycle = Integer.parseInt(removeNonNumeric((String) FlowingComboBox.getSelectedItem()));
    int blinkCycle = Integer.parseInt(removeNonNumeric(TextFieldPicWidth.getText()));
    boolean gateCountChanged = false;

    try {
        StringBuffer sb = new StringBuffer("Update SettingsTable SET ");
        //<editor-fold desc="--create update statement">
        sb.append("Lot_Name = ?, ");
        sb.append("perfEvalNeeded = ?, PWStrengthLevel = ?, OptnLoggingLevel = ?, ");
        sb.append("languageCode = ?, countryCode = ?, localeIndex = ?, statCount =  ?, ");
        sb.append("MaxMessageLines = ?, GateCount = ?, ");
        sb.append("PictureWidth = ?, PictureHeight = ?, ");
        sb.append("EBD_flow_cycle = ?, EBD_blink_cycle = ?, ");
        sb.append("max_maintain_date = ? ");
        //</editor-fold>

        ConvComboBoxItem selectedItem = (ConvComboBoxItem) PopSizeCBox.getSelectedItem();
        newStatCount = (Integer) selectedItem.getKeyValue();
        if (newStorePassingDelay) {
            for (int gateID = 1; gateID <= gateCount; gateID++) {
                initPassingDelayStatIfNeeded(newStatCount, gateID);
            }
        }
        conn = JDBCMySQL.getConnection();
        updateSettings = conn.prepareStatement(sb.toString());

        int pIndex = 1;

        // <editor-fold defaultstate="collapsed" desc="--Provide values to each parameters of the UPDATE statement">
        updateSettings.setString(pIndex++, lotNameTextField.getText().trim());
        if (newStorePassingDelay) {
            updateSettings.setInt(pIndex++, 1);
        } else {
            updateSettings.setInt(pIndex++, 0);
            if (DEBUG) {
                // Give warning that in debug mode PassingDelay is always recorded.
                JOptionPane.showMessageDialog(null, RECORD_DELAY_DEBUG.getContent());
            }
        }

        pwLevel = (short) (PWStrengthChoiceComboBox.getSelectedIndex());
        updateSettings.setShort(pIndex++, pwLevel);

        optnLogLevel = (short) (OptnLoggingLevelComboBox.getSelectedIndex());
        updateSettings.setShort(pIndex++, optnLogLevel);

        updateSettings.setString(pIndex++, LanguageBox.getLocale().getLanguage());
        updateSettings.setString(pIndex++, LanguageBox.getLocale().getCountry());
        updateSettings.setShort(pIndex++, (short) LanguageBox.getSelectedIndex());
        updateSettings.setInt(pIndex++, PopSizeCBox.getSelectedIndex());

        maxLineStr = (String) MessageMaxLineComboBox.getSelectedItem();
        updateSettings.setShort(pIndex++, new Short(maxLineStr));
        updateSettings.setShort(pIndex++, new Short((String) GateCountComboBox.getSelectedItem()));

        updateSettings.setInt(pIndex++, picWidth);
        updateSettings.setInt(pIndex++, picHeight);
        updateSettings.setInt(pIndex++, flowCycle);
        updateSettings.setInt(pIndex++, blinkCycle);

        ConvComboBoxItem item = (ConvComboBoxItem) ImageDurationCBox.getSelectedItem();
        imageKeepDuration = (Integer) (item.getKeyValue());
        updateSettings.setInt(pIndex++, imageKeepDuration);
        // </editor-fold>

        result = updateSettings.executeUpdate();
        if (index2Level(opLoggingIndex) != Level.OFF && index2Level(optnLogLevel) == Level.OFF) {
            Globals.isFinalWishLog = true;
        }
    } catch (SQLException se) {
        Globals.logParkingException(Level.SEVERE, se,
                "(Save settings: " + (newStorePassingDelay ? "Y" : "N") + ")");
    } finally {
        // <editor-fold defaultstate="collapsed" desc="--Return resources and display the save result">
        closeDBstuff(conn, updateSettings, null, "(Save settings: " + (newStorePassingDelay ? "Y" : "N") + ")");

        if (result == 1) {
            //<editor-fold desc="-- Log system settings change if set to do so">
            if (statCount != newStatCount) {
                logParkingOperation(OpLogLevel.SettingsChange,
                        "Settings Change, Statistics Population Size: " + statCount + " => " + newStatCount);
            }

            if (storePassingDelay != newStorePassingDelay) {
                logParkingOperation(OpLogLevel.SettingsChange, "Settings Change, Average Passing Delay: "
                        + storePassingDelay + " => " + newStorePassingDelay);
            }

            if (pwStrengthLevel != pwLevel) {
                logParkingOperation(OpLogLevel.SettingsChange,
                        "Settings Change, Password Strength Level: "
                                + PWStrengthChoiceComboBox.getItemAt(pwStrengthLevel) + " => "
                                + PWStrengthChoiceComboBox.getItemAt(pwLevel));
            }

            if (opLoggingIndex != optnLogLevel) {
                logParkingOperation(OpLogLevel.LogAlways,
                        "Settings Change, Gen' Operation Log Level: "
                                + OptnLoggingLevelComboBox.getItemAt(opLoggingIndex) + " => "
                                + OptnLoggingLevelComboBox.getItemAt(optnLogLevel));
            }

            if (localeIndex != (short) LanguageBox.getSelectedIndex()) {
                logParkingOperation(OpLogLevel.SettingsChange,
                        "Settings Change, Date Chooser Lang': " + LanguageBox.getItemAt(localeIndex) + " => "
                                + LanguageBox.getItemAt((short) LanguageBox.getSelectedIndex()));
            }

            if (maxMessageLines != new Short(maxLineStr)) {
                logParkingOperation(OpLogLevel.SettingsChange, "Settings Change, Recent Event Line Max: "
                        + maxMessageLines + " => " + new Short(maxLineStr));
            }

            short newGateCount = new Short((String) GateCountComboBox.getSelectedItem());

            gateCountChanged = gateCount != newGateCount;
            if (gateCountChanged) {
                logParkingOperation(OpLogLevel.SettingsChange,
                        "Settings Change, Number of Gates: " + gateCount + " => " + newGateCount);
            }

            if (maxMaintainDate != imageKeepDuration) {
                logParkingOperation(OpLogLevel.SettingsChange, "Settings Change, Image Keep Duration: "
                        + maxMaintainDate + " => " + imageKeepDuration);
            }

            if (PIC_WIDTH != picWidth) {
                logParkingOperation(OpLogLevel.SettingsChange,
                        "Settings Change, Image width: " + PIC_WIDTH + " => " + picWidth);
            }

            if (PIC_HEIGHT != picHeight) {
                logParkingOperation(OpLogLevel.SettingsChange,
                        "Settings Change, Image Height: " + PIC_HEIGHT + " => " + picHeight);
            }

            if (EBD_flowCycle != flowCycle) {
                logParkingOperation(OpLogLevel.UserCarChange,
                        "E-Board Settings Change, Cycles--flowing: " + EBD_flowCycle + " => " + flowCycle);
            }

            if (EBD_blinkCycle != blinkCycle) {
                logParkingOperation(OpLogLevel.UserCarChange,
                        "E-Board Settings Change, Cycles--blinking: " + EBD_blinkCycle + " => " + blinkCycle);
            }

            if (mainForm != null && gateCountChanged) {
                JOptionPane.showMessageDialog(mainForm, REBOOT_MESSAGE.getContent(), REBOOT_POPUP.getContent(),
                        WARNING_MESSAGE,
                        new javax.swing.ImageIcon(mainForm.getClass().getResource("/restart.png")));
                mainForm.askUserIntentionOnProgramStop(true);
            }
            //</editor-fold>

            Globals.getOperationLog().setLevel(index2Level(opLoggingIndex));
        } else {
            JOptionPane.showMessageDialog(this, FAIL_SAVE_SETTINGS_DIALOG.getContent(),
                    SETTINGS_SAVE_RESULT.getContent(), JOptionPane.ERROR_MESSAGE);
        }
        // </editor-fold>
    }
    boolean majorChange[] = new boolean[] { false };

    result += saveGateDevices(majorChange);

    if (mainForm != null && (gateCountChanged || majorChange[0])) {
        JOptionPane.showMessageDialog(mainForm, REBOOT_MESSAGE.getContent(), REBOOT_POPUP.getContent(),
                WARNING_MESSAGE, new javax.swing.ImageIcon(mainForm.getClass().getResource("/restart.png")));
        mainForm.askUserIntentionOnProgramStop(true);
    }

    if (result == gateCount + 1) {
        readSettings();
        Globals.getOperationLog().setLevel(index2Level(opLoggingIndex));
        JOptionPane.showMessageDialog(this, SAVE_SETTINGS_DIALOG.getContent(),
                SETTINGS_SAVE_RESULT.getContent(), JOptionPane.PLAIN_MESSAGE);
        enableSaveCancelButtons(false);
    } else {
        JOptionPane.showMessageDialog(this, FAIL_SAVE_SETTINGS_DIALOG.getContent(),
                SETTINGS_SAVE_RESULT.getContent(), JOptionPane.ERROR_MESSAGE);
    }
}

From source file:com.osparking.osparking.Settings_System.java

private void PopSizeHelpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PopSizeHelpButtonActionPerformed
    String helpText = PopSizeHelp1.getContent() + System.lineSeparator() + PopSizeHelp2.getContent()
            + System.lineSeparator() + PopSizeHelp3.getContent() + System.lineSeparator()
            + System.lineSeparator() + PopSizeHelp4.getContent() + System.lineSeparator()
            + PopSizeHelp5.getContent() + System.lineSeparator() + PopSizeHelp6.getContent()
            + System.lineSeparator();

    JDialog helpDialog = new PWHelpJDialog(this, false, STATISTICS_SIZE_LABEL.getContent(), helpText, false);
    locateAndShowHelpDialog(this, helpDialog, PopSizeHelpButton);
}

From source file:com.osparking.osparking.Settings_System.java

private boolean someIPaddressWrong() {
    InetAddressValidator validator = InetAddressValidator.getInstance();

    for (int i = 0; i < gateCount; i++) {
        JTextField txtField;/*from   w w  w  . ja v  a2 s.  co m*/

        for (DeviceType devType : DeviceType.values()) {
            String devName = devType.toString();
            txtField = (JTextField) getComponentByName(devName + (i + 1) + "_IP_TextField");
            if (!validator.isValidInet4Address(txtField.getText())) {
                GatesTabbedPane.setSelectedIndex(i);
                txtField.requestFocusInWindow();
                JOptionPane.showConfirmDialog(this,
                        devType.getContent() + " #" + (i + 1) + " " + IP_ADDR_ERROR_1.getContent()
                                + System.lineSeparator() + IP_ADDR_ERROR_2.getContent() + "127.0.0.1",
                        IP_ERROR_TITLE.getContent(), JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE);
                return true;
            }
        }
    }
    return false;
}

From source file:com.osparking.osparking.Settings_System.java

private boolean someCOMportIDsame(int gateNo, DeviceType deviceType, ArrayList<COM_ID_Usage> com_ID_usageList) {
    JComboBox cBox = (JComboBox) componentMap.get(deviceType.toString() + gateNo + "_connTypeCBox");
    String connType = (String) cBox.getSelectedItem();
    if (!connType.equals(ConnectionType.RS_232.getLabel())) {
        return false;
    }//from w  w  w  .j  a va 2  s  .c om

    cBox = (JComboBox) componentMap.get(deviceType.toString() + gateNo + "_comID_CBox");
    String currCOM_ID = (String) cBox.getSelectedItem();

    for (COM_ID_Usage usage : com_ID_usageList) {
        if (usage.COM_ID.equals(currCOM_ID)) {
            String msg = OVERLAPPED_PORT_DIALOG_1.getContent() + System.lineSeparator()
                    + OVERLAPPED_PORT_DIALOG_2.getContent() + System.lineSeparator()
                    + OVERLAPPED_PORT_DIALOG_3.getContent() + System.lineSeparator() + System.lineSeparator()
                    + DEVICE_LABEL.getContent() + " 1 : " + GATE_LABEL.getContent() + " " + usage.gateNo + ", "
                    + usage.deviceType + System.lineSeparator() + DEVICE_LABEL.getContent() + " 2 : "
                    + GATE_LABEL.getContent() + " " + gateNo + ", " + deviceType + System.lineSeparator()
                    + OVERLAPPED_PORT_DIALOG_4.getContent() + "COM" + usage.COM_ID + System.lineSeparator();
            int response = JOptionPane.showConfirmDialog(this, msg, OVERLAPPED_PORT_TITLE.getContent(),
                    YES_NO_OPTION, ERROR_MESSAGE);

            if (response == YES_OPTION) {
                return false;
            } else {
                return true;
            }
        }
    }
    com_ID_usageList.add(new COM_ID_Usage(gateNo, deviceType, currCOM_ID));

    return false;
}

From source file:com.osparking.osparking.Settings_System.java

private void showWarningReallyHere(int gateID, DeviceType type) {
    String msg = CHECK_IP_DIALOG_1.getContent() + System.lineSeparator() + System.lineSeparator() + " -"
            + DEV_CONN_ERROR_2.getContent() + GATE_NAME_LABEL.getContent() + gateID + System.lineSeparator()
            + " -" + DEV_CONN_ERROR_3.getContent() + type.getContent() + "#" + gateID + System.lineSeparator()
            + System.lineSeparator() + CHECK_IP_DIALOG_4.getContent();

    JOptionPane.showMessageDialog(this, msg, Blackfly + " " + CHECK_IP_TITLE.getContent(),
            JOptionPane.WARNING_MESSAGE);
}

From source file:com.osparking.osparking.Settings_System.java

private void checkGateNameLength(int gateNo, KeyEvent evt) {
    JTextField gateNameField = (JTextField) getComponentByName("TextFieldGateName" + gateNo);
    String gateName = gateNameField.getText().trim();

    if (gateName.length() > GATE_NAME_LENGTH_MAX) {
        gateNameField.setText(gateNames[gateNo]);
        getToolkit().beep();//from w  w  w.ja  v  a 2  s. co  m
        JOptionPane.showConfirmDialog(this,
                GATE_NAME_LABEL2.getContent() + " " + System.lineSeparator() + System.lineSeparator()
                        + LIMIT_LABEL.getContent() + GATE_NAME_LENGTH_MAX,
                ERROR_DIALOGTITLE.getContent(), JOptionPane.PLAIN_MESSAGE, WARNING_MESSAGE);
        evt.consume();
    }
}