Example usage for java.lang Boolean Boolean

List of usage examples for java.lang Boolean Boolean

Introduction

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

Prototype

@Deprecated(since = "9")
public Boolean(String s) 

Source Link

Document

Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true" .

Usage

From source file:PlayerOfMedia.java

/***************************************************************************
 * Construct a PlayerOfMedia. The Frame will have the title supplied by the
 * user. All initial actions on the PlayerOfMedia object are initiated
 * through its menu (or shotcut key).//  w ww .java  2  s. c  o m
 **************************************************************************/
PlayerOfMedia(String name) {

    super(name);
    ///////////////////////////////////////////////////////////
    // Setup the menu system: a "File" menu with Open and Quit.
    ///////////////////////////////////////////////////////////
    bar = new MenuBar();
    fileMenu = new Menu("File");
    MenuItem openMI = new MenuItem("Open...", new MenuShortcut(KeyEvent.VK_O));
    openMI.setActionCommand("OPEN");
    openMI.addActionListener(this);
    fileMenu.add(openMI);
    MenuItem quitMI = new MenuItem("Quit", new MenuShortcut(KeyEvent.VK_Q));
    quitMI.addActionListener(this);
    quitMI.setActionCommand("QUIT");
    fileMenu.add(quitMI);
    bar.add(fileMenu);
    setMenuBar(bar);

    ///////////////////////////////////////////////////////
    // Layout the frame, its position on screen, and ensure
    // window closes are dealt with properly, including
    // relinquishing the resources of any Player.
    ///////////////////////////////////////////////////////
    setLayout(new BorderLayout());
    setLocation(100, 100);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            if (player != null) {
                player.stop();
                player.close();
            }
            System.exit(0);
        }
    });

    /////////////////////////////////////////////////////
    // Build the Dialog box by which the user can select
    // the media to play.
    /////////////////////////////////////////////////////
    selectionDialog = new Dialog(this, "Media Selection");
    Panel pan = new Panel();
    pan.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    mediaName = new TextField(40);
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 2;
    pan.add(mediaName, gbc);
    choose = new Button("Choose File...");
    gbc.ipadx = 10;
    gbc.ipady = 10;
    gbc.gridx = 2;
    gbc.gridwidth = 1;
    pan.add(choose, gbc);
    choose.addActionListener(this);
    open = new Button("Open");
    gbc.gridy = 1;
    gbc.gridx = 1;
    pan.add(open, gbc);
    open.addActionListener(this);
    cancel = new Button("Cancel");
    gbc.gridx = 2;
    pan.add(cancel, gbc);
    cancel.addActionListener(this);
    selectionDialog.add(pan);
    selectionDialog.pack();
    selectionDialog.setLocation(200, 200);

    ////////////////////////////////////////////////////
    // Build the error Dialog box by which the user can
    // be informed of any errors or problems.
    ////////////////////////////////////////////////////
    errorDialog = new Dialog(this, "Error", true);
    errorLabel = new Label("");
    errorDialog.add(errorLabel, "North");
    ok = new Button("OK");
    ok.addActionListener(this);
    errorDialog.add(ok, "South");
    errorDialog.pack();
    errorDialog.setLocation(150, 300);

    Manager.setHint(Manager.PLUGIN_PLAYER, new Boolean(true));
}

From source file:com.duroty.controller.actions.ForgotPasswordAction.java

/**
 * DOCUMENT ME!//www  .  ja  va  2 s .co m
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Open getOpenInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    OpenHome home = null;

    Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER));

    if (localServer.booleanValue()) {
        home = OpenUtil.getHome();
    } else {
        Hashtable environment = getContextProperties(request);
        home = OpenUtil.getHome(environment);
    }

    return home.create();
}

From source file:com.sun.honeycomb.admin.mgmt.server.HCCellAdapterBase.java

/**
 * placeholoder - adds "isAlive" variable to the structure
 * so it can be populated in case we're returning 
 * a dummy structure on the ADM side./*from w  w  w  .j a va 2s.  c om*/
 */
public Boolean getIsAlive() throws MgmtException {
    return new Boolean(true);
}

From source file:ijfx.core.batch.BatchService.java

public Boolean applyWorkflow(ProgressHandler progress, List<? extends BatchSingleInput> inputs,
        Workflow workflow) {/* ww  w  .  j a v  a2 s .  co m*/

    final Timer t = timerService.getTimer("Workflow");

    if (progress == null) {
        progress = new SilentProgressHandler();
    }

    Boolean lock = new Boolean(true);

    if (workflow == null) {
        logger.warning("No workflow was provided");
        return true;
    }

    int totalOps = inputs.size() * (2 + workflow.getStepList().size());

    progress.setStatus("Starting batch processing...");

    boolean success = true;
    BooleanProperty successProperty = new SimpleBooleanProperty();
    Exception error = null;
    setRunning(true);

    BiConsumer<String, String> logTime = (step, msg) -> {
        t.elapsed(String.format("[%s][%s]%s", workflow.getName(), step, msg));
    };

    progress.setTotal(totalOps);

    for (int i = 0; i != inputs.size(); i++) {
        //inputs.parallelStream().forEach(input->{
        logger.info("Running...");

        final BatchSingleInput input = inputs.get(i);

        if (progress.isCancelled()) {
            progress.setStatus("Batch Processing cancelled");
            success = false;
            //return;
            break;

        }

        t.start();
        synchronized (lock) {
            logger.info("Loading input...");
            progress.setStatus("Loading %s...", input.getName());
            try {
                getContext().inject(input);
            } catch (IllegalStateException ise) {
                logger.warning("Context already injected");
            }
            try {
                input.load();
            } catch (Exception e) {
                logger.log(Level.SEVERE, "Couldn't load input", e);
                error = e;
                success = false;
                break;

            }
            logger.info("Input loaded");
        }
        logTime.accept("loading", "done");
        progress.increment(1);
        if (i < inputs.size() - 1) {
            // loading the next one while processing the current one
            BatchSingleInput next = inputs.get(i + 1);
            ImageJFX.getThreadPool().execute(() -> {
                synchronized (lock) {
                    logger.info("Loading next input...");
                    next.load();
                    logger.info("Next input loaded.");

                }
            });
        }

        for (WorkflowStep step : workflow.getStepList()) {
            logger.info("Executing step : " + step.getId());
            String title;
            try {
                title = step.getModule().getInfo().getTitle();
                progress.setStatus(String.format("Processing %s with %s", input.getName(), title));

            } catch (NullPointerException e) {
                title = "???";
                progress.setStatus("...");
            }
            progress.increment(1);

            final Module module = moduleService.createModule(step.getModule().getInfo());
            try {
                getContext().inject(module.getDelegateObject());
            } catch (Exception e) {
                logger.warning("Context already injected in module ?");
            }
            logTime.accept("injection", "done");
            logger.info("Module created : " + module.getDelegateObject().getClass().getSimpleName());
            if (!executeModule(input, module, step.getParameters())) {

                progress.setStatus("Error :-(");
                progress.setProgress(0, 1);
                success = false;
                logger.info("Error when executing module : " + module.getInfo().getName());
                break;
            }
            ;
            logTime.accept(title, "done");

        }

        if (success == false) {
            break;
        }

        synchronized (lock) {
            progress.setStatus("Saving %s...", input.getName());
            input.save();
            progress.increment(1);
        }
        logTime.accept("saving", "done");
        input.dispose();
    }

    if (success) {
        logger.info("Batch processing completed");
        progress.setStatus("Batch processing completed.");
        progress.setProgress(1.0);

    } else if (progress.isCancelled()) {
        progress.setStatus("Batch processing cancelled");
    } else {

        progress.setStatus("An error happend during the process.");
        progress.setProgress(1, 1);
    }
    setRunning(false);
    return success;

}

From source file:com.sun.socialsite.config.Config.java

/**
 * Retrieve a property as a boolean ... with specified default if not present.
 *//*from w  w w .jav  a 2 s  .  c om*/
public static boolean getBooleanProperty(String name, boolean defaultValue) {
    // get the value first, then convert
    String value = Config.getProperty(name);

    if (value == null)
        return defaultValue;

    return (new Boolean(value)).booleanValue();
}

From source file:com.duroty.application.files.utils.FilesDefaultAction.java

/**
 * DOCUMENT ME!/*from  w w w .ja  v  a2s . co m*/
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected FilesSearch getFilesSearchInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    FilesSearchHome home = null;

    Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER));

    if (localServer.booleanValue()) {
        home = FilesSearchUtil.getHome();
    } else {
        Hashtable environment = getContextProperties(request);
        home = FilesSearchUtil.getHome(environment);
    }

    return home.create();
}

From source file:net.sourceforge.doddle_owl.ui.GeneralOntologySelectionPanel.java

public void loadGeneralOntologyInfo(File loadFile) {
    if (!loadFile.exists()) {
        return;/*from  w  ww .  j a va 2  s. c  om*/
    }
    BufferedReader reader = null;
    try {
        FileInputStream fis = new FileInputStream(loadFile);
        reader = new BufferedReader(new InputStreamReader(fis, "UTF-8"));
        Properties properties = new Properties();
        properties.load(reader);
        boolean t = new Boolean(properties.getProperty("EDR(general)"));
        edrCheckBox.setSelected(t);
        enableEDRDic(t);
        t = new Boolean(properties.getProperty("EDR(technical)"));
        edrtCheckBox.setSelected(t);
        enableEDRTDic(t);
        t = new Boolean(properties.getProperty("WordNet"));
        wnCheckBox.setSelected(t);
        enableWordNetDic(t);
        t = new Boolean(properties.getProperty("JPN WordNet"));
        jpnWnCheckBox.setSelected(t);
        enableJpnWordNetDic(t);
        t = new Boolean(properties.getProperty("JWO"));
        jwoCheckBox.setSelected(t);
        enableJWO(t);
    } catch (IOException ioex) {
        ioex.printStackTrace();
    } finally {
        try {
            if (reader != null) {
                reader.close();
            }
        } catch (IOException ioe2) {
            ioe2.printStackTrace();
        }
    }
}

From source file:ExpenseReport.java

public ExpenseData() {
    m_date = new Date();
    m_amount = new Double(0);
    m_category = new Integer(1);
    m_approved = new Boolean(false);
    m_description = "";
}

From source file:ConversionUtil.java

public static Object convertToValue(Class aClass, byte[] inputArray) throws Exception {

    Object returnValue = null;//w  ww.  j  a  v a  2s.co  m
    String className = aClass.getName();
    if (className.equals(Integer.class.getName())) {
        returnValue = new Integer(convertToInt(inputArray));
    } else if (className.equals(String.class.getName())) {
        returnValue = convertToString(inputArray);
    } else if (className.equals(Byte.class.getName())) {
        returnValue = new Byte(convertToByte(inputArray));
    } else if (className.equals(Long.class.getName())) {
        returnValue = new Long(convertToLong(inputArray));
    } else if (className.equals(Short.class.getName())) {
        returnValue = new Short(convertToShort(inputArray));
    } else if (className.equals(Boolean.class.getName())) {
        returnValue = new Boolean(convertToBoolean(inputArray));
    } else {
        throw new Exception("Cannot convert object of type " + className);
    }
    return returnValue;
}

From source file:com.emergya.persistenceGeo.dto.LayerDto.java

/**
 * Clone layer DTO//from w w w  . j a  va2  s.  c  o m
 */
public Object clone() throws CloneNotSupportedException {
    LayerDto cloned = (LayerDto) super.clone();
    LayerDto origin = this;

    cloned.id = null; // not clone id
    //cloned.id = origin.id != null ? new Long(origin.id) : null; // clone id
    cloned.name = origin.name != null ? new String(origin.name) : null;
    cloned.enabled = origin.enabled != null ? new Boolean(origin.enabled) : null;
    cloned.createDate = origin.createDate != null ? (Date) origin.createDate.clone() : null;
    cloned.updateDate = origin.updateDate != null ? (Date) origin.updateDate.clone() : null;
    cloned.order = origin.order != null ? new String(origin.order) : null;
    cloned.type = origin.type != null ? new String(origin.type) : null;
    cloned.server_resource = origin.server_resource != null ? new String(origin.server_resource) : null;
    cloned.user = origin.user != null ? new String(origin.user) : null;
    cloned.published = origin.published ? new Boolean(origin.published) : null;
    cloned.enabled = origin.enabled ? new Boolean(enabled) : null;
    cloned.pertenece_a_canal = origin.pertenece_a_canal ? new Boolean(pertenece_a_canal) : null;
    cloned.folderId = origin.folderId != null ? new Long(origin.folderId) : null;
    cloned.authId = origin.authId != null ? new Long(origin.authId) : null;

    cloned.data = origin.data; // FIXME: clone data
    cloned.styles = origin.styles; // FIXME: clone styles
    cloned.properties = origin.properties; // FIXME: clone properties

    cloned.tableName = origin.tableName;

    return cloned;
}