#5 Playlist Editor With Radio Reference Support (#760)

* WIP - Adds support for aliasing P25 Phase 2 tones.Playlist editor - adds editor support for alias actions

* Playlist editor implementation and integration into application is complete. Adds JavaFX window monitoring to persist window size/location across application runs.

Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
Denny Sheirer
2020-04-26 11:53:43 +00:00
committed by GitHub
parent 39f6d6c831
commit cc52ae5bd7
290 changed files with 31251 additions and 15306 deletions

View File

@@ -0,0 +1,84 @@
/*
*
* * ******************************************************************************
* * Copyright (C) 2014-2020 Dennis Sheirer
* *
* * This program is free software: you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation, either version 3 of the License, or
* * (at your option) any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
* *
* * You should have received a copy of the GNU General Public License
* * along with this program. If not, see <http://www.gnu.org/licenses/>
* * *****************************************************************************
*
*
*/
package io.github.dsheirer.gui.control;
import javafx.scene.control.TextField;
import javafx.scene.control.TextFormatter;
import javafx.util.converter.IntegerStringConverter;
import java.util.function.UnaryOperator;
/**
* Text field control for integer values.
*/
public class IntegerTextField extends TextField
{
private static final String REGEX = "[1-9][0-9]*";
/**
* Constructs an instance
*/
public IntegerTextField()
{
UnaryOperator<TextFormatter.Change> filter = change ->
{
String newText = change.getControlNewText();
if(newText.isEmpty() || newText.matches(REGEX))
{
return change;
}
return null;
};
setTextFormatter(new TextFormatter<Integer>(new IntegerStringConverter(), 0, filter));
}
/**
* Current integer value of the control, or null if the value is not parsable as an integer
*/
public Integer get()
{
String rawText = getText();
try
{
return Integer.parseInt(rawText);
}
catch(Exception pe)
{
//Do nothing ... we couldn't parse the value
}
return null;
}
/**
* Sets the integer value in the control
*/
public void set(int value)
{
setText(String.valueOf(value));
}
}